1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.opensaml.xacml.policy.impl;
20
21 import org.opensaml.xacml.policy.EffectType;
22 import org.opensaml.xacml.policy.ObligationType;
23 import org.opensaml.xml.XMLObject;
24 import org.opensaml.xml.io.AbstractXMLObjectMarshaller;
25 import org.opensaml.xml.io.MarshallingException;
26 import org.opensaml.xml.util.DatatypeHelper;
27 import org.w3c.dom.Element;
28
29
30 public class ObligationTypeMarshaller extends AbstractXMLObjectMarshaller {
31
32
33 public ObligationTypeMarshaller() {
34 super();
35 }
36
37
38 protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {
39
40 }
41
42
43 protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException {
44 ObligationType obligation = (ObligationType) samlElement;
45
46 if (!DatatypeHelper.isEmpty(obligation.getObligationId())) {
47 domElement.setAttributeNS(null, ObligationType.OBLIGATION_ID_ATTRIB_NAME, obligation.getObligationId());
48 }
49 if (obligation.getFulfillOn() != null) {
50 if (obligation.getFulfillOn().equals(EffectType.Deny)) {
51 domElement.setAttributeNS(null, ObligationType.FULFILL_ON_ATTRIB_NAME, EffectType.Deny.toString());
52 } else {
53 domElement.setAttributeNS(null, ObligationType.FULFILL_ON_ATTRIB_NAME, EffectType.Permit.toString());
54 }
55 }
56 }
57 }