public class AssertionMarshaller extends AbstractSAMLObjectMarshaller {
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
Assertion assertion = (Assertion) samlElement;
if (assertion.getID() != null) {
domElement.setAttributeNS(null, Assertion.ID_ATTRIB_NAME, assertion.getID());
if (assertion.getMinorVersion() != 0) {
domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true);
}
}
if (assertion.getIssuer() != null) {
domElement.setAttributeNS(null, Assertion.ISSUER_ATTRIB_NAME, assertion.getIssuer());
}
if (assertion.getIssueInstant() != null) {
String date = ISODateTimeFormat.dateTime().print(assertion.getIssueInstant());
domElement.setAttributeNS(null, Assertion.ISSUEINSTANT_ATTRIB_NAME, date);
}
domElement.setAttributeNS(null, Assertion.MAJORVERSION_ATTRIB_NAME, "1");
if (assertion.getMinorVersion() == 0) {
domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "0");
} else {
domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "1");
}
}