Changeset 24993
- Timestamp:
- 2012-01-26T11:50:17+13:00 (12 years ago)
- Location:
- main/trunk/greenstone3/src/java/org/greenstone/gsdl3
- Files:
-
- 1 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/Library2.java
r24982 r24993 132 132 133 133 Element xml_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 134 Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", "", "");134 Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", new UserContext()); 135 135 xml_message.appendChild(xml_request); 136 136 Element xml_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r24969 r24993 544 544 } 545 545 } 546 UserContext userContext = new UserContext(); 547 userContext.setLanguage(lang); 548 userContext.setUserID(uid); 546 549 547 550 // set the lang in the session … … 582 585 // the request to the receptionist 583 586 Element xml_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 584 Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", lang, uid);587 Element xml_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PAGE, "", userContext); 585 588 xml_request.setAttribute(GSXML.OUTPUT_ATT, output); 586 589 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/Action.java
r24889 r24993 232 232 * the current user id 233 233 */ 234 protected void addSiteMetadata(Element element, String lang, String uid)234 protected void addSiteMetadata(Element element, UserContext userContext) 235 235 { 236 236 //ADD SITE METADATA 237 Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid);237 Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 238 238 //create a hashmap of params 239 239 HashMap subset_params = new HashMap(1); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/AppletAction.java
r24986 r24993 45 45 boolean coll_specified = true; 46 46 String service_name = (String) params.get(GSParams.SERVICE); 47 String lang = request.getAttribute(GSXML.LANG_ATT); 48 String uid = request.getAttribute(GSXML.USER_ID_ATT); 47 UserContext userContext = new UserContext(request); 49 48 String to = null; 50 49 if (collection == null || collection.equals("")) … … 63 62 64 63 Element mr_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 65 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);64 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 66 65 mr_message.appendChild(mr_request); 67 66 // just append all the params for now - should filter out unneeded ones … … 81 80 82 81 Element mr_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 83 Element applet_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);82 Element applet_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 84 83 mr_message.appendChild(applet_request); 85 84 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/BrowseAction.java
r24889 r24993 64 64 } 65 65 66 String lang = request.getAttribute(GSXML.LANG_ATT); 67 String uid = request.getAttribute(GSXML.USER_ID_ATT); 66 UserContext userContext = new UserContext(request); 68 67 String to = GSPath.appendLink(collection, service_name); 69 68 … … 73 72 74 73 Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 75 Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);74 Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 76 75 info_message.appendChild(info_request); 77 76 78 77 // also get the format stuff now if there is some 79 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid);78 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 80 79 info_message.appendChild(format_request); 81 80 // process the requests … … 92 91 93 92 //append site metadata 94 addSiteMetadata(page_response, lang, uid);93 addSiteMetadata(page_response, userContext); 95 94 96 95 // if rt=d, then we are just displaying the service … … 135 134 // get the browse structure for the selected node 136 135 Element classify_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 137 Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);136 Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 138 137 classify_message.appendChild(classify_request); 139 138 … … 200 199 if (cl_nodes.getLength() > 0) { 201 200 did_classifier = true; 202 Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to+"MetadataRetrieve", lang, uid);201 Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to+"MetadataRetrieve", userContext); 203 202 metadata_message.appendChild(cl_meta_request); 204 203 … … 237 236 if (doc_nodes.getLength() > 0) { 238 237 did_documents = true; 239 Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), lang, uid);238 Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), userContext); 240 239 metadata_message.appendChild(doc_meta_request); 241 240 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/DocumentAction.java
r24889 r24993 97 97 has_rl = (String) params.get("rl");//for an external link : get the rl value if it is existing in the params list 98 98 String collection = (String) params.get(GSParams.COLLECTION); 99 String lang = request.getAttribute(GSXML.LANG_ATT); 100 String uid = request.getAttribute(GSXML.USER_ID_ATT); 99 UserContext userContext = new UserContext(request); 101 100 String document_name = (String) params.get(GSParams.DOCUMENT); 102 101 if ((document_name == null || document_name.equals("")) && (has_href == null || has_href.equals(""))) … … 147 146 148 147 //append site metadata 149 addSiteMetadata(page_response, lang, uid);148 addSiteMetadata(page_response, userContext); 150 149 151 150 // get the additional data needed for the page 152 getBackgroundData(page_response, collection, lang, uid);151 getBackgroundData(page_response, collection, userContext); 153 152 Element format_elem = (Element) GSXML.getChildByTagName(page_response, GSXML.FORMAT_ELEM); 154 153 … … 263 262 Element ds_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 264 263 String to = GSPath.appendLink(collection, "DocumentStructureRetrieve");// Hard-wired? 265 Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);264 Element ds_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 266 265 ds_message.appendChild(ds_request); 267 266 ds_request.appendChild(ds_param_list); … … 339 338 Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 340 339 String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); // Hard-wired? 341 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);340 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 342 341 dm_message.appendChild(dm_request); 343 342 // Create a parameter list to specify the required metadata information … … 378 377 // we also want a metadata request to the top level document to get 379 378 // assocfilepath - this could be cached too 380 Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);379 Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 381 380 dm_message.appendChild(doc_meta_request); 382 381 Element doc_meta_param_list = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); … … 432 431 Element dc_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 433 432 to = GSPath.appendLink(collection, "DocumentContentRetrieve"); // Hard-wired? 434 Element dc_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);433 Element dc_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 435 434 dc_message.appendChild(dc_request); 436 435 … … 517 516 // send a message to the service 518 517 Element enrich_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 519 Element enrich_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, enrich_service, lang, uid);518 Element enrich_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, enrich_service, userContext); 520 519 enrich_message.appendChild(enrich_request); 521 520 // check for parameters … … 610 609 * whatever the query is - should be cached 611 610 */ 612 protected boolean getBackgroundData(Element page_response, String collection, String lang, String uid)611 protected boolean getBackgroundData(Element page_response, String collection, UserContext userContext) 613 612 { 614 613 … … 619 618 String path = GSPath.appendLink(collection, "DocumentContentRetrieve"); 620 619 // the format request - ignore for now, where does this request go to?? 621 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, path, lang, uid);620 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, path, userContext); 622 621 info_message.appendChild(format_request); 623 622 … … 626 625 if (provide_annotations) 627 626 { 628 Element enrich_services_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid);627 Element enrich_services_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 629 628 enrich_services_request.setAttribute(GSXML.INFO_ATT, "serviceList"); 630 629 info_message.appendChild(enrich_services_request); … … 659 658 if (((Element) e_services.item(j)).getAttribute(GSXML.TYPE_ATT).equals("enrich")) 660 659 { 661 Element s = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, ((Element) e_services.item(j)).getAttribute(GSXML.NAME_ATT), lang, uid);660 Element s = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, ((Element) e_services.item(j)).getAttribute(GSXML.NAME_ATT), userContext); 662 661 enrich_message.appendChild(s); 663 662 service_found = true; … … 711 710 } 712 711 String collection = (String) params.get(GSParams.COLLECTION); 713 String lang = request.getAttribute(GSXML.LANG_ATT); 714 String uid = request.getAttribute(GSXML.USER_ID_ATT); 712 UserContext userContext = new UserContext(request); 715 713 String to = GSPath.appendLink(collection, service_name); 716 714 717 715 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 718 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);716 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 719 717 mr_query_message.appendChild(mr_query_request); 720 718 … … 899 897 { 900 898 //We don't want to find words inside HTML tags 901 if (content_characters[i] == '<')899 if (content_characters[i] == '<') 902 900 { 903 901 inTag = true; … … 912 910 continue; 913 911 } 914 912 915 913 boolean is_character_letter_or_digit = Character.isLetterOrDigit(content_characters[i]); 916 914 917 915 // Has a word just started? 918 916 if (in_word == false && is_character_letter_or_digit == true) -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/FormatAction.java
r24247 r24993 12 12 // other java stuff 13 13 import java.io.File; 14 import java.util.HashMap;15 14 import java.util.*; 16 15 import java.io.StringReader; … … 46 45 47 46 String subaction = request.getAttribute(GSXML.SUBACTION_ATT); 48 String lang = request.getAttribute(GSXML.LANG_ATT); 49 String uid = request.getAttribute(GSXML.USER_ID_ATT); 47 UserContext userContext = new UserContext(request); 50 48 // get the param list 51 49 Element cgi_param_list = (Element)GSXML.getChildByTagName(request, GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); … … 64 62 65 63 Element mr_request_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 66 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT_STRING, to, lang, uid);64 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT_STRING, to, userContext); 67 65 68 66 mr_request.setAttribute("service", service); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java
r24990 r24993 58 58 } 59 59 60 String lang = request.getAttribute(GSXML.LANG_ATT); 61 String uid = request.getAttribute(GSXML.USER_ID_ATT); 60 UserContext userContext = new UserContext(request); 62 61 String to = GSPath.appendLink(collection, service_name); 63 62 … … 67 66 68 67 Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 69 Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);68 Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 70 69 info_message.appendChild(info_request); 71 70 72 71 // also get the format stuff now if there is some 73 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid);72 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 74 73 info_message.appendChild(format_request); 75 74 // process the requests … … 86 85 87 86 //append site metadata 88 addSiteMetadata(page_response, lang, uid);87 addSiteMetadata(page_response, userContext); 89 88 90 89 // if rt=d, then we are just displaying the service … … 154 153 // get the browse structure for the selected node 155 154 Element classify_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 156 Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);155 Element classify_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 157 156 classify_message.appendChild(classify_request); 158 157 … … 252 251 { 253 252 did_classifier = true; 254 Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to + "MetadataRetrieve", lang, uid);253 Element cl_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to + "MetadataRetrieve", userContext); 255 254 metadata_message.appendChild(cl_meta_request); 256 255 … … 281 280 { 282 281 did_documents = true; 283 Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), lang, uid);282 Element doc_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(collection, "DocumentMetadataRetrieve"), userContext); 284 283 metadata_message.appendChild(doc_meta_request); 285 284 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GeneralAction.java
r24866 r24993 26 26 logger.debug(" request=" + this.converter.getString(request)); 27 27 28 String lang = request.getAttribute(GSXML.LANG_ATT); 29 String uid = request.getAttribute(GSXML.USER_ID_ATT); 28 UserContext userContext = new UserContext(request); 30 29 31 30 // get the param list … … 66 65 67 66 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 68 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);67 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 69 68 70 69 if(request_type.equals("s")) … … 91 90 { 92 91 // just send the reponse as is 93 addSiteMetadata(result_response, lang, uid);92 addSiteMetadata(result_response, userContext); 94 93 return result_response; 95 94 } … … 105 104 // request the service info for the selected service - should be cached 106 105 Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 107 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);106 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 108 107 mr_info_message.appendChild(mr_info_request); 109 108 Element mr_info_response = (Element) this.mr.process(mr_info_message); … … 118 117 } 119 118 120 addSiteMetadata(page_response, lang, uid);119 addSiteMetadata(page_response, userContext); 121 120 122 121 return result; -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/NoCollQueryAction.java
r24988 r24993 65 65 66 66 String request_type = (String) params.get(GSParams.REQUEST_TYPE); 67 String lang = request.getAttribute(GSXML.LANG_ATT); 68 String uid = request.getAttribute(GSXML.USER_ID_ATT); 67 UserContext userContext = new UserContext(request); 69 68 if (request_type.equals("d")) 70 69 { … … 72 71 // the only info we need to return is the collection list cos the xslt does teh rest 73 72 74 Element coll_list = getCollectionList( lang, uid);73 Element coll_list = getCollectionList(userContext); 75 74 page_response.appendChild(this.doc.importNode(coll_list, true)); 76 75 return page_response; … … 89 88 { 90 89 logger.error("no collections were specified!"); 91 Element coll_list = getCollectionList( lang, uid);90 Element coll_list = getCollectionList(userContext); 92 91 page_response.appendChild(this.doc.importNode(coll_list, true)); 93 92 return page_response; … … 111 110 { 112 111 String to = GSPath.appendLink(colls[i], service_name); 113 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);112 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 114 113 mr_query_message.appendChild(mr_query_request); 115 114 mr_query_request.appendChild(query_param_list.cloneNode(true)); … … 130 129 String coll_name = extractCollName(((Element) responses.item(j)).getAttribute(GSXML.FROM_ATT)); 131 130 String path = GSPath.appendLink(coll_name, "DocumentMetadataRetrieve"); 132 Element mr_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, path, lang, uid);131 Element mr_meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, path, userContext); 133 132 mr_meta_message.appendChild(mr_meta_request); 134 133 mr_meta_request.appendChild(this.doc.importNode(document_list, true)); … … 182 181 } 183 182 184 protected Element getCollectionList( String lang, String uid)183 protected Element getCollectionList(UserContext userContext) 185 184 { 186 185 187 186 // first, get the message router info 188 187 Element coll_list_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 189 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid);188 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 190 189 coll_list_message.appendChild(coll_list_request); 191 190 Element coll_list_response = (Element) this.mr.process(coll_list_message); … … 209 208 String name = c.getAttribute(GSXML.NAME_ATT); 210 209 211 Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, lang, uid);210 Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, userContext); 212 211 metadata_request.appendChild(coll_param_list.cloneNode(true)); 213 212 metadata_message.appendChild(metadata_request); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java
r24989 r24993 69 69 { 70 70 71 String lang = request.getAttribute(GSXML.LANG_ATT); 72 String uid = request.getAttribute(GSXML.USER_ID_ATT); 71 UserContext userContext = new UserContext(request); 73 72 // first, get the message router info 74 73 Element info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 75 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, uid);74 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); 76 75 info_message.appendChild(coll_list_request); 77 76 Element info_response_message = (Element) this.mr.process(info_message); … … 97 96 if (colls.getLength() > 0) 98 97 { 99 sendMultipleRequests(colls, null, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid);98 sendMultipleRequests(colls, null, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 100 99 } 101 100 } … … 108 107 if (services.getLength() > 0) 109 108 { 110 sendMultipleRequests(services, null, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid);109 sendMultipleRequests(services, null, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 111 110 } 112 111 } … … 119 118 if (clusters.getLength() > 0) 120 119 { 121 sendMultipleRequests(clusters, null, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid);120 sendMultipleRequests(clusters, null, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 122 121 123 122 } … … 132 131 { 133 132 134 String lang = request.getAttribute(GSXML.LANG_ATT); 135 String uid = request.getAttribute(GSXML.USER_ID_ATT); 133 UserContext userContext = new UserContext(request); 136 134 // extract the params from the cgi-request, 137 135 Element cgi_paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); … … 144 142 // return an empty response 145 143 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 146 addSiteMetadata(response, lang, uid);144 addSiteMetadata(response, userContext); 147 145 return response; 148 146 } … … 151 149 Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 152 150 153 Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, lang, uid);151 Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext); 154 152 coll_about_message.appendChild(coll_about_request); 155 153 Element coll_about_response = (Element) this.mr.process(coll_about_message); … … 196 194 if (services.getLength() > 0) 197 195 { 198 sendMultipleRequests(services, coll_name, GSXML.REQUEST_TYPE_DESCRIBE, lang, uid);196 sendMultipleRequests(services, coll_name, GSXML.REQUEST_TYPE_DESCRIBE, userContext); 199 197 } 200 198 201 199 Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM); 202 200 //add the site metadata 203 addSiteMetadata(response, lang, uid);201 addSiteMetadata(response, userContext); 204 202 return response; 205 203 } … … 213 211 protected Element unknownPage(Element request) 214 212 { 215 216 String lang = request.getAttribute(GSXML.LANG_ATT); 217 String uid = request.getAttribute(GSXML.USER_ID_ATT); 213 UserContext userContext = new UserContext(request); 218 214 String page_name = request.getAttribute(GSXML.SUBACTION_ATT); 219 215 … … 227 223 // just return an empty response 228 224 Element response = this.doc.createElement(GSXML.RESPONSE_ELEM); 229 addSiteMetadata(response, lang, uid);225 addSiteMetadata(response, userContext); 230 226 return response; 231 227 } … … 237 233 Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 238 234 239 Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, lang, uid);235 Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext); 240 236 coll_about_message.appendChild(coll_about_request); 241 237 … … 245 241 246 242 //add the site metadata 247 addSiteMetadata(response, lang, uid);243 addSiteMetadata(response, userContext); 248 244 249 245 return response; … … 251 247 } 252 248 253 protected boolean sendMultipleRequests(NodeList items, String path_prefix, String request_type, String lang, String uid)249 protected boolean sendMultipleRequests(NodeList items, String path_prefix, String request_type, UserContext userContext) 254 250 { 255 251 … … 264 260 path = GSPath.appendLink(path_prefix, path); 265 261 } 266 Element request = GSXML.createBasicRequest(this.doc, request_type, path, lang, uid);262 Element request = GSXML.createBasicRequest(this.doc, request_type, path, userContext); 267 263 message.appendChild(request); 268 264 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/ProcessAction.java
r24991 r24993 43 43 } 44 44 String request_type = (String) params.get(GSParams.REQUEST_TYPE); 45 String lang = request.getAttribute(GSXML.LANG_ATT); 46 String uid = request.getAttribute(GSXML.USER_ID_ATT); 45 UserContext userContext = new UserContext(request); 47 46 // what is carried out depends on the request_type 48 47 // if rt=d, then a describe request is done, … … 94 93 95 94 } 96 Element mr_query_request = GSXML.createBasicRequest(this.doc, request_type_att, to, lang, uid);95 Element mr_query_request = GSXML.createBasicRequest(this.doc, request_type_att, to, userContext); 97 96 if (param_list != null) 98 97 { … … 119 118 // request the service info for the selected service - should be cached 120 119 Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 121 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);120 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 122 121 mr_info_message.appendChild(mr_info_request); 123 122 Element mr_info_response = (Element) this.mr.process(mr_info_message); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/QueryAction.java
r24987 r24993 68 68 } 69 69 70 String lang = request.getAttribute(GSXML.LANG_ATT); 71 String uid = request.getAttribute(GSXML.USER_ID_ATT); 70 UserContext userContext = new UserContext(request); 72 71 String to = service_name; 73 72 if (collection != null) … … 80 79 // we have been asked for the service description 81 80 Element mr_info_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 82 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, lang, uid);81 Element mr_info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, to, userContext); 83 82 mr_info_message.appendChild(mr_info_request); 84 83 … … 86 85 Element mr_info_response = (Element) this.mr.process(mr_info_message); 87 86 // the response 87 88 88 Element service_response = (Element) GSXML.getChildByTagName(mr_info_response, GSXML.RESPONSE_ELEM); 89 89 … … 96 96 // just a display request, no actual processing to do 97 97 //append site metadata 98 addSiteMetadata(page_response, lang, uid);98 addSiteMetadata(page_response, userContext); 99 99 return page_response; 100 100 } … … 105 105 { // no query 106 106 //append site metadata 107 addSiteMetadata(page_response, lang, uid);107 addSiteMetadata(page_response, userContext); 108 108 return page_response; 109 109 } … … 111 111 // create the query request 112 112 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 113 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);113 Element mr_query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 114 114 mr_query_message.appendChild(mr_query_request); 115 115 … … 119 119 120 120 // also get the format stuff now if there is some 121 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, lang, uid);121 Element format_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_FORMAT, to, userContext); 122 122 mr_query_message.appendChild(format_request); 123 123 … … 131 131 { 132 132 //append site metadata 133 addSiteMetadata(page_response, lang, uid);133 addSiteMetadata(page_response, userContext); 134 134 return page_response; 135 135 } … … 167 167 page_response.appendChild(this.doc.createElement(GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER)); 168 168 //append site metadata 169 addSiteMetadata(page_response, lang, uid);169 addSiteMetadata(page_response, userContext); 170 170 return page_response; 171 171 } … … 179 179 page_response.appendChild(this.doc.importNode(document_list, true)); 180 180 //append site metadata 181 addSiteMetadata(page_response, lang, uid);181 addSiteMetadata(page_response, userContext); 182 182 return page_response; 183 183 } … … 207 207 to = GSPath.prependLink(to, collection); 208 208 } 209 Element mr_metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);209 Element mr_metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 210 210 mr_metadata_message.appendChild(mr_metadata_request); 211 211 … … 235 235 logger.debug("Query page:\n" + this.converter.getPrettyString(page_response)); 236 236 //append site metadata 237 addSiteMetadata(page_response, lang, uid);237 addSiteMetadata(page_response, userContext); 238 238 return page_response; 239 239 } -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/SystemAction.java
r24985 r24993 11 11 // other java stuff 12 12 import java.io.File; 13 import java.util.HashMap;14 13 import java.util.*; 15 14 import java.io.StringReader; … … 46 45 47 46 String subaction = request.getAttribute(GSXML.SUBACTION_ATT); 48 String lang = request.getAttribute(GSXML.LANG_ATT); 49 String uid = request.getAttribute(GSXML.USER_ID_ATT); 47 UserContext userContext = new UserContext(request); 50 48 // get the param list 51 49 Element cgi_param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); … … 63 61 64 62 Element mr_request_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 65 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, to, lang, uid);63 Element mr_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, to, userContext); 66 64 mr_request_message.appendChild(mr_request); 67 65 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/XMLDocumentAction.java
r24992 r24993 52 52 return result; 53 53 } 54 String lang = request.getAttribute(GSXML.LANG_ATT); 55 String uid = request.getAttribute(GSXML.USER_ID_ATT); 54 UserContext userContext = new UserContext(request); 56 55 57 56 // subaction used to decide if we are returning content or structure … … 74 73 Element mr_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 75 74 76 Element ret_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);75 Element ret_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 77 76 mr_message.appendChild(ret_request); 78 77 … … 85 84 // also add in a request for the Title metadata 86 85 to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); 87 Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);86 Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 88 87 // copy the doc list 89 88 meta_request.appendChild(doc_list.cloneNode(true)); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/ServiceCluster.java
r24975 r24993 347 347 // services it provides 348 348 Element message = this.doc.createElement(GSXML.MESSAGE_ELEM); 349 Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", "", "");349 Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", new UserContext()); 350 350 message.appendChild(request); 351 351 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/DefaultReceptionist.java
r24974 r24993 55 55 // see if the collection/cluster element is already there 56 56 String coll_name = coll_param.getAttribute(GSXML.VALUE_ATT); 57 String lang = page_request.getAttribute(GSXML.LANG_ATT); 58 String uid = page_request.getAttribute(GSXML.USER_ID_ATT); 57 UserContext userContext = new UserContext(page_request); 59 58 60 59 if (coll_name.equals("")) … … 84 83 // we dont have one yet - get it 85 84 Element coll_about_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 86 Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, lang, uid);85 Element coll_about_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, coll_name, userContext); 87 86 coll_about_message.appendChild(coll_about_request); 88 87 … … 158 157 String name = c.getAttribute(GSXML.NAME_ATT); 159 158 String address = GSPath.appendLink(coll_name, name); 160 Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, address, lang, uid);159 Element info_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, address, userContext); 161 160 //Element req_param_list = this.doc.createElement(GSXML.PARAM_ELEM+GSXML.LIST_MODIFIER); 162 161 //req_param_list.appendChild(GSXML.createParameter(this.doc, GSXML.SUBSET_PARAM, GSXML.DISPLAY_TEXT_ELEM+GSXML.LIST_MODIFIER)); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/MessageRouter.java
r23938 r24993 454 454 455 455 Element service_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 456 Element service_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", "", "");456 Element service_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", new UserContext()); 457 457 service_message.appendChild(service_request); 458 458 … … 774 774 775 775 Element info_request = this.doc.createElement(GSXML.MESSAGE_ELEM); 776 Element req = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", "", "");776 Element req = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", new UserContext()); 777 777 info_request.appendChild(req); 778 778 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/core/TransformingReceptionist.java
r24884 r24993 763 763 //Transformation of the XML message from the receptionist to HTML with doctype 764 764 765 if (inlineTemplate != null)765 if (inlineTemplate != null) 766 766 { 767 767 try … … 770 770 GSXSLT.mergeStylesheets(skinAndLibraryDoc, inlineTemplateDoc.getDocumentElement()); 771 771 } 772 catch (Exception ex)772 catch (Exception ex) 773 773 { 774 774 ex.printStackTrace(); 775 775 } 776 776 } 777 777 778 778 if (skinAndLibraryDoc.getElementsByTagName("gsf:metadata").getLength() > 0) 779 779 { 780 secondConfigFormatPass(collection, skinAndLibraryDoc, doc, request.getAttribute("lang"), request.getAttribute("uid"));780 secondConfigFormatPass(collection, skinAndLibraryDoc, doc, new UserContext(request)); 781 781 } 782 782 … … 795 795 } 796 796 797 protected void secondConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, String lang, String uid)797 protected void secondConfigFormatPass(String collection, Document skinAndLibraryDoc, Document doc, UserContext userContext) 798 798 { 799 799 String to = GSPath.appendLink(collection, "DocumentMetadataRetrieve"); // Hard-wired? 800 800 Element metaMessage = this.doc.createElement(GSXML.MESSAGE_ELEM); 801 Element metaRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);801 Element metaRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 802 802 Element paramList = this.doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); 803 803 Element docNodeList = this.doc.createElement(GSXML.DOC_NODE_ELEM + GSXML.LIST_MODIFIER); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ArchiveIO.java
r24393 r24993 28 28 import org.greenstone.gsdl3.util.GSXML; 29 29 import org.greenstone.gsdl3.util.SimpleCollectionDatabase; 30 import org.greenstone.gsdl3.util.UserContext; 30 31 31 32 import org.w3c.dom.Element; … … 108 109 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 109 110 110 String lang = request.getAttribute(GSXML.LANG_ATT); 111 String uid = request.getAttribute(GSXML.USER_ID_ATT); 111 UserContext userContext = new UserContext(request); 112 112 113 113 // Get the parameters of the request … … 123 123 String collection = (String) params.get(GSXML.COLLECTION_ATT); 124 124 125 String filePath = _GSDM.archiveGetDocumentFilePath(oid, collection, lang, uid);125 String filePath = _GSDM.archiveGetDocumentFilePath(oid, collection, userContext); 126 126 127 127 Element metadataList = this.doc.createElement(GSXML.METADATA_ELEM + GSXML.LIST_MODIFIER); … … 139 139 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 140 140 141 String lang = request.getAttribute(GSXML.LANG_ATT); 142 String uid = request.getAttribute(GSXML.USER_ID_ATT); 141 UserContext userContext = new UserContext(request); 143 142 144 143 // Get the parameters of the request … … 154 153 String collection = (String) params.get(GSXML.COLLECTION_ATT); 155 154 156 String oid = _GSDM.archiveGetSourceFileOID(srcFile, collection, lang, uid);155 String oid = _GSDM.archiveGetSourceFileOID(srcFile, collection, userContext); 157 156 if(_GSDM.checkError(result, ARCHIVE_GET_SOURCE_FILE_OID)) 158 157 { … … 174 173 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 175 174 176 String lang = request.getAttribute(GSXML.LANG_ATT); 177 String uid = request.getAttribute(GSXML.USER_ID_ATT); 175 UserContext userContext = new UserContext(request); 178 176 179 177 // Get the parameters of the request … … 189 187 String collection = (String) params.get(GSXML.COLLECTION_ATT); 190 188 191 boolean exists = _GSDM.archiveCheckDocumentOrSectionExists(oid, collection, lang, uid);189 boolean exists = _GSDM.archiveCheckDocumentOrSectionExists(oid, collection, userContext); 192 190 if(_GSDM.checkError(result, ARCHIVE_CHECK_DOCUMENT_OR_SECTION_EXISTS)) 193 191 { … … 207 205 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 208 206 209 String lang = request.getAttribute(GSXML.LANG_ATT); 210 String uid = request.getAttribute(GSXML.USER_ID_ATT); 207 UserContext userContext = new UserContext(request); 211 208 212 209 // Get the parameters of the request … … 255 252 } 256 253 257 _GSDM.archiveWriteEntryToDatabase(oid, collection, info, lang, uid);254 _GSDM.archiveWriteEntryToDatabase(oid, collection, info, userContext); 258 255 _GSDM.checkError(result, ARCHIVE_WRITE_ENTRY_TO_DATABASE); 259 256 … … 268 265 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 269 266 270 String lang = request.getAttribute(GSXML.LANG_ATT); 271 String uid = request.getAttribute(GSXML.USER_ID_ATT); 267 UserContext userContext = new UserContext(request); 272 268 273 269 // Get the parameters of the request … … 299 295 } 300 296 301 _GSDM.archiveRemoveEntryFromDatabase(oid, collection, lang, uid);297 _GSDM.archiveRemoveEntryFromDatabase(oid, collection, userContext); 302 298 _GSDM.checkError(result, ARCHIVE_REMOVE_ENTRY_FROM_DATABASE); 303 299 … … 312 308 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 313 309 314 String lang = request.getAttribute(GSXML.LANG_ATT); 315 String uid = request.getAttribute(GSXML.USER_ID_ATT); 310 UserContext userContext = new UserContext(request); 316 311 317 312 // Get the parameters of the request … … 327 322 String collection = (String) params.get(GSXML.COLLECTION_ATT); 328 323 329 ArrayList<String> assocFiles = _GSDM.archiveGetAssociatedImportFiles(oid, collection, lang, uid);324 ArrayList<String> assocFiles = _GSDM.archiveGetAssociatedImportFiles(oid, collection, userContext); 330 325 if(_GSDM.checkError(result, ARCHIVE_GET_ASSOCIATED_IMPORT_FILES)) 331 326 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/ArchiveRetrieve.java
r24221 r24993 25 25 import org.greenstone.gsdl3.util.GSXML; 26 26 import org.greenstone.gsdl3.util.SimpleCollectionDatabase; 27 import org.greenstone.gsdl3.util.UserContext; 27 28 28 29 import org.w3c.dom.Element; … … 106 107 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 107 108 108 String lang = request.getAttribute(GSXML.LANG_ATT); 109 String uid = request.getAttribute(GSXML.USER_ID_ATT); 109 UserContext userContext = new UserContext(request); 110 110 111 111 // Get the parameters of the request … … 120 120 String collection = (String) params.get("c"); 121 121 122 String assocFilePath = getAssocFilePathFromDocID(oid, collection, lang, uid);122 String assocFilePath = getAssocFilePathFromDocID(oid, collection, userContext); 123 123 124 124 String docFilePath = this.site_home + File.separatorChar + … … 143 143 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 144 144 145 String lang = request.getAttribute(GSXML.LANG_ATT); 146 String uid = request.getAttribute(GSXML.USER_ID_ATT); 145 UserContext userContext = new UserContext(request); 147 146 148 147 // Get the parameters of the request … … 159 158 160 159 //Find out what kind of database we have 161 String databaseType = getDatabaseTypeFromCollection(collection, lang, uid);160 String databaseType = getDatabaseTypeFromCollection(collection, userContext); 162 161 if (databaseType == null || databaseType.equals("")) 163 162 { … … 215 214 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 216 215 217 String lang = request.getAttribute(GSXML.LANG_ATT); 218 String uid = request.getAttribute(GSXML.USER_ID_ATT); 216 UserContext userContext = new UserContext(request); 219 217 220 218 // Get the parameters of the request … … 230 228 String collection = (String) params.get("c"); 231 229 232 String databaseType = getDatabaseTypeFromCollection(collection, lang, uid);230 String databaseType = getDatabaseTypeFromCollection(collection, userContext); 233 231 if (databaseType == null || databaseType.equals("")) 234 232 { … … 294 292 } 295 293 296 public String getAssocFilePathFromDocID(String oid, String collection, String lang, String uid)294 public String getAssocFilePathFromDocID(String oid, String collection, UserContext userContext) 297 295 { 298 296 Element mr_query_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 299 Element mr_query_request = GSXML.createBasicRequest (this.doc, GSXML.REQUEST_TYPE_PAGE, collection + "/DocumentMetadataRetrieve", lang, uid);297 Element mr_query_request = GSXML.createBasicRequest (this.doc, GSXML.REQUEST_TYPE_PAGE, collection + "/DocumentMetadataRetrieve", userContext); 300 298 mr_query_message.appendChild(mr_query_request); 301 299 … … 322 320 } 323 321 324 public String getDatabaseTypeFromCollection(String collection, String lang, String uid)322 public String getDatabaseTypeFromCollection(String collection, UserContext userContext) 325 323 { 326 324 //Find out what kind of database we have 327 325 Element dbTypeMessage = this.doc.createElement(GSXML.MESSAGE_ELEM); 328 Element dbTypeRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, collection, lang, uid);326 Element dbTypeRequest = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 329 327 dbTypeMessage.appendChild(dbTypeRequest); 330 328 Element dbTypeResponse = (Element)this.router.process(dbTypeMessage); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/BerryBasket.java
r24977 r24993 33 33 import org.greenstone.gsdl3.util.GSXML; 34 34 import org.greenstone.gsdl3.util.GSPath; 35 import org.greenstone.gsdl3.util.UserContext; 35 36 36 37 import java.net.InetAddress; … … 262 263 ArrayList tmp = new ArrayList(); 263 264 tmp.add(id); 264 Element response = getDocumentMetadata(to, "en", "dumy", tmp.iterator()); 265 266 UserContext userContext = new UserContext(); 267 userContext.setLanguage("en"); 268 userContext.setUserID("dumy"); 269 Element response = getDocumentMetadata(to, userContext, tmp.iterator()); 265 270 Element doc_node = (Element) response.getElementsByTagName(GSXML.DOC_NODE_ELEM).item(0); 266 271 … … 432 437 } 433 438 434 private Element getDocumentMetadata(String to, String lang, String uid, Iterator ids)439 private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids) 435 440 { 436 441 437 442 // Build a request to obtain some document metadata 438 443 Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 439 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);444 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 440 445 dm_message.appendChild(dm_request); 441 446 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/CrossCollectionSearch.java
r24979 r24993 21 21 import org.greenstone.gsdl3.util.GSXML; 22 22 import org.greenstone.gsdl3.util.GSPath; 23 import org.greenstone.gsdl3.util.UserContext; 23 24 24 25 import org.w3c.dom.Element; … … 147 148 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 148 149 149 String lang = request.getAttribute(GSXML.LANG_ATT); 150 UserContext userContext = new UserContext(request); 151 150 152 // Get the parameters of the request 151 153 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); … … 182 184 } 183 185 // send the query to all colls 184 Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to_att.toString(), lang, "");186 Element query_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to_att.toString(), userContext); 185 187 query_message.appendChild(query_request); 186 188 // should we add params individually? … … 257 259 protected boolean initCollectionList() 258 260 { 259 String lang = "en"; 260 String uid = ""; 261 UserContext userContext = new UserContext(); 262 userContext.setLanguage("en"); 263 userContext.setUserID(""); 264 261 265 // first, get the message router info 262 266 Element coll_list_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 263 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", lang, ""); // uid267 Element coll_list_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, "", userContext); // uid 264 268 coll_list_message.appendChild(coll_list_request); 265 269 logger.debug("coll list request = " + this.converter.getPrettyString(coll_list_request)); … … 281 285 Element c = (Element) colls.item(i); 282 286 String name = c.getAttribute(GSXML.NAME_ATT); 283 Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, lang, uid);287 Element metadata_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_DESCRIBE, name, userContext); 284 288 metadata_message.appendChild(metadata_request); 285 289 } … … 331 335 result.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_PROCESS); 332 336 333 String lang = request.getAttribute(GSXML.LANG_ATT);337 UserContext userContext = new UserContext(request); 334 338 // Get the parameters of the request 335 339 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); … … 382 386 String cname = (String) e.getKey(); 383 387 Element doc_nodes = (Element) e.getValue(); 384 Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(cname, DOCUMENT_METADATA_RETRIEVE_SERVICE), lang, "");388 Element meta_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, GSPath.appendLink(cname, DOCUMENT_METADATA_RETRIEVE_SERVICE), userContext); 385 389 meta_request.appendChild(doc_nodes); 386 390 meta_request.appendChild(new_param_list.cloneNode(true)); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocXMLUtil.java
r24583 r24993 24 24 import org.greenstone.gsdl3.util.GSPath; 25 25 import org.greenstone.gsdl3.util.GSXML; 26 import org.greenstone.gsdl3.util.UserContext; 26 27 27 28 import org.w3c.dom.Document; … … 122 123 } 123 124 124 String lang = request.getAttribute(GSXML.LANG_ATT); 125 String uid = request.getAttribute(GSXML.USER_ID_ATT); 125 UserContext userContext = new UserContext(request); 126 126 127 127 //Go through each of the document items that are requested … … 133 133 String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT); 134 134 135 _GSDM.documentXMLCreateDocXML(oid, collection, lang, uid);135 _GSDM.documentXMLCreateDocXML(oid, collection, userContext); 136 136 if(_GSDM.checkError(result, DOC_XML_CREATE_EMPTY_FILE)) 137 137 { … … 152 152 } 153 153 154 String lang = request.getAttribute(GSXML.LANG_ATT); 155 String uid = request.getAttribute(GSXML.USER_ID_ATT); 154 UserContext userContext = new UserContext(request); 156 155 157 156 //Go through each of the metadata items that are requested … … 164 163 String metadataName = currentMetadata.getAttribute(GSXML.NAME_ATT); 165 164 166 ArrayList<Element> metadataValues = _GSDM.documentXMLGetMetadata(oid, collection, metadataName, lang, uid);165 ArrayList<Element> metadataValues = _GSDM.documentXMLGetMetadata(oid, collection, metadataName, userContext); 167 166 if(_GSDM.checkError(result, DOC_XML_GET_METADATA)) 168 167 { … … 192 191 } 193 192 194 String lang = request.getAttribute(GSXML.LANG_ATT); 195 String uid = request.getAttribute(GSXML.USER_ID_ATT); 193 UserContext userContext = new UserContext(request); 196 194 197 195 //Go through each of the metadata items that are requested … … 237 235 return result; 238 236 } 239 _GSDM.documentXMLSetMetadata(oid, collection, metadataName, newMetadataValue, pos, op, lang, uid);237 _GSDM.documentXMLSetMetadata(oid, collection, metadataName, newMetadataValue, pos, op, userContext); 240 238 if(_GSDM.checkError(result, DOC_XML_SET_METADATA)) 241 239 { … … 246 244 else if (oldMetadataValue != null && !oldMetadataValue.equals("")) 247 245 { 248 _GSDM.documentXMLReplaceMetadata(oid, collection, metadataName, oldMetadataValue, newMetadataValue, lang, uid);246 _GSDM.documentXMLReplaceMetadata(oid, collection, metadataName, oldMetadataValue, newMetadataValue, userContext); 249 247 if(_GSDM.checkError(result, DOC_XML_SET_METADATA)) 250 248 { … … 272 270 } 273 271 274 String lang = request.getAttribute(GSXML.LANG_ATT); 275 String uid = request.getAttribute(GSXML.USER_ID_ATT); 272 UserContext userContext = new UserContext(request); 276 273 277 274 //Go through each of the requests … … 283 280 String collection = currentSection.getAttribute(GSXML.COLLECTION_ATT); 284 281 285 _GSDM.documentXMLCreateSection(oid, collection, lang, uid);282 _GSDM.documentXMLCreateSection(oid, collection, userContext); 286 283 if(_GSDM.checkError(result, DOC_XML_CREATE_SECTION)) 287 284 { … … 302 299 } 303 300 304 String lang = request.getAttribute(GSXML.LANG_ATT); 305 String uid = request.getAttribute(GSXML.USER_ID_ATT); 301 UserContext userContext = new UserContext(request); 306 302 307 303 //Go through each of the requests … … 313 309 String collection = currentSection.getAttribute(GSXML.COLLECTION_ATT); 314 310 315 _GSDM.documentXMLDeleteSection(oid, collection, lang, uid);311 _GSDM.documentXMLDeleteSection(oid, collection, userContext); 316 312 if(_GSDM.checkError(result, DOC_XML_DELETE_SECTION)) 317 313 { … … 332 328 } 333 329 334 String lang = request.getAttribute(GSXML.LANG_ATT); 335 String uid = request.getAttribute(GSXML.USER_ID_ATT); 330 UserContext userContext = new UserContext(request); 336 331 337 332 //Go through each of the requests … … 343 338 String collection = currentSection.getAttribute(GSXML.COLLECTION_ATT); 344 339 345 _GSDM.documentXMLGetSection(oid, collection, lang, uid);340 _GSDM.documentXMLGetSection(oid, collection, userContext); 346 341 if(_GSDM.checkError(result, DOC_XML_GET_SECTION)) 347 342 { … … 362 357 } 363 358 364 String lang = request.getAttribute(GSXML.LANG_ATT); 365 String uid = request.getAttribute(GSXML.USER_ID_ATT); 359 UserContext userContext = new UserContext(request); 366 360 367 361 //Go through each of the requests … … 388 382 } 389 383 390 _GSDM.documentXMLSetSection(oid, collection, currentSection, op, lang, uid);384 _GSDM.documentXMLSetSection(oid, collection, currentSection, op, userContext); 391 385 if(_GSDM.checkError(result, DOC_XML_SET_SECTION)) 392 386 { … … 408 402 } 409 403 410 String lang = request.getAttribute(GSXML.LANG_ATT); 411 String uid = request.getAttribute(GSXML.USER_ID_ATT); 404 UserContext userContext = new UserContext(request); 412 405 413 406 //Go through each of the requests … … 419 412 String collection = currentContent.getAttribute(GSXML.COLLECTION_ATT); 420 413 421 String content = _GSDM.documentXMLGetText(oid, collection, lang, uid);414 String content = _GSDM.documentXMLGetText(oid, collection, userContext); 422 415 if(_GSDM.checkError(result, DOC_XML_GET_TEXT)) 423 416 { … … 451 444 } 452 445 453 String lang = request.getAttribute(GSXML.LANG_ATT); 454 String uid = request.getAttribute(GSXML.USER_ID_ATT); 446 UserContext userContext = new UserContext(request); 455 447 456 448 //Go through each of the requests … … 462 454 String collection = currentContent.getAttribute(GSXML.COLLECTION_ATT); 463 455 464 _GSDM.documentXMLSetText(oid, collection, currentContent, lang, uid);456 _GSDM.documentXMLSetText(oid, collection, currentContent, userContext); 465 457 if(_GSDM.checkError(result, DOC_XML_SET_TEXT)) 466 458 { -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentBasket.java
r24976 r24993 33 33 import org.greenstone.gsdl3.util.GSXML; 34 34 import org.greenstone.gsdl3.util.GSPath; 35 import org.greenstone.gsdl3.util.UserContext; 35 36 36 37 import java.net.InetAddress; … … 45 46 import javax.swing.Timer; 46 47 47 import java.io.FileOutputStream;48 48 import java.io.*; 49 import java.io.IOException;50 49 51 50 import org.apache.log4j.*; … … 364 363 ArrayList tmp = new ArrayList(); 365 364 tmp.add(id); 366 Element response = getDocumentMetadata(to, "en", "dumy", tmp.iterator()); 365 366 UserContext userContext = new UserContext(); 367 userContext.setLanguage("en"); 368 userContext.setUserID("dumy"); 369 370 Element response = getDocumentMetadata(to, userContext, tmp.iterator()); 367 371 Element doc_node = (Element) response.getElementsByTagName(GSXML.DOC_NODE_ELEM).item(0); 368 372 … … 539 543 } 540 544 541 private Element getDocumentMetadata(String to, String lang, String uid, Iterator ids)545 private Element getDocumentMetadata(String to, UserContext userContext, Iterator ids) 542 546 { 543 547 544 548 // Build a request to obtain some document metadata 545 549 Element dm_message = this.doc.createElement(GSXML.MESSAGE_ELEM); 546 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, lang, uid);550 Element dm_request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_PROCESS, to, userContext); 547 551 dm_message.appendChild(dm_request); 548 552 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/DocumentMaker.java
r24890 r24993 38 38 import org.greenstone.gsdl3.util.GSPath; 39 39 import org.greenstone.gsdl3.util.GSXML; 40 import org.greenstone.gsdl3.util.UserContext; 40 41 41 42 import org.w3c.dom.Element; … … 123 124 } 124 125 125 String lang = request.getAttribute(GSXML.LANG_ATT); 126 String uid = request.getAttribute(GSXML.USER_ID_ATT); 126 UserContext userContext = new UserContext(request); 127 127 128 128 //Get the list of documents to create … … 135 135 String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT); 136 136 137 _GSDM.documentCreate(oid, collection, lang, uid);137 _GSDM.documentCreate(oid, collection, userContext); 138 138 if (_GSDM.checkError(result, DOCUMENT_CREATE)) 139 139 { … … 155 155 } 156 156 157 String lang = request.getAttribute(GSXML.LANG_ATT); 158 String uid = request.getAttribute(GSXML.USER_ID_ATT); 157 UserContext userContext = new UserContext(request); 159 158 160 159 //Get the list of documents to delete … … 166 165 String collection = currentDoc.getAttribute(GSXML.COLLECTION_ATT); 167 166 168 _GSDM.documentDelete(oid, collection, lang, uid);167 _GSDM.documentDelete(oid, collection, userContext); 169 168 if (_GSDM.checkError(result, DOCUMENT_DELETE)) 170 169 { … … 186 185 } 187 186 188 String lang = request.getAttribute(GSXML.LANG_ATT); 189 String uid = request.getAttribute(GSXML.USER_ID_ATT); 187 UserContext userContext = new UserContext(request); 190 188 191 189 //Get the list of documents to duplicate … … 200 198 String operation = currentDoc.getAttribute("operation"); 201 199 202 _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), false, lang, uid);200 _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), false, userContext); 203 201 if (_GSDM.checkError(result, DOCUMENT_DUPLICATE)) 204 202 { … … 220 218 } 221 219 222 String lang = request.getAttribute(GSXML.LANG_ATT); 223 String uid = request.getAttribute(GSXML.USER_ID_ATT); 220 UserContext userContext = new UserContext(request); 224 221 225 222 //Get the list of documents to duplicate … … 239 236 } 240 237 241 _GSDM.documentGetInformation(oid, collection, requestedInfo, lang, uid);238 _GSDM.documentGetInformation(oid, collection, requestedInfo, userContext); 242 239 if (_GSDM.checkError(result, DOCUMENT_GET_INFORMATION)) 243 240 { … … 259 256 } 260 257 261 String lang = request.getAttribute(GSXML.LANG_ATT); 262 String uid = request.getAttribute(GSXML.USER_ID_ATT); 258 UserContext userContext = new UserContext(request); 263 259 264 260 //Get the list of documents to duplicate … … 273 269 String operation = currentDoc.getAttribute("operation"); 274 270 275 _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), true, lang, uid);271 _GSDM.documentMoveOrDuplicate(oid, collection, newOID, newCollection, _GSDM.operationStringToInt(operation), true, userContext); 276 272 if (_GSDM.checkError(result, DOCUMENT_MOVE)) 277 273 { … … 292 288 } 293 289 294 String lang = request.getAttribute(GSXML.LANG_ATT); 295 String uid = request.getAttribute(GSXML.USER_ID_ATT); 290 UserContext userContext = new UserContext(request); 296 291 297 292 //Get the list of documents to duplicate … … 304 299 String mergeOID = currentDoc.getAttribute("merge" + GSXML.NODE_ID_ATT); 305 300 306 _GSDM.documentMerge(oid, collection, mergeOID, lang, uid);301 _GSDM.documentMerge(oid, collection, mergeOID, userContext); 307 302 if (_GSDM.checkError(result, DOCUMENT_MERGE)) 308 303 { … … 324 319 } 325 320 326 String lang = request.getAttribute(GSXML.LANG_ATT); 327 String uid = request.getAttribute(GSXML.USER_ID_ATT); 321 UserContext userContext = new UserContext(request); 328 322 329 323 //Get the list of documents to duplicate … … 347 341 } 348 342 349 _GSDM.documentSplit(oid, collection, split, lang, uid);343 _GSDM.documentSplit(oid, collection, split, userContext); 350 344 if (_GSDM.checkError(result, DOCUMENT_SPLIT)) 351 345 { … … 367 361 } 368 362 369 String lang = request.getAttribute(GSXML.LANG_ATT); 370 String uid = request.getAttribute(GSXML.USER_ID_ATT); 363 UserContext userContext = new UserContext(request); 371 364 372 365 Element param_list = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER); … … 401 394 String subOperation = (String) keyValueMap.get("subOperation"); 402 395 403 _GSDM.documentMoveOrDuplicate(origOID, origCollection, newOID, newCollection, _GSDM.operationStringToInt(subOperation), operation.equals("move"), lang, uid);396 _GSDM.documentMoveOrDuplicate(origOID, origCollection, newOID, newCollection, _GSDM.operationStringToInt(subOperation), operation.equals("move"), userContext); 404 397 405 398 if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && origCollection != null && !collectionsToBuild.contains(origCollection)) … … 419 412 String subOperation = (String) keyValueMap.get("subOperation"); 420 413 421 //_GSDM.documentCreate(oid, collection, lang, uid); <--- Maybe go back to this422 _GSDM.documentXMLSetSection(oid, collection, this.doc.createElement(GSXML.DOCXML_SECTION_ELEM), _GSDM.operationStringToInt(subOperation), lang, uid);414 //_GSDM.documentCreate(oid, collection, userContext); <--- Maybe go back to this 415 _GSDM.documentXMLSetSection(oid, collection, this.doc.createElement(GSXML.DOCXML_SECTION_ELEM), _GSDM.operationStringToInt(subOperation), userContext); 423 416 424 417 if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && collection != null && !collectionsToBuild.contains(collection)) … … 432 425 String collection = (String) keyValueMap.get("collection"); 433 426 434 _GSDM.documentDelete(oid, collection, lang, uid);427 _GSDM.documentDelete(oid, collection, userContext); 435 428 436 429 if (_GSDM.getErrorStatus() == GSDocumentModel.NO_ERROR && collection != null && !collectionsToBuild.contains(collection)) … … 445 438 String newContent = (String) keyValueMap.get("text"); 446 439 447 _GSDM.documentXMLSetText(oid, collection, newContent, lang, uid);440 _GSDM.documentXMLSetText(oid, collection, newContent, userContext); 448 441 449 442 System.err.println(newContent); -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Construct.java
r24888 r24993 174 174 String lang = request.getAttribute(GSXML.LANG_ATT); 175 175 176 systemRequest("delete", coll_name, null, lang); 176 UserContext userContext = new UserContext(request); 177 178 systemRequest("delete", coll_name, null, userContext); 177 179 178 180 Element response = runCommand(request, GS2PerlConstructor.ACTIVATE); … … 227 229 // once have got here, we assume 228 230 // the first bit proceeded successfully, now reload the collection 229 systemRequest("reload", coll_name, status, lang); // this will append more messages to the status, and overwrite the error code att231 systemRequest("reload", coll_name, status, userContext); // this will append more messages to the status, and overwrite the error code att 230 232 return response; 231 233 … … 282 284 return response; 283 285 } 284 systemRequest("delete", coll_name, status, lang); 286 287 UserContext userContext = new UserContext(request); 288 289 systemRequest("delete", coll_name, status, userContext); 285 290 return response; 286 291 } … … 319 324 320 325 String coll_name = (String) params.get(COL_PARAM); 321 systemRequest("reload", coll_name, status, lang); 326 327 UserContext userContext = new UserContext(request); 328 329 systemRequest("reload", coll_name, status, userContext); 322 330 return response; 323 331 … … 328 336 * "delete" or "reload" response will be put into the status element 329 337 */ 330 protected void systemRequest(String action_name, String coll_name, Element status, String lang)338 protected void systemRequest(String action_name, String coll_name, Element status, UserContext userContext) 331 339 { 332 340 // send the request to the MR 333 341 Element message = this.doc.createElement(GSXML.MESSAGE_ELEM); 334 Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, "", lang, "");342 Element request = GSXML.createBasicRequest(this.doc, GSXML.REQUEST_TYPE_SYSTEM, "", userContext); 335 343 message.appendChild(request); 336 344 Element command = this.doc.createElement(GSXML.SYSTEM_ELEM); … … 361 369 if (response == null) 362 370 { 363 t = this.doc.createTextNode(getTextString(action_name + ".configure_error", lang, args));371 t = this.doc.createTextNode(getTextString(action_name + ".configure_error", userContext.getLanguage(), args)); 364 372 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.ERROR)); 365 373 status.appendChild(t); … … 368 376 369 377 // if we got here, we have succeeded! 370 t = this.doc.createTextNode(getTextString(action_name + ".success", lang, args));378 t = this.doc.createTextNode(getTextString(action_name + ".success", userContext.getLanguage(), args)); 371 379 status.setAttribute(GSXML.STATUS_ERROR_CODE_ATT, Integer.toString(GSStatus.SUCCESS)); 372 380 status.appendChild(t); … … 441 449 442 450 String lang = request.getAttribute(GSXML.LANG_ATT); 443 String uid = request.getAttribute(GSXML.USER_ID_ATT);444 451 String request_type = request.getAttribute(GSXML.TYPE_ATT); 445 452 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java
r24887 r24993 121 121 * is the collection we want to create the document/section in. 122 122 */ 123 public void documentCreate(String oid, String collection, String lang, String uid)123 public void documentCreate(String oid, String collection, UserContext userContext) 124 124 { 125 125 _errorStatus = NO_ERROR; … … 136 136 oid = generateOID(); 137 137 } 138 else if (archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))138 else if (archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 139 139 { 140 140 _errorStatus = ERROR_DESTINATION_DOCUMENT_OR_SECTION_ALREADY_EXISTS; … … 164 164 165 165 //Write the new entry to the archive database 166 archiveWriteEntryToDatabase(oid, collection, entries, lang, uid);166 archiveWriteEntryToDatabase(oid, collection, entries, userContext); 167 167 if (_errorStatus != NO_ERROR) 168 168 { … … 171 171 172 172 //Create a basic doc.xml file to go in the new folder 173 documentXMLCreateDocXML(oid, collection, lang, uid);173 documentXMLCreateDocXML(oid, collection, userContext); 174 174 } 175 175 else 176 176 { 177 documentXMLCreateSection(oid, collection, lang, uid);177 documentXMLCreateSection(oid, collection, userContext); 178 178 } 179 179 } … … 187 187 * is the collection to delete the document/section from. 188 188 */ 189 public void documentDelete(String oid, String collection, String lang, String uid)189 public void documentDelete(String oid, String collection, UserContext userContext) 190 190 { 191 191 _errorStatus = NO_ERROR; … … 201 201 } 202 202 203 if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))203 if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 204 204 { 205 205 _errorStatus = ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST; … … 225 225 226 226 //Remove the entry from the archive database 227 archiveRemoveEntryFromDatabase(oid, collection, lang, uid);227 archiveRemoveEntryFromDatabase(oid, collection, userContext); 228 228 } 229 229 else 230 230 { 231 documentXMLDeleteSection(oid, collection, lang, uid);231 documentXMLDeleteSection(oid, collection, userContext); 232 232 } 233 233 } … … 249 249 * instead. 250 250 */ 251 public void documentMoveOrDuplicate(String oid, String collection, String newOID, String newCollection, int operation, boolean move, String lang, String uid)252 { 253 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)251 public void documentMoveOrDuplicate(String oid, String collection, String newOID, String newCollection, int operation, boolean move, UserContext userContext) 252 { 253 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 254 254 { 255 255 return; … … 275 275 case OPERATION_TYPE_DOC_TO_DOC: 276 276 { 277 String archiveDir = archiveGetDocumentFilePath(oid, collection, lang, uid);277 String archiveDir = archiveGetDocumentFilePath(oid, collection, userContext); 278 278 if (_errorStatus != NO_ERROR) 279 279 { … … 312 312 case OPERATION_TYPE_DOC_TO_SEC: 313 313 { 314 Document originalDocument = getDocXML(oid, collection, lang, uid);314 Document originalDocument = getDocXML(oid, collection, userContext); 315 315 Element originalSection = getTopLevelSectionElement(originalDocument); 316 316 317 documentXMLCreateSection(newOID, newCollection, lang, uid);317 documentXMLCreateSection(newOID, newCollection, userContext); 318 318 if (_errorStatus != NO_ERROR) 319 319 { … … 321 321 } 322 322 323 documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);323 documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 324 324 325 325 if (move) 326 326 { 327 String archiveDirStr = archiveGetDocumentFilePath(oid, collection, lang, uid);327 String archiveDirStr = archiveGetDocumentFilePath(oid, collection, userContext); 328 328 if (_errorStatus != NO_ERROR) 329 329 { … … 342 342 case OPERATION_TYPE_SEC_TO_DOC: 343 343 { 344 Document originalDocument = getDocXML(oid, collection, lang, uid);344 Document originalDocument = getDocXML(oid, collection, userContext); 345 345 Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid)); 346 346 347 documentCreate(newOID, newCollection, lang, uid);347 documentCreate(newOID, newCollection, userContext); 348 348 if (_errorStatus != NO_ERROR) 349 349 { … … 351 351 } 352 352 353 documentXMLCreateSection(newOID, newCollection, lang, uid);353 documentXMLCreateSection(newOID, newCollection, userContext); 354 354 if (_errorStatus != NO_ERROR) 355 355 { … … 357 357 } 358 358 359 documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);359 documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 360 360 361 361 if (move) 362 362 { 363 originalDocument = getDocXML(oid, collection, lang, uid);363 originalDocument = getDocXML(oid, collection, userContext); 364 364 originalSection.getParentNode().removeChild(originalSection); 365 365 366 366 //Write the new change back into the file 367 if (!writeXMLFile(originalDocument, oid, collection, lang, uid))367 if (!writeXMLFile(originalDocument, oid, collection, userContext)) 368 368 { 369 369 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 377 377 case OPERATION_TYPE_SEC_TO_SEC: 378 378 { 379 Document originalDocument = getDocXML(oid, collection, lang, uid);379 Document originalDocument = getDocXML(oid, collection, userContext); 380 380 Element originalSection = getSectionBySectionNumber(originalDocument, getSectionFromOID(oid)); 381 381 382 382 if (operation == OPERATION_REPLACE) 383 383 { 384 documentXMLCreateSection(newOID, newCollection, lang, uid);384 documentXMLCreateSection(newOID, newCollection, userContext); 385 385 if (_errorStatus != NO_ERROR) 386 386 { … … 389 389 } 390 390 391 documentXMLSetSection(newOID, newCollection, originalSection, operation, lang, uid);391 documentXMLSetSection(newOID, newCollection, originalSection, operation, userContext); 392 392 if (_errorStatus != NO_ERROR) 393 393 { … … 397 397 if (move) 398 398 { 399 originalDocument = getDocXML(oid, collection, lang, uid);399 originalDocument = getDocXML(oid, collection, userContext); 400 400 originalSection.getParentNode().removeChild(originalSection); 401 401 402 402 //Write the new change back into the file 403 if (!writeXMLFile(originalDocument, oid, collection, lang, uid))403 if (!writeXMLFile(originalDocument, oid, collection, userContext)) 404 404 { 405 405 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 420 420 421 421 //Write the new entry to the archive database 422 archiveWriteEntryToDatabase(newOID, newCollection, entries, lang, uid);422 archiveWriteEntryToDatabase(newOID, newCollection, entries, userContext); 423 423 } 424 424 } … … 435 435 * @return This returns an array containing the requested information. 436 436 */ 437 public String[] documentGetInformation(String oid, String collection, String[] requestedInfo, String lang, String uid)438 { 439 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)437 public String[] documentGetInformation(String oid, String collection, String[] requestedInfo, UserContext userContext) 438 { 439 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 440 440 { 441 441 return null; … … 467 467 * merged into. 468 468 */ 469 public void documentMerge(String oid, String collection, String mergeOID, String lang, String uid)470 { 471 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)472 { 473 return; 474 } 475 476 if ((_errorStatus = checkOIDandCollection(mergeOID, collection, lang, uid)) != NO_ERROR)469 public void documentMerge(String oid, String collection, String mergeOID, UserContext userContext) 470 { 471 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 472 { 473 return; 474 } 475 476 if ((_errorStatus = checkOIDandCollection(mergeOID, collection, userContext)) != NO_ERROR) 477 477 { 478 478 return; … … 504 504 } 505 505 506 Document docXML = getDocXML(oid, collection, lang, uid);506 Document docXML = getDocXML(oid, collection, userContext); 507 507 if (docXML == null) 508 508 { … … 569 569 } 570 570 571 documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, lang, uid);571 documentXMLSetSection(mergeOID, collection, sourceSection, OPERATION_REPLACE, userContext); 572 572 if (_errorStatus != NO_ERROR) 573 573 { … … 575 575 } 576 576 577 documentXMLDeleteSection(oid, collection, lang, uid);577 documentXMLDeleteSection(oid, collection, userContext); 578 578 } 579 579 … … 590 590 * is the point in the text we want to split at. 591 591 */ 592 public void documentSplit(String oid, String collection, int splitPoint, String lang, String uid)593 { 594 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)595 { 596 return; 597 } 598 599 Document docXML = getDocXML(oid, collection, lang, uid);592 public void documentSplit(String oid, String collection, int splitPoint, UserContext userContext) 593 { 594 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 595 { 596 return; 597 } 598 599 Document docXML = getDocXML(oid, collection, userContext); 600 600 if (docXML == null) 601 601 { … … 644 644 newSection.appendChild(newContent); 645 645 646 documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, lang, uid);646 documentXMLSetSection(oid, collection, newSection, OPERATION_INSERT_BEFORE, userContext); 647 647 if (_errorStatus != NO_ERROR) 648 648 { … … 652 652 653 653 //Write the new change back into the file 654 if (!writeXMLFile(docXML, oid, collection, lang, uid))654 if (!writeXMLFile(docXML, oid, collection, userContext)) 655 655 { 656 656 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 666 666 * is the collection the new document will reside in. 667 667 */ 668 public void documentXMLCreateDocXML(String oid, String collection, String lang, String uid)668 public void documentXMLCreateDocXML(String oid, String collection, UserContext userContext) 669 669 { 670 670 _errorStatus = NO_ERROR; … … 673 673 Document docXML = null; 674 674 675 String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid);675 String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 676 676 File docFile = new File(filePath); 677 677 if (!docFile.exists() && !docFile.createNewFile()) … … 714 714 * @return an array of metadata elements containing the resquested metadata 715 715 */ 716 public ArrayList<Element> documentXMLGetMetadata(String oid, String collection, String metadataName, String lang, String uid)717 { 718 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)716 public ArrayList<Element> documentXMLGetMetadata(String oid, String collection, String metadataName, UserContext userContext) 717 { 718 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 719 719 { 720 720 return null; … … 726 726 } 727 727 728 Document docXML = getDocXML(oid, collection, lang, uid);728 Document docXML = getDocXML(oid, collection, userContext); 729 729 if (docXML == null) 730 730 { … … 753 753 * OPERATION_INSERT_AFTER or OPERATION_APPEND. 754 754 */ 755 public void documentXMLSetMetadata(String oid, String collection, String metadataName, String newMetadataValue, int position, int operation, String lang, String uid)756 { 757 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)755 public void documentXMLSetMetadata(String oid, String collection, String metadataName, String newMetadataValue, int position, int operation, UserContext userContext) 756 { 757 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 758 758 { 759 759 return; … … 770 770 } 771 771 772 Document docXML = getDocXML(oid, collection, lang, uid);772 Document docXML = getDocXML(oid, collection, userContext); 773 773 if (docXML == null) 774 774 { … … 825 825 826 826 //Write the new change back into the file 827 if (!writeXMLFile(docXML, oid, collection, lang, uid))827 if (!writeXMLFile(docXML, oid, collection, userContext)) 828 828 { 829 829 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 845 845 * is position of the item that is to be deleted. 846 846 */ 847 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, int position, String lang, String uid)848 { 849 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)847 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, int position, UserContext userContext) 848 { 849 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 850 850 { 851 851 return; … … 857 857 } 858 858 859 Document docXML = getDocXML(oid, collection, lang, uid);859 Document docXML = getDocXML(oid, collection, userContext); 860 860 if (docXML == null) 861 861 { … … 884 884 * is the name of the metadata to delete. 885 885 */ 886 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, String lang, String uid)887 { 888 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)886 public void documentXMLDeleteMetadata(String oid, String collection, String metadataName, UserContext userContext) 887 { 888 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 889 889 { 890 890 return; … … 896 896 } 897 897 898 Document docXML = getDocXML(oid, collection, lang, uid);898 Document docXML = getDocXML(oid, collection, userContext); 899 899 if (docXML == null) 900 900 { … … 929 929 * value. 930 930 */ 931 public void documentXMLReplaceMetadata(String oid, String collection, String metadataName, String oldMetadataValue, String newMetadataValue, String lang, String uid)932 { 933 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)931 public void documentXMLReplaceMetadata(String oid, String collection, String metadataName, String oldMetadataValue, String newMetadataValue, UserContext userContext) 932 { 933 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 934 934 { 935 935 return; … … 951 951 } 952 952 953 Document docXML = getDocXML(oid, collection, lang, uid);953 Document docXML = getDocXML(oid, collection, userContext); 954 954 if (docXML == null) 955 955 { … … 971 971 972 972 //Write the new change back into the file 973 if (!writeXMLFile(docXML, oid, collection, lang, uid))973 if (!writeXMLFile(docXML, oid, collection, userContext)) 974 974 { 975 975 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 985 985 * is the collection the document resides in. 986 986 */ 987 public void documentXMLCreateSection(String oid, String collection, String lang, String uid)987 public void documentXMLCreateSection(String oid, String collection, UserContext userContext) 988 988 { 989 989 _errorStatus = NO_ERROR; … … 999 999 } 1000 1000 1001 if (oid.contains(".") && !archiveCheckDocumentOrSectionExists(oid.substring(0, oid.indexOf(".")), collection, lang, uid))1002 { 1003 documentCreate(oid.substring(0, oid.indexOf(".")), collection, lang, uid);1001 if (oid.contains(".") && !archiveCheckDocumentOrSectionExists(oid.substring(0, oid.indexOf(".")), collection, userContext)) 1002 { 1003 documentCreate(oid.substring(0, oid.indexOf(".")), collection, userContext); 1004 1004 if (_errorStatus != NO_ERROR) 1005 1005 { … … 1008 1008 } 1009 1009 1010 Document docXML = getDocXML(oid, collection, lang, uid);1010 Document docXML = getDocXML(oid, collection, userContext); 1011 1011 if (docXML == null) 1012 1012 { … … 1068 1068 1069 1069 //Write the new change back into the file 1070 if (!writeXMLFile(docXML, oid, collection, lang, uid))1070 if (!writeXMLFile(docXML, oid, collection, userContext)) 1071 1071 { 1072 1072 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1082 1082 * is the collection the document resides in. 1083 1083 */ 1084 public void documentXMLDeleteSection(String oid, String collection, String lang, String uid)1085 { 1086 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1087 { 1088 return; 1089 } 1090 1091 Document docXML = getDocXML(oid, collection, lang, uid);1084 public void documentXMLDeleteSection(String oid, String collection, UserContext userContext) 1085 { 1086 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1087 { 1088 return; 1089 } 1090 1091 Document docXML = getDocXML(oid, collection, userContext); 1092 1092 if (docXML == null) 1093 1093 { … … 1106 1106 1107 1107 //Write the new change back into the file 1108 if (!writeXMLFile(docXML, oid, collection, lang, uid))1108 if (!writeXMLFile(docXML, oid, collection, userContext)) 1109 1109 { 1110 1110 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1121 1121 * @return the requested section. 1122 1122 */ 1123 public Element documentXMLGetSection(String oid, String collection, String lang, String uid)1124 { 1125 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1126 { 1127 return null; 1128 } 1129 1130 Document docXML = getDocXML(oid, collection, lang, uid);1123 public Element documentXMLGetSection(String oid, String collection, UserContext userContext) 1124 { 1125 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1126 { 1127 return null; 1128 } 1129 1130 Document docXML = getDocXML(oid, collection, userContext); 1131 1131 if (docXML == null) 1132 1132 { … … 1168 1168 * @throws IOException 1169 1169 */ 1170 public void documentXMLSetSection(String oid, String collection, Element newSection, int operation, String lang, String uid)1171 { 1172 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1173 { 1174 return; 1175 } 1176 1177 Document docXML = getDocXML(oid, collection, lang, uid);1170 public void documentXMLSetSection(String oid, String collection, Element newSection, int operation, UserContext userContext) 1171 { 1172 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1173 { 1174 return; 1175 } 1176 1177 Document docXML = getDocXML(oid, collection, userContext); 1178 1178 if (docXML == null) 1179 1179 { … … 1240 1240 1241 1241 //Write the new change back into the file 1242 if (!writeXMLFile(docXML, oid, collection, lang, uid))1242 if (!writeXMLFile(docXML, oid, collection, userContext)) 1243 1243 { 1244 1244 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1256 1256 * @return the text from the section. 1257 1257 */ 1258 public String documentXMLGetText(String oid, String collection, String lang, String uid)1259 { 1260 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1261 { 1262 return null; 1263 } 1264 1265 Document docXML = getDocXML(oid, collection, lang, uid);1258 public String documentXMLGetText(String oid, String collection, UserContext userContext) 1259 { 1260 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1261 { 1262 return null; 1263 } 1264 1265 Document docXML = getDocXML(oid, collection, userContext); 1266 1266 if (docXML == null) 1267 1267 { … … 1311 1311 * is the new content element for the section. 1312 1312 */ 1313 public void documentXMLSetText(String oid, String collection, Element newContent, String lang, String uid)1314 { 1315 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1316 { 1317 return; 1318 } 1319 1320 Document docXML = getDocXML(oid, collection, lang, uid);1313 public void documentXMLSetText(String oid, String collection, Element newContent, UserContext userContext) 1314 { 1315 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1316 { 1317 return; 1318 } 1319 1320 Document docXML = getDocXML(oid, collection, userContext); 1321 1321 if (docXML == null) 1322 1322 { … … 1363 1363 1364 1364 //Write the new change back into the file 1365 if (!writeXMLFile(docXML, oid, collection, lang, uid))1365 if (!writeXMLFile(docXML, oid, collection, userContext)) 1366 1366 { 1367 1367 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1380 1380 * is the new text for the section. 1381 1381 */ 1382 public void documentXMLSetText(String oid, String collection, String newContent, String lang, String uid)1383 { 1384 if ((_errorStatus = checkOIDandCollection(oid, collection, lang, uid)) != NO_ERROR)1385 { 1386 return; 1387 } 1388 1389 Document docXML = getDocXML(oid, collection, lang, uid);1382 public void documentXMLSetText(String oid, String collection, String newContent, UserContext userContext) 1383 { 1384 if ((_errorStatus = checkOIDandCollection(oid, collection, userContext)) != NO_ERROR) 1385 { 1386 return; 1387 } 1388 1389 Document docXML = getDocXML(oid, collection, userContext); 1390 1390 if (docXML == null) 1391 1391 { … … 1433 1433 1434 1434 //Write the new change back into the file 1435 if (!writeXMLFile(docXML, oid, collection, lang, uid))1435 if (!writeXMLFile(docXML, oid, collection, userContext)) 1436 1436 { 1437 1437 _errorStatus = ERROR_COULD_NOT_WRITE_TO_DOC_XML; … … 1451 1451 * @return the file path to the doc.xml file. 1452 1452 */ 1453 public String archiveGetDocumentFilePath(String oid, String collection, String lang, String uid)1453 public String archiveGetDocumentFilePath(String oid, String collection, UserContext userContext) 1454 1454 { 1455 1455 _errorStatus = NO_ERROR; … … 1460 1460 } 1461 1461 1462 String assocFilePath = getDocFilePathFromDatabase(oid, collection, lang, uid);1462 String assocFilePath = getDocFilePathFromDatabase(oid, collection, userContext); 1463 1463 if (assocFilePath == null) 1464 1464 { … … 1485 1485 * @return the OID of the document that the source file is used in. 1486 1486 */ 1487 public String archiveGetSourceFileOID(String srcFile, String collection, String lang, String uid)1487 public String archiveGetSourceFileOID(String srcFile, String collection, UserContext userContext) 1488 1488 { 1489 1489 _errorStatus = NO_ERROR; 1490 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, lang, uid);1490 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFSRC, SimpleCollectionDatabase.READ, userContext); 1491 1491 if (coll_db == null) 1492 1492 { … … 1518 1518 * @return true if the document/section exists, false otherwise. 1519 1519 */ 1520 public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, String lang, String uid)1520 public boolean archiveCheckDocumentOrSectionExists(String oid, String collection, UserContext userContext) 1521 1521 { 1522 1522 _errorStatus = NO_ERROR; 1523 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid);1523 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext); 1524 1524 if (coll_db == null) 1525 1525 { … … 1548 1548 if (section && exists) 1549 1549 { 1550 Document docXML = getDocXML(oid, collection, lang, uid);1550 Document docXML = getDocXML(oid, collection, userContext); 1551 1551 if (getSectionBySectionNumber(docXML, getSectionFromOID(oid)) == null) 1552 1552 { … … 1569 1569 * is the list of entries to write. 1570 1570 */ 1571 public void archiveWriteEntryToDatabase(String oid, String collection, HashMap<String, ArrayList<String>> infoList, String lang, String uid)1571 public void archiveWriteEntryToDatabase(String oid, String collection, HashMap<String, ArrayList<String>> infoList, UserContext userContext) 1572 1572 { 1573 1573 _errorStatus = NO_ERROR; … … 1593 1593 } 1594 1594 1595 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);1595 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 1596 1596 if (coll_db == null) 1597 1597 { … … 1611 1611 * is the collection whose database will have the entry removed. 1612 1612 */ 1613 public void archiveRemoveEntryFromDatabase(String oid, String collection, String lang, String uid)1613 public void archiveRemoveEntryFromDatabase(String oid, String collection, UserContext userContext) 1614 1614 { 1615 1615 _errorStatus = NO_ERROR; … … 1625 1625 } 1626 1626 1627 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);1627 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 1628 1628 if (coll_db == null) 1629 1629 { … … 1645 1645 * @return the list of associated files. 1646 1646 */ 1647 public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, String lang, String uid)1647 public ArrayList<String> archiveGetAssociatedImportFiles(String oid, String collection, UserContext userContext) 1648 1648 { 1649 1649 _errorStatus = NO_ERROR; … … 1659 1659 } 1660 1660 1661 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, lang, uid);1661 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.READ, userContext); 1662 1662 if (coll_db == null) 1663 1663 { … … 1756 1756 } 1757 1757 1758 public String getDocFilePathFromDatabase(String oid, String collection, String lang, String uid)1759 { 1760 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, lang, uid);1758 public String getDocFilePathFromDatabase(String oid, String collection, UserContext userContext) 1759 { 1760 SimpleCollectionDatabase coll_db = openDatabase(collection, ARCHIVEINFDOC, SimpleCollectionDatabase.WRITE, userContext); 1761 1761 if (coll_db == null) 1762 1762 { … … 1810 1810 } 1811 1811 1812 public int checkOIDandCollection(String oid, String collection, String lang, String uid)1812 public int checkOIDandCollection(String oid, String collection, UserContext userContext) 1813 1813 { 1814 1814 if (oid == null || oid.equals("")) … … 1822 1822 } 1823 1823 1824 if (!archiveCheckDocumentOrSectionExists(oid, collection, lang, uid))1824 if (!archiveCheckDocumentOrSectionExists(oid, collection, userContext)) 1825 1825 { 1826 1826 return ERROR_SOURCE_DOCUMENT_OR_SECTION_DOES_NOT_EXIST; … … 1883 1883 } 1884 1884 1885 public boolean writeXMLFile(Document doc, String oid, String collection, String lang, String uid)1885 public boolean writeXMLFile(Document doc, String oid, String collection, UserContext userContext) 1886 1886 { 1887 1887 try … … 1889 1889 DOMSource source = new DOMSource(doc); 1890 1890 1891 String test = archiveGetDocumentFilePath(oid, collection, lang, uid);1891 String test = archiveGetDocumentFilePath(oid, collection, userContext); 1892 1892 File xmlFile = new File(test); 1893 1893 Result result = new StreamResult(xmlFile); … … 1903 1903 } 1904 1904 1905 public Document getDocXML(String oid, String collection, String lang, String uid)1905 public Document getDocXML(String oid, String collection, UserContext userContext) 1906 1906 { 1907 1907 if (oid.contains(".")) … … 1913 1913 if ((docXML = _docCache.get(oid + "__" + collection)) == null) 1914 1914 { 1915 String filePath = archiveGetDocumentFilePath(oid, collection, lang, uid);1915 String filePath = archiveGetDocumentFilePath(oid, collection, userContext); 1916 1916 File docFile = new File(filePath); 1917 1917 … … 2005 2005 } 2006 2006 2007 public String getDatabaseTypeFromCollection(String collection, String lang, String uid)2007 public String getDatabaseTypeFromCollection(String collection, UserContext userContext) 2008 2008 { 2009 2009 //Find out what kind of database we have 2010 2010 Element dbTypeMessage = _mainDoc.createElement(GSXML.MESSAGE_ELEM); 2011 Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, lang, uid);2011 Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext); 2012 2012 dbTypeMessage.appendChild(dbTypeRequest); 2013 2013 Element dbTypeResponse = (Element) _router.process(dbTypeMessage); … … 2023 2023 } 2024 2024 2025 public SimpleCollectionDatabase openDatabase(String collection, String dbName, int readWrite, String lang, String uid)2025 public SimpleCollectionDatabase openDatabase(String collection, String dbName, int readWrite, UserContext userContext) 2026 2026 { 2027 2027 //Find out what kind of database we have 2028 String databaseType = getDatabaseTypeFromCollection(collection, lang, uid);2028 String databaseType = getDatabaseTypeFromCollection(collection, userContext); 2029 2029 String dbExt = DBHelper.getDBExtFromDBType(databaseType); 2030 2030 -
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSXML.java
r24984 r24993 727 727 728 728 /** returns a basic request message */ 729 public static Element createBasicRequest(Document owner, String request_type, String to, String lang, String uid)729 public static Element createBasicRequest(Document owner, String request_type, String to, UserContext userContext) 730 730 { 731 731 Element request = owner.createElement(REQUEST_ELEM); 732 732 request.setAttribute(TYPE_ATT, request_type); 733 request.setAttribute(LANG_ATT, lang);733 request.setAttribute(LANG_ATT, userContext._lang); 734 734 request.setAttribute(TO_ATT, to); 735 request.setAttribute(USER_ID_ATT, u id);735 request.setAttribute(USER_ID_ATT, userContext._userID); 736 736 return request; 737 737 }
Note:
See TracChangeset
for help on using the changeset viewer.