Changeset 29057
- Timestamp:
- 2014-05-15T13:46:48+12:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/OAIXML.java
r28983 r29057 129 129 public static final String RESUMPTION_TOKEN_EXPIRATION = "resumptionTokenExpiration"; 130 130 public static final String OAI_SUPER_SET = "oaiSuperSet"; 131 public static final String ELEMENT = "element"; 132 public static final String ELEMENTS = "elements"; 131 133 public static final String MAPPING = "mapping"; 132 public static final String MAPPING_LIST = "mappingList"; 133 134 public static final String SELECT = "select"; 135 public static final String SELECT_SINGLE_VALUE = "firstvalue"; 136 public static final String SELECT_FIRST_VALID_META = "firstvalidmetadata"; 137 public static final String SELECT_ALL_VALUES = "allvalues"; 134 138 // code constants 135 139 public static final String GS_OAI_RESOURCE_URL = "gs.OAIResourceURL"; … … 275 279 } 276 280 277 281 /** Copies out the main info from a metadataFormat element, leaving behind the mapping stuff. This gets the bit needed for OAI response */ 282 public static Element getMetadataFormatShort(Document doc, Element meta_format_long) { 283 Element meta_fmt = doc.createElement(OAIXML.METADATA_FORMAT); 284 // Copy in the elements that we want, and ignore the rest 285 meta_fmt.appendChild(doc.importNode(GSXML.getChildByTagName(meta_format_long, OAIXML.METADATA_PREFIX), true)); 286 meta_fmt.appendChild(doc.importNode(GSXML.getChildByTagName(meta_format_long, OAIXML.SCHEMA), true)); 287 meta_fmt.appendChild(doc.importNode(GSXML.getChildByTagName(meta_format_long, OAIXML.METADATA_NAMESPACE), true)); 288 289 return meta_fmt; 290 } 291 278 292 public static long getTokenExpiration() { 279 293 return token_expiration*1000; // in milliseconds … … 495 509 return oai; 496 510 } 497 public static Element getMetadataPrefixElement(Document doc, String tag_name, String version) {511 public static Element getMetadataPrefixElement(Document doc, String prefix, String version) { 498 512 //examples of tag_name: dc, oai_dc:dc, etc. 513 String tag_name = getMetadataTagName(prefix, version); 499 514 Element oai = doc.createElement(tag_name); 500 515 if (version.equals(OAI_VERSION2)) { … … 511 526 return oai; 512 527 } 528 public static String getMetadataTagName(String prefix, String oai_version) { 529 if (prefix.equals("oai_dc")) { 530 if (oai_version.equals(OAI_VERSION2)) { 531 return "oai_dc:dc"; 532 } 533 return "dc"; 534 } 535 return prefix; 536 } 537 513 538 public static HashMap<String, Node> getChildrenMapByTagName(Node n, String tag_name) { 514 539
Note:
See TracChangeset
for help on using the changeset viewer.