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