Changeset 3895
- Timestamp:
- 2003-03-18T15:01:35+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r3868 r3895 52 52 return null; 53 53 } 54 Document style_doc = converter_.getDOM(new File(stylesheet)); 55 56 // part of the data for the page is the cgi-params 57 // if we have this here, do we need to overwrite default values in the 58 // param list down below?? 59 Element cgi_request = (Element)doc_.importNode(request, true); 60 page.appendChild(cgi_request); 54 61 55 62 // extract the params from the cgi-request, and check that we have a coll specified 56 63 Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 57 58 64 HashMap params = GSXML.extractParams(cgi_param_list, false); 59 65 … … 65 71 return null; 66 72 } 67 68 // get the service info from the MR - this will probably need to be cached somehow later on. and add the service node to the page 69 Element mr_info_message = doc_.createElement(GSXML.MESSAGE_ELEM); 70 Element mr_info_request = doc_.createElement(GSXML.REQUEST_ELEM); 71 mr_info_message.appendChild(mr_info_request); 72 mr_info_request.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_DESCRIBE); 73 mr_info_request.setAttribute(GSXML.LANG_ATT, page.getAttribute(GSXML.LANG_ATT)); 74 75 String to = collection; 76 to = GSPath.appendLink(to, service_name); 77 mr_info_request.setAttribute(GSXML.TO_ATT, to); 78 73 74 String lang = request.getAttribute(GSXML.LANG_ATT); 75 String to = GSPath.appendLink(collection, service_name); 76 77 // the second part of the page is the service description 78 // for now get this again from the service. 79 // this will probably need to be cached somehow later on. 80 Element mr_info_message = createDescribeRequest(to, lang, null); 79 81 Element mr_info_response = (Element) mr_.process(mr_info_message); 80 String path = GSXML.RESPONSE_ELEM;81 path = GSPath.appendLink(path, GSXML.SERVICE_ELEM);82 83 String path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.SERVICE_ELEM); 82 84 Element description = (Element)doc_.importNode(GSXML.getNodeByPath(mr_info_response, path), true); 83 85 Element pl = (Element)GSXML.getChildByTagName(description, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 84 86 85 87 if (pl !=null) { 86 System.out.println("adding shortnames");87 88 // add short names to the params in the param list 88 89 cgi_.paramListAddShortNames(pl); … … 116 117 } 117 118 118 // part of the data for the description is the cgi-params 119 // if we have this here, do we need to do the previous step? 120 Element cgi_request = (Element)doc_.importNode(request, true); 121 page.appendChild(cgi_request); 122 119 // append the description to the page 123 120 page.appendChild(description); 124 121 125 122 // just a display request 126 123 if (request_type.equals("d")) { 127 124 // output the page 128 125 // process using the stylesheet 129 Document style_doc = converter_.getDOM(new File(stylesheet));130 126 GSXSLT.absoluteIncludePaths(style_doc, config_); 131 127 return (Element)transformer_.transform(style_doc, page); 132 128 } 133 129 134 130 // do the query 135 131 Element mr_query_message = doc_.createElement(GSXML.MESSAGE_ELEM); … … 145 141 146 142 147 System.out.println("Query request: " + converter_.getString(mr_query_request));143 //System.out.println("Query request: " + converter_.getString(mr_query_request)); 148 144 Element mr_query_response = (Element)mr_.process(mr_query_message); 149 System.out.println("Query response: " + converter_.getString(mr_query_response));145 //System.out.println("Query response: " + converter_.getString(mr_query_response)); 150 146 151 147 Element query_result_metadata_list = (Element) GSXML.getNodeByPath(mr_query_response, "response/metadataList"); … … 154 150 } 155 151 156 Element query_term_info_list = (Element) GSXML.getNodeByPath(mr_query_response, "response/ content/termList");152 Element query_term_info_list = (Element) GSXML.getNodeByPath(mr_query_response, "response/termList"); 157 153 if (query_term_info_list == null) { 158 154 System.err.println("Warning: No query term information.\n"); … … 165 161 166 162 // check that there are some documents - for now check the list, but later should use a numdocs metadata elem 167 path = GSXML.RESPONSE_ELEM; 168 //path = GSPath.appendLink(path, GSXML.CONTENT_ELEM); 169 path = GSPath.appendLink(path, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 163 path = GSPath.appendLink(GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM+GSXML.LIST_MODIFIER); 170 164 171 165 Element document_list = (Element)GSXML.getNodeByPath(mr_query_response, 172 path); // documentList not present if no docs found 166 path); 167 // documentList not present if no docs found 173 168 if (document_list == null) { 174 169 … … 177 172 page.appendChild(doc_.importNode(result_response, true)); 178 173 179 Document style_doc = converter_.getDOM(new File(stylesheet));180 174 GSXSLT.absoluteIncludePaths(style_doc, config_); 181 175 return (Element)transformer_.transform(style_doc, page); … … 202 196 dm_param.setAttribute(GSXML.VALUE_ATT, "Title"); 203 197 204 //Element meta_content = doc_.createElement(GSXML.CONTENT_ELEM);205 //mr_metadata_request.appendChild(meta_content);206 207 // the first part of the content is the doc list208 //meta_content.appendChild(doc_.importNode(document_list, true));209 198 mr_metadata_request.appendChild(doc_.importNode(document_list, true)); 210 199 // System.out.println("Metadata request: " + converter_.getString(mr_metadata_message)); … … 219 208 // If there is some metadata about the query results, add it in 220 209 if (query_term_info_list != null) { 221 //Element result_content = (Element) GSXML.getChildByTagName(result_response, GSXML.CONTENT_ELEM);222 //result_content.appendChild(query_term_info_list);223 210 result_response.appendChild(query_term_info_list); 224 211 } … … 226 213 page.appendChild(doc_.importNode(result_response, true)); 227 214 228 System.out.println(" XMLTransformer input:" + converter_.getString(page));215 System.out.println("Query XMLTransformer input:\n " + converter_.getString(page)); 229 216 230 217 // output the page 231 218 // process using the stylesheet 232 Document style_doc = converter_.getDOM(new File(stylesheet));233 219 GSXSLT.absoluteIncludePaths(style_doc, config_); 234 // Node temp = transformer_.transform(style_doc, page);235 // System.out.println("XMLTransformer output: " + converter_.getString(temp));236 // return (Element) temp;237 220 return (Element)transformer_.transform(style_doc, page); 238 221 239 222 } 240 241 242 223 }
Note:
See TracChangeset
for help on using the changeset viewer.