Changeset 37614
- Timestamp:
- 2023-04-06T16:54:00+12:00 (13 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/collection/Collection.java
r34154 r37614 89 89 protected ArrayList<HashMap<String, ArrayList<String>>> _securityExceptions = new ArrayList<HashMap<String, ArrayList<String>>>(); 90 90 91 protected HashMap<String, Element> _ccServiceFormats = new HashMap<String, Element>(); 91 92 protected XMLTransformer transformer = null; 92 93 … … 161 162 this.description.setAttribute(GSXML.DB_TYPE_ATT, db_type); 162 163 163 _globalFormat = (Element) GSXML.getChildByTagName(coll_config_xml, GSXML.FORMAT_ELEM);164 164 // process the metadata and display items and default library params 165 165 super.configureLocalData(coll_config_xml); 166 166 super.configureLocalData(build_config_xml); 167 167 168 // get extra collection specific stuff 169 _globalFormat = (Element) GSXML.getChildByTagName(coll_config_xml, GSXML.FORMAT_ELEM); 170 loadCCServiceFormats(coll_config_xml); 171 168 172 findAndLoadInfo(coll_config_xml, build_config_xml); 169 173 … … 309 313 } 310 314 315 protected void loadCCServiceFormats(Element coll_config_xml) { 316 317 Element ccservice = (Element)GSXML.getChildByTagName(coll_config_xml, GSXML.CC_SERVICES_ELEM); 318 if (ccservice == null) return; 319 NodeList format_elems = GSXML.getChildrenByTagName(ccservice, GSXML.FORMAT_ELEM); 320 for (int i = 0; i < format_elems.getLength(); i++) 321 { 322 Element child = (Element)format_elems.item(i); 323 String service_name = child.getAttribute(GSXML.SERVICE_ATT); 324 if (!service_name.equals("")) { 325 _ccServiceFormats.put(service_name, child); 326 } 327 } 328 } 311 329 protected void loadSecurityInformation(Element coll_config_xml) 312 330 { … … 489 507 { 490 508 String type = request.getAttribute(GSXML.TYPE_ATT); 509 491 510 if (type.equals(GSXML.REQUEST_TYPE_FORMAT_STRING)) 492 511 { … … 499 518 else if (type.equals(GSXML.REQUEST_TYPE_FORMAT)) 500 519 { 501 502 Element response = result_doc.createElement(GSXML.RESPONSE_ELEM); 503 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 504 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT); 505 if (_globalFormat != null) 506 { 507 response.appendChild(result_doc.importNode(_globalFormat, true)); 508 } 509 return response; 520 Element response = result_doc.createElement(GSXML.RESPONSE_ELEM); 521 response.setAttribute(GSXML.FROM_ATT, this.cluster_name); 522 response.setAttribute(GSXML.TYPE_ATT, GSXML.REQUEST_TYPE_FORMAT); 523 524 // if we have a service arg, return format for that service - if any 525 String service_name = request.getAttribute(GSXML.SERVICE_ATT); 526 if (!service_name.equals("")) { 527 Element this_format = _ccServiceFormats.get(service_name); 528 if (this_format != null) { 529 response.appendChild(result_doc.importNode(this_format, true)); 530 } 531 return response; // if a service_name was specified, return 532 // the format, or empty response 533 } 534 535 // no service_name specified, return global format 536 if (_globalFormat != null) 537 { 538 response.appendChild(result_doc.importNode(_globalFormat, true)); 539 } 540 return response; 510 541 } 511 542 // unknown type
Note:
See TracChangeset
for help on using the changeset viewer.