Ignore:
Timestamp:
2004-02-02T11:26:18+13:00 (20 years ago)
Author:
nzdl
Message:

now gets the query service description if on the about page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl3/src/java/org/greenstone/gsdl3/core/NZDLReceptionist.java

    r6300 r6677  
    2929    // this gets the collection info
    3030    Element page_response = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_RESPONSE_ELEM);
     31    Element page_request = (Element)GSXML.getChildByTagName(page, GSXML.PAGE_REQUEST_ELEM);
    3132    Element collection_info = (Element)GSXML.getChildByTagName(page_response, GSXML.COLLECTION_ELEM);
    3233    if (collection_info== null) {
     
    4243        return;
    4344    }
    44 
     45   
     46    Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
     47    String lang = page.getAttribute(GSXML.LANG_ATT);
     48   
     49    boolean do_classifier = false;
     50    boolean do_query = false;
    4551    Element classifier_service = GSXML.getNamedElement(service_list, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "ClassifierBrowse");
    46     if (classifier_service == null) {
    47         return; // no browsing stuff
     52    Element query_service = GSXML.getNamedElement(service_list, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "TextQuery");
     53    if (classifier_service != null) {
     54        do_classifier = true;
     55        // find the list of classifiers
     56   
     57        String to = GSPath.appendLink(collection, "ClassifierBrowse");
     58        Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, "");
     59        info_message.appendChild(info_request);
    4860    }
    49        
    50     String lang = page.getAttribute(GSXML.LANG_ATT);
    51     // find the list of classifiers
    52     Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM);
    53     String to = GSPath.appendLink(collection, "ClassifierBrowse");
    54     Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, "");
    55     info_message.appendChild(info_request);
    5661   
    57     Element info_response = (Element) this.mr.process(info_message);
    58     String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.SERVICE_ELEM);
    59     Element classifier_service_info = (Element)GSXML.getNodeByPath(info_response, path);
     62    String action = page_request.getAttribute(GSXML.ACTION_ATT);
     63    String subaction = page_request.getAttribute(GSXML.SUBACTION_ATT);
    6064   
    61     service_list.replaceChild(this.doc.importNode(classifier_service_info, true), classifier_service);
     65    if (query_service != null && action.equals("p") && subaction.equals("about")) {
     66        do_query = true;
     67        // get the full description
     68        String to = GSPath.appendLink(collection, "TextQuery");
     69        Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, "");
     70        info_message.appendChild(query_request);
     71       
     72    }
     73   
     74    Element info_resp_message = (Element) this.mr.process(info_message);
     75    Element info_response = (Element) GSXML.getChildByTagName(info_resp_message, GSXML.RESPONSE_ELEM);
     76    //  String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.SERVICE_ELEM);
     77    if (do_classifier) {
     78        Element classifier_service_info = (Element)GSXML.getNamedElement(info_response, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "CLassifierBrowse");
     79        if (classifier_service_info != null) {
     80        service_list.replaceChild(this.doc.importNode(classifier_service_info, true), classifier_service);
     81        }
     82    }
     83    if (do_query) {
     84        Element query_service_info = (Element)GSXML.getNamedElement(info_response, GSXML.SERVICE_ELEM, GSXML.NAME_ATT, "TextQuery");
     85        if (query_service_info != null) {
     86        service_list.replaceChild(this.doc.importNode(query_service_info, true), query_service);
     87        }
     88    }
    6289    ///ystem.out.println("the final page before transforming is");
    6390    ///ystem.out.println(this.converter.getPrettyString(page));
Note: See TracChangeset for help on using the changeset viewer.