Changeset 6371


Ignore:
Timestamp:
2004-01-09T12:28:36+13:00 (20 years ago)
Author:
kjdon
Message:

made some changes. this file not used but may use later

File:
1 edited

Legend:

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

    r5401 r6371  
    1010
    1111import java.util.HashMap;
     12import java.util.HashSet;
    1213import java.util.Vector;
    1314import java.io.File;
    1415
     16//NOTE: this class not used at present!!!!!
    1517/** action for classifier browsing */
    1618public class BrowseAction extends Action {
     
    5759
    5860    String lang = request.getAttribute(GSXML.LANG_ATT);
     61    String uid = request.getAttribute(GSXML.USER_ID_ATT);   
    5962    String to = GSPath.appendLink(collection, service_name);
    6063   
     
    6467   
    6568    Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
    66     Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang);
     69    Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);
    6770    info_message.appendChild(info_request);
    6871   
    6972    // also get the format stuff now if there is some
    70     Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang);
     73    Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid);
    7174    info_message.appendChild(format_request);
    7275    // process the requests
     
    99102    // the id of the classifier is the top id of the selected node
    100103    String top_id = OID.getTop(classifier_node);
     104   
     105    HashSet metadata_names = new HashSet();
    101106
    102107    // add the format info into the response
     
    105110        // find the one for the classifier we are in
    106111        Element this_format = GSXML.getNamedElement(format_elem, GSXML.CLASSIFIER_ELEM, GSXML.NAME_ATT, top_id);
     112        if (this_format == null) {
     113        this_format = (Element)GSXML.getChildByTagName(format_elem, GSXML.DEFAULT_ELEM);
     114        }
    107115        if (this_format != null) {
    108116        Element new_format = GSXML.duplicateWithNewName(this.doc, this_format, GSXML.FORMAT_ELEM, false);
     
    111119
    112120        page_response.appendChild(new_format);
    113         }
    114     }
    115    
     121        extractMetadataNames(new_format, metadata_names);
     122        }
     123    }
     124   
     125    System.out.println("extracted meta names, "+metadata_names.toString());
    116126    // get the browse structure for the selected node
    117127    Element classify_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
     
    205215        // should be based on info sent in from the recept, and the
    206216        // format stuff
    207         Element cl_param_list  = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
    208         Element p = this.doc.createElement(GSXML.PARAM_ELEM);
    209         cl_param_list.appendChild(p);
    210         p.setAttribute(GSXML.NAME_ATT, "metadata");
    211         p.setAttribute(GSXML.VALUE_ATT, "all");
     217        Element cl_param_list = null;
     218        if (metadata_names.isEmpty()) {
     219        cl_param_list  = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
     220        Element p = this.doc.createElement(GSXML.PARAM_ELEM);
     221        cl_param_list.appendChild(p);
     222        p.setAttribute(GSXML.NAME_ATT, "metadata");
     223        p.setAttribute(GSXML.VALUE_ATT, "Title");
     224        } else {
     225        cl_param_list  = createMetadataParamList(metadata_names);
     226        }
     227
    212228        cl_meta_request.appendChild(cl_param_list);
    213229       
Note: See TracChangeset for help on using the changeset viewer.