}
}
private PgeMetadata getCustomMetadata(Element customMetadataElem, PgeMetadata pgeMetadata)
throws MalformedURLException, Exception {
PgeMetadata localPgeMetadata = new PgeMetadata();
PgeMetadata curPgeMetadata = new PgeMetadata();
curPgeMetadata.replaceMetadata(pgeMetadata);
Metadata curPlusLocalMetadata = new Metadata();
curPlusLocalMetadata.addMetadata(curPgeMetadata.asMetadata().getHashtable());
if (customMetadataElem != null) {
NodeList customMetadataList = customMetadataElem
.getElementsByTagName(METADATA_TAG);
for (int i = 0; i < customMetadataList.getLength(); i++) {
Element metadataElement = (Element) customMetadataList.item(i);
String key = metadataElement.getAttribute(KEY_ATTR);
if (key.equals(""))
key = this.fillIn(metadataElement.getAttribute(KEY_GEN_ATTR), curPlusLocalMetadata);
if (!metadataElement.getAttribute(KEYREF_ATTR).equals("")) {
String val = metadataElement.getAttribute(KEYREF_ATTR);
if (metadataElement.getAttribute(ENV_REPLACE_NO_RECUR_ATTR)
.toLowerCase().equals("true"))
val = this.fillIn(val, curPlusLocalMetadata, false);
else if (!metadataElement.getAttribute(ENV_REPLACE_ATTR)
.toLowerCase().equals("false"))
val = this.fillIn(val, curPlusLocalMetadata);
localPgeMetadata.linkKey(key, val);
curPgeMetadata.linkKey(key, val);
}else {
String val = metadataElement.getAttribute(VAL_ATTR);
if (val.equals(""))
val = metadataElement.getTextContent();
if (metadataElement.getAttribute(ENV_REPLACE_NO_RECUR_ATTR)
.toLowerCase().equals("true"))
val = this.fillIn(val, curPlusLocalMetadata, false);
else if (!metadataElement.getAttribute(ENV_REPLACE_ATTR)
.toLowerCase().equals("false"))
val = this.fillIn(val, curPlusLocalMetadata);
List<String> valList = new Vector<String>();
if (!metadataElement.getAttribute(SPLIT_ATTR)
.toLowerCase().equals("false"))
valList.addAll(Arrays.asList((val + ",").split(",")));
else
valList.add(val);
localPgeMetadata.replaceMetadata(key, valList);
curPgeMetadata.replaceMetadata(key, valList);
}
if (metadataElement.getAttribute(WORKFLOW_MET_ATTR)
.toLowerCase().equals("true"))
localPgeMetadata.markAsDynamicMetadataKey(key);
List<String> values = curPgeMetadata.getAllMetadata(key);
if (values != null) {
curPlusLocalMetadata.replaceMetadata(key, values);
}
}
}