Changeset 14525
- Timestamp:
- 2007-09-17T15:27:38+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
greenstone3/trunk/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r13270 r14525 83 83 // just in case there are some that need to get passed to the services 84 84 HashMap service_params = (HashMap)params.get("s0"); 85 85 86 String has_rl = null; 87 String has_href = null; 88 has_href = (String) params.get("href");//for an external link : get the href URL if it is existing in the params list 89 has_rl = (String) params.get("rl");//for an external link : get the rl value if it is existing in the params list 86 90 String collection = (String) params.get(GSParams.COLLECTION); 87 91 String lang = request.getAttribute(GSXML.LANG_ATT); 88 92 String uid = request.getAttribute(GSXML.USER_ID_ATT); 89 93 String document_name = (String) params.get(GSParams.DOCUMENT); 90 if ( document_name == null || document_name.equals("")) {94 if ((document_name == null || document_name.equals("")) && (has_href == null || has_href.equals(""))) { 91 95 logger.error("no document specified!"); 92 96 return result; … … 141 145 Element current_doc = this.doc.createElement(GSXML.DOC_NODE_ELEM); 142 146 basic_doc_list.appendChild(current_doc); 143 current_doc.setAttribute(GSXML.NODE_ID_ATT, document_name); 144 147 if (document_name.length()!=0){ 148 current_doc.setAttribute(GSXML.NODE_ID_ATT, document_name); 149 }else if (has_href.length()!=0){ 150 current_doc.setAttribute(GSXML.NODE_ID_ATT, has_href); 151 current_doc.setAttribute("externalURL", has_rl); 152 } 153 145 154 // Create a parameter list to specify the required structure information 146 155 Element ds_param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); … … 239 248 // no structure nodes, so put in a dummy doc node 240 249 Element doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 241 doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name); 250 if (document_name.length()!=0){ 251 doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name); 252 }else if (has_href.length()!=0){ 253 doc_node.setAttribute(GSXML.NODE_ID_ATT, has_href); 254 doc_node.setAttribute("externalURL", has_rl); 255 } 242 256 the_document.appendChild(doc_node); 243 257 has_dummy = true; … … 247 261 // no structure request, so just put in a dummy doc node 248 262 Element doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 249 doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name); 263 if (document_name.length()!=0){ 264 doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name); 265 }else if (has_href.length()!=0){ 266 doc_node.setAttribute(GSXML.NODE_ID_ATT, has_href); 267 doc_node.setAttribute("externalURL", has_rl); 268 } 250 269 the_document.appendChild(doc_node); 251 270 has_dummy = true; … … 312 331 Element doc_node = this.doc.createElement(GSXML.DOC_NODE_ELEM); 313 332 // the node we want is the root document node 314 doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name+".rt"); 333 if (document_name.length()!=0){ 334 doc_node.setAttribute(GSXML.NODE_ID_ATT, document_name+".rt"); 335 }else if (has_href.length()!=0){ 336 doc_node.setAttribute(GSXML.NODE_ID_ATT, has_href+".rt"); 337 doc_node.setAttribute("externalURL", has_rl); 338 } 315 339 doc_list.appendChild(doc_node); 316 340 Element dm_response_message = (Element) this.mr.process(dm_message); … … 374 398 } 375 399 } else { 376 377 400 //path = GSPath.appendLink(path, GSXML.DOC_NODE_ELEM); 378 401 Element dc_response_doc = (Element) GSXML.getChildByTagName(dc_response_doc_list, GSXML.DOC_NODE_ELEM); 379 402 Element dc_response_doc_content = (Element) GSXML.getChildByTagName(dc_response_doc, GSXML.NODE_CONTENT_ELEM); 403 Element dc_response_doc_external = (Element) GSXML.getChildByTagName(dc_response_doc, "external"); 380 404 381 405 if (dc_response_doc_content == null) { 382 406 // no content to add 407 if (dc_response_doc_external !=null){ 408 String modified_doc_id = dc_response_doc.getAttribute(GSXML.NODE_ID_ATT); 409 410 the_document.setAttribute("selectedNode", modified_doc_id); 411 the_document.setAttribute("external", dc_response_doc_external.getAttribute("external_link")); 412 } 383 413 return result; 384 414 }
Note:
See TracChangeset
for help on using the changeset viewer.