this.attributeValues = attributeValues.toArray(new String[attributeValues.size()]);
}
public XRD execute(Store store, XRD xrd, XRISegment segment, Authority parentAuthority, String subSegmentName, Authority authority, boolean isCreate) throws StageException {
if (! (store instanceof StoreAttributable)) throw new StageException("Cannot use this store implementation.");
StoreAttributable storeAttributable = (StoreAttributable) store;
Element xrdElement = xrd.getDOM();
Document document = xrdElement.getOwnerDocument();
// create new element
Element element;
if (this.elementNamespace != null) {
element = document.createElementNS(this.elementNamespace, this.elementName);
} else {
element = document.createElement(this.elementName);
}
if (this.elementValue != null) {
Text text = document.createTextNode(this.elementValue);
element.appendChild(text);
}
for (int i=0; i<this.attributeNames.length; i++) {
Attr attr = document.createAttribute(this.attributeNames[i]);
attr.setNodeValue(this.attributeValues[i]);
element.setAttributeNode(attr);
}
// insert element into XRD
try {
xrdElement.appendChild(element);
xrd = new XRD(xrdElement, false);
} catch (Exception ex) {
throw new StageException("Unable to parse modified XRD.", ex);
}
// done
return(xrd);