Changeset 8833 for trunk/gsdl3/src/java/org/greenstone/gsdl3/action
- Timestamp:
- 2004-12-16T15:36:53+13:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r8731 r8833 48 48 /** if this is set to true, when a document is displayed, any annotation 49 49 * type services (enrich) will be offered to the user as well */ 50 protected static final boolean provide_annotations = false; //true; 51 52 50 protected boolean provide_annotations = false; 51 52 protected boolean highlight_query_terms = false; 53 54 public boolean configure() { 55 super.configure(); 56 String highlight = (String)config_params.get("highlightQueryTerms"); 57 if (highlight != null && highlight.equals("true")) { 58 highlight_query_terms = true; 59 } 60 String annotate = (String)config_params.get("displayAnnotationService"); 61 if (annotate != null && annotate.equals("true")) { 62 provide_annotations = true; 63 } 64 return true; 65 } 53 66 public Element process (Element message) 54 67 { … … 326 339 dc_request.appendChild(dc_param_list); 327 340 341 // get the content 328 342 // the doc list for the content request is the same as the one for the structure request unless we want the whole document, in which case its the same as for the metadata request. 329 343 if (expand_document) { … … 332 346 dc_request.appendChild(basic_doc_list); 333 347 } 348 System.err.println("request = "+converter.getString(dc_message)); 334 349 Element dc_response_message = (Element) this.mr.process(dc_message); 335 350 Element dc_response_doc_list = (Element) GSXML.getNodeByPath(dc_response_message, path); … … 339 354 NodeList dc_response_docs = dc_response_doc_list.getChildNodes(); 340 355 for (int i = 0; i < doc_nodes.getLength(); i++) { 341 doc_nodes.item(i).appendChild(this.doc.importNode(GSXML.getChildByTagName((Element)dc_response_docs.item(i), "nodeContent"), true)); 356 Node content = GSXML.getChildByTagName((Element)dc_response_docs.item(i), "nodeContent"); 357 if (content != null) { 358 doc_nodes.item(i).appendChild(this.doc.importNode(content, true)); 359 } 342 360 //GSXML.mergeMetadataLists(doc_nodes.item(i), dm_response_docs.item(i)); 343 361 } … … 347 365 Element dc_response_doc = (Element) GSXML.getChildByTagName(dc_response_doc_list, GSXML.DOC_NODE_ELEM); 348 366 Element dc_response_doc_content = (Element) GSXML.getChildByTagName(dc_response_doc, GSXML.NODE_CONTENT_ELEM); 349 350 351 boolean highlight_query_terms = true; 367 368 if (dc_response_doc_content == null) { 369 // no content to add 370 return result; 371 } 352 372 if (highlight_query_terms) { 353 373 dc_response_doc.removeChild(dc_response_doc_content); 354 374 355 375 dc_response_doc_content = highlightQueryTerms(request, dc_response_doc_content); 356 376 dc_response_doc.appendChild(dc_response_doc.getOwnerDocument().importNode(dc_response_doc_content, true)); … … 385 405 386 406 } 387 } 407 } // if provide_annotations 388 408 389 409
Note:
See TracChangeset
for help on using the changeset viewer.