super(targetNamespaceURI, targetLocalName);
}
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
AffiliationDescriptor descriptor = (AffiliationDescriptor) samlElement;
// Set affiliationOwnerID
if (descriptor.getOwnerID() != null) {
domElement.setAttributeNS(null, AffiliationDescriptor.OWNER_ID_ATTRIB_NAME, descriptor.getOwnerID());
}
// Set ID
if (descriptor.getID() != null) {
domElement.setAttributeNS(null, AffiliationDescriptor.ID_ATTRIB_NAME, descriptor.getID());
domElement.setIdAttributeNS(null, AffiliationDescriptor.ID_ATTRIB_NAME, true);
}
// Set the validUntil attribute
if (descriptor.getValidUntil() != null) {
log.debug("Writting validUntil attribute to AffiliationDescriptor DOM element");
String validUntilStr = Configuration.getSAMLDateFormatter().print(descriptor.getValidUntil());
domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
}
// Set the cacheDuration attribute
if (descriptor.getCacheDuration() != null) {
log.debug("Writting cacheDuration attribute to AffiliationDescriptor DOM element");
String cacheDuration = XMLHelper.longToDuration(descriptor.getCacheDuration());
domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
}
Attr attribute;
for (Entry<QName, String> entry : descriptor.getUnknownAttributes().entrySet()) {
attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
attribute.setValue(entry.getValue());
domElement.setAttributeNodeNS(attribute);
if (Configuration.isIDAttribute(entry.getKey())
|| descriptor.getUnknownAttributes().isIDAttribute(entry.getKey())) {
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
}
}
}