Changeset 25816
- Timestamp:
- 2012-06-26T15:29:29+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r25642 r25816 74 74 provide_annotations = true; 75 75 } 76 return true; 77 } 76 return true; } 78 77 79 78 public Node process(Node message_node) … … 120 119 } 121 120 String document_type = (String) params.get(GSParams.DOCUMENT_TYPE); 122 if (document_type == null || document_type.equals("")) 123 { 124 document_type = "hierarchy"; 121 if (document_type != null && document_type.equals("")) 122 { 123 //document_type = "hierarchy"; 124 document_type = null; // we'll get it later if not already specified 125 125 } 126 126 //whether to retrieve siblings or not … … 175 175 Element the_document = this.doc.createElement(GSXML.DOCUMENT_ELEM); 176 176 page_response.appendChild(the_document); 177 178 // set the doctype from the cgi arg as an attribute179 the_document.setAttribute(GSXML.DOC_TYPE_ATT, document_type);180 177 181 178 // create a basic doc list containing the current node … … 193 190 current_doc.setAttribute(GSXML.ID_MOD_ATT, doc_id_modifier); 194 191 } 192 193 if (document_type == null) { 194 logger.error("getting document type"); 195 document_type = getDocumentType(basic_doc_list, collection, userContext, page_response); 196 logger.error("new doc type = "+document_type); 197 } 198 if (document_type != null) { 199 // set the doctype from the cgi arg or from the server as an attribute 200 the_document.setAttribute(GSXML.DOC_TYPE_ATT, document_type); 201 } 202 else { 203 logger.error("doctype is null!!!***********"); 204 } 195 205 196 206 // Create a parameter list to specify the required structure information … … 286 296 ds_request.appendChild(ds_param_list); 287 297 288 // create a doc_node_list and put in the doc_node that we are interested in298 // add the node list we created earlier 289 299 ds_request.appendChild(basic_doc_list); 290 300 … … 679 689 // a new message for the mr 680 690 Element enrich_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 681 682 691 NodeList e_services = services_resp.getElementsByTagName(GSXML.SERVICE_ELEM); 683 692 boolean service_found = false; … … 710 719 711 720 } 721 722 protected String getDocumentType(Element basic_doc_list, String collection, UserContext userContext, Element page_response) 723 { 724 725 Element ds_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 726 String to = GSPath.appendLink(collection, "DocumentStructureRetrieve");// Hard-wired? 727 Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 728 ds_message.appendChild(ds_request); 729 730 // Create a parameter list to specify the required structure information 731 Element ds_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 732 Element ds_param = this.doc.createElement(GSXML.PARAM_ELEM); 733 ds_param_list.appendChild(ds_param); 734 ds_param.setAttribute(GSXML.NAME_ATT, "info"); 735 ds_param.setAttribute(GSXML.VALUE_ATT, "documentType"); 736 737 ds_request.appendChild(ds_param_list); 738 739 // add the node list we created earlier 740 ds_request.appendChild(basic_doc_list); 741 742 logger.error("doctype request = "+this.converter.getPrettyString(ds_request)); 743 // Process the document structure retrieve message 744 Element ds_response_message = (Element) this.mr.process(ds_message); 745 logger.error("doctype response = "+this.converter.getPrettyString(ds_response_message)); 746 if (processErrorElements(ds_response_message, page_response)) 747 { 748 return null; 749 } 750 751 String[] links = { GSXML.RESPONSE_ELEM, GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER, GSXML.DOC_NODE_ELEM, "nodeStructureInfo"}; 752 String path = GSPath.createPath(links); 753 Element info_elem = (Element) GSXML.getNodeByPath(ds_response_message, path); 754 Element doctype_elem = GSXML.getNamedElement(info_elem, "info", "name", "documentType"); 755 if (doctype_elem != null) { 756 String doc_type = doctype_elem.getAttribute("value"); 757 return doc_type; 758 } 759 return null; 760 } 712 761 713 762 /**
Note:
See TracChangeset
for help on using the changeset viewer.