Changeset 3999


Ignore:
Timestamp:
2003-03-26T12:13:45+12:00 (21 years ago)
Author:
kjdon
Message:

code tidy

File:
1 edited

Legend:

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

    r3987 r3999  
    7575    String to = GSPath.appendLink(collection, service_name);
    7676
     77    //create teh pageREsponse
     78    Element page_response = doc_.createElement(GSXML.PAGE_RESPONSE_ELEM);
     79    page.appendChild(page_response);
     80   
    7781    // the second part of the page is the service description
    7882    // for now get this again from the service.
     
    8690    mr_info_message.appendChild(format_request);
    8791
     92    // also get the coll description
     93    Element coll_about_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_DESCRIBE,  collection, lang);
     94    mr_info_message.appendChild(coll_about_request);
     95
     96    // process the messages
    8897    Element mr_info_response = (Element) mr_.process(mr_info_message);
    8998   
    90     String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.SERVICE_ELEM);
    91     Element description = (Element)doc_.importNode(GSXML.getNodeByPath(mr_info_response, path), true);
    92     Element pl = (Element)GSXML.getChildByTagName(description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
     99    // the three responses
     100    NodeList responses = mr_info_response.getElementsByTagName(GSXML.RESPONSE_ELEM);
     101    Element service_response = (Element)responses.item(0);
     102    Element format_response = (Element)responses.item(1);
     103    Element coll_response = (Element)responses.item(2);
     104   
     105    Element service_description = (Element)doc_.importNode(GSXML.getChildByTagName(service_response, GSXML.SERVICE_ELEM), true);
     106    page_response.appendChild(service_description);
     107   
     108    Element pl = (Element)GSXML.getChildByTagName(service_description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER);
    93109   
    94110    if (pl !=null) {
     
    124140    }
    125141
    126     // get the collection or cluster description
    127     Element coll_about_message = doc_.createElement(GSXML.MESSAGE_ELEM);
    128     Element coll_about_request = GSXML.createBasicRequest(doc_, GSXML.REQUEST_TYPE_DESCRIBE,  collection, page.getAttribute(GSXML.LANG_ATT));
    129     coll_about_message.appendChild(coll_about_request);
    130     Element coll_about_response = (Element)mr_.process(coll_about_message);
    131 
    132     // add the response to the page
    133     Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM);
    134     Element page_response = GSXML.duplicateWithNewName(doc_, response, "pageResponse", false);
    135     page_response.appendChild(description);
    136 
    137     Element format_response = (Element)mr_info_response.getElementsByTagName(GSXML.RESPONSE_ELEM).item(1); // the second response
     142   
     143    // add the coll-response to the page
     144    Element coll_description = (Element)GSXML.getChildByTagName(coll_response, GSXML.COLLECTION_ELEM);
     145    page_response.appendChild(doc_.importNode(coll_description, true));
     146
    138147
    139148    // just a display request
    140149    if (request_type.equals("d")) {
    141         page.appendChild(page_response);
    142150        System.out.println("(QueryAction) Finished page:\n" + converter_.getPrettyString(page));
    143151        // output the page
     
    157165        Element mr_query_response = (Element)mr_.process(mr_query_message);
    158166
    159     path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
     167    String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.METADATA_ELEM+GSXML.LIST_MODIFIER);
    160168    Element query_result_metadata_list = (Element) GSXML.getNodeByPath(mr_query_response, path);
    161169    if (query_result_metadata_list == null) {
     
    180188    if (document_list == null) {
    181189       
    182         Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
    183 
    184         page.appendChild(doc_.importNode(result_response, true));
     190        //Element result_response = (Element)GSXML.getChildByTagName(mr_query_response, GSXML.RESPONSE_ELEM);
     191
     192        //page.appendChild(doc_.importNode(result_response, true));
    185193        GSXSLT.absoluteIncludePaths(style_doc, config_);
    186194        return (Element)transformer_.transform(style_doc, page);   
     
    231239    }
    232240
    233     // Add the pageResponse element to the page
    234     page.appendChild(page_response);
    235241    // System.out.println("Query page:\n" + converter_.getPrettyString(page));
    236242
Note: See TracChangeset for help on using the changeset viewer.