Changeset 25986

Show
Ignore:
Timestamp:
19.07.2012 14:38:26 (7 years ago)
Author:
sjm84
Message:

All of the actions that use format statements will now merge in the global format statement

Location:
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/BrowseAction.java

    r25984 r25986  
    99import org.greenstone.gsdl3.util.GSPath; 
    1010import org.greenstone.gsdl3.util.GSXML; 
     11import org.greenstone.gsdl3.util.GSXSLT; 
    1112import org.greenstone.gsdl3.util.OID; 
    1213import org.greenstone.gsdl3.util.UserContext; 
     
    1415import org.w3c.dom.Node; 
    1516import org.w3c.dom.NodeList; 
    16 OTE: this class not used at present!!!!! 
     17 
     18//NOTE: this class not used at present!!!!! 
    1719/** action for classifier browsing */ 
    1820public class BrowseAction extends Action 
     
    130132            if (this_format != null) 
    131133            { 
     134                Element global_format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.GLOBAL_FORMAT_ELEM); 
     135                if(global_format_elem != null) 
     136                { 
     137                    GSXSLT.mergeFormatElements(this_format, global_format_elem, false); 
     138                } 
    132139                Element new_format = GSXML.duplicateWithNewName(this.doc, this_format, GSXML.FORMAT_ELEM, false); 
    133140                // set teh format type 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java

    r25861 r25986  
    99import org.greenstone.gsdl3.util.GSPath; 
    1010import org.greenstone.gsdl3.util.GSXML; 
     11import org.greenstone.gsdl3.util.GSXSLT; 
    1112import org.greenstone.gsdl3.util.OID; 
    1213import org.greenstone.gsdl3.util.UserContext; 
     
    4142    protected Element classifierBrowse(Element request) 
    4243    { 
    43  
    4444        Element page_response = this.doc.createElement(GSXML.RESPONSE_ELEM); 
    4545 
     
    115115        if (format_elem != null) 
    116116        { 
    117  
    118117            // find the one for the classifier we are in 
    119118            Element this_format = GSXML.getNamedElement(format_elem, GSXML.CLASSIFIER_ELEM, GSXML.NAME_ATT, top_id); 
     
    125124            if (this_format != null) 
    126125            { 
     126                Element global_format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.GLOBAL_FORMAT_ELEM); 
     127                if(global_format_elem != null) 
     128                { 
     129                    System.err.println("MERGING " + GSXML.xmlNodeToString(this_format) + "\n\nAND\n\n" + GSXML.xmlNodeToString(global_format_elem)); 
     130                    GSXSLT.mergeFormatElements(this_format, global_format_elem, false); 
     131                    System.err.println("RESULT = " + GSXML.xmlNodeToString(this_format)); 
     132                } 
     133 
    127134                Element new_format = GSXML.duplicateWithNewName(this.doc, this_format, GSXML.FORMAT_ELEM, false); 
    128135                extractMetadataNames(new_format, doc_meta_names, class_meta_names); 
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/QueryAction.java

    r25860 r25986  
    11package org.greenstone.gsdl3.action; 
    22 
    3 import org.greenstone.gsdl3.core.ModuleInterface; 
    4 import org.greenstone.gsdl3.util.*; 
    5 // XML classes 
     3import java.io.Serializable; 
     4import java.util.HashMap; 
     5import java.util.HashSet; 
     6 
     7import org.apache.log4j.Logger; 
     8import org.greenstone.gsdl3.util.GSParams; 
     9import org.greenstone.gsdl3.util.GSPath; 
     10import org.greenstone.gsdl3.util.GSXML; 
     11import org.greenstone.gsdl3.util.GSXSLT; 
     12import org.greenstone.gsdl3.util.UserContext; 
     13import org.w3c.dom.Element; 
    614import org.w3c.dom.Node; 
    715import org.w3c.dom.NodeList; 
    8 import org.w3c.dom.Text; 
    9 import org.w3c.dom.Document; 
    10 import org.w3c.dom.Element; 
    11  
    12 import java.util.HashMap; 
    13 import java.util.HashSet; 
    14 import java.util.Vector; 
    15 import java.util.Map; 
    16 import java.util.Iterator; 
    17 import java.io.File; 
    18 import java.io.Serializable; 
    19  
    20 import org.apache.log4j.*; 
    2116 
    2217/** action class for queries */ 
     
    205200        if (format_elem != null) 
    206201        { 
     202            Element global_format_elem = (Element) GSXML.getChildByTagName(format_response, GSXML.GLOBAL_FORMAT_ELEM); 
     203            if (global_format_elem != null) 
     204            { 
     205                GSXSLT.mergeFormatElements(format_elem, global_format_elem, false); 
     206            } 
    207207            // set the format type 
    208208            format_elem.setAttribute(GSXML.TYPE_ATT, "search"); 
     
    236236 
    237237        Element mr_metadata_response = (Element) this.mr.process(mr_metadata_message); 
    238          
     238 
    239239        // check for errors 
    240240        processErrorElements(mr_metadata_response, page_response);