1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.opensaml.xacml.policy.impl;
19
20 import org.opensaml.xacml.policy.IdReferenceType;
21 import org.opensaml.xml.XMLObject;
22 import org.opensaml.xml.io.MarshallingException;
23 import org.opensaml.xml.schema.impl.XSStringMarshaller;
24 import org.opensaml.xml.util.DatatypeHelper;
25 import org.w3c.dom.Element;
26
27
28
29
30 public class IdReferenceTypeMarshaller extends XSStringMarshaller {
31
32
33 public IdReferenceTypeMarshaller() {
34 super();
35 }
36
37
38 protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
39 IdReferenceType idReferenceType = (IdReferenceType)xmlObject;
40
41 if(!DatatypeHelper.isEmpty(idReferenceType.getEarliestVersion())){
42 domElement.setAttribute(IdReferenceType.EARLIEST_VERSION_ATTRIB_NAME,
43 idReferenceType.getEarliestVersion());
44 }else if(!DatatypeHelper.isEmpty(idReferenceType.getLatestVersion())){
45 domElement.setAttribute(IdReferenceType.LATEST_VERSION_ATTRIB_NAME,
46 idReferenceType.getLatestVersion());
47 }else if(!DatatypeHelper.isEmpty(idReferenceType.getVersion())){
48 domElement.setAttribute(IdReferenceType.VERSION_ATTRIB_NAME,
49 idReferenceType.getVersion());
50 }
51 }
52
53
54 protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
55 super.marshallElementContent(xmlObject, domElement);
56 }
57 }