/** * Extract <set> XML string from setItem object * * @param setItem individual set instance in native format * @return an XML String containing the XML <set> content */ public String getSetXML(String setSpec) throws IllegalArgumentException { String setName = "Metadata originating from " + setSpec; StringBuffer sb = new StringBuffer(); sb.append("<set>"); sb.append("<setSpec>"); sb.append(OAIUtil.xmlEncode(setSpec)); sb.append("</setSpec>"); sb.append("<setName>"); sb.append(OAIUtil.xmlEncode(setName)); sb.append("</setName>"); sb.append("</set>"); return sb.toString(); }
/** * Extract <set> XML string from setItem object * * @param setItem individual set instance in native format * @return an XML String containing the XML <set> content */ public String getSetXMLRepository(String key, String setSpec) throws IllegalArgumentException { String setName = "Metadata originating from " + setSpec; String setDescription = "RepositoryIdentifier is " + key; StringBuffer sb = new StringBuffer(); sb.append("<set>"); sb.append("<setSpec>"); sb.append(OAIUtil.xmlEncode(setSpec)); sb.append("</setSpec>"); sb.append("<setName>"); sb.append(OAIUtil.xmlEncode(setName)); sb.append("</setName>"); if (setDescription != null) { sb.append("<setDescription>"); sb.append(getSetDCDescription(OAIUtil.xmlEncode(setDescription))); sb.append("</setDescription>"); } sb.append("</set>"); return sb.toString(); }
/** * Extract <set> XML string from setItem object * * @param setItem individual set instance in native format * @return an XML String containing the XML <set> content */ public String getSetXML(Map<String, Object> setItem) throws IllegalArgumentException { String setSpec = getSetSpec(setItem); String setName = getSetName(setItem); String setDescription = getSetDescription(setItem); StringBuilder sb = new StringBuilder(); sb.append("<set>"); sb.append("<setSpec>"); sb.append(OAIUtil.xmlEncode(setSpec)); sb.append("</setSpec>"); sb.append("<setName>"); sb.append(OAIUtil.xmlEncode(setName)); sb.append("</setName>"); if (setDescription != null) { sb.append("<setDescription>"); sb.append(OAIUtil.xmlEncode(setDescription)); sb.append("</setDescription>"); } sb.append("</set>"); return sb.toString(); }
private static ArrayList getSets(Properties properties) { InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("sets.properties"); Properties setProps = new Properties(); try { setProps.load(is); } catch (Exception e) { e.printStackTrace(); } TreeMap treeMap = new TreeMap(); Enumeration propNames = setProps.propertyNames(); while (propNames.hasMoreElements()) { String propertyName = (String) propNames.nextElement(); String s = new StringBuffer("<set><setSpec>") .append(OAIUtil.xmlEncode(propertyName)) .append("</setSpec><setName>") .append(OAIUtil.xmlEncode((String) setProps.get(propertyName))) .append("</setName></set>") .toString(); treeMap.put(propertyName, s); } return new ArrayList(treeMap.values()); }