1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.ws.wspolicy.impl;
18
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22
23 import javax.xml.namespace.QName;
24
25 import org.opensaml.ws.wspolicy.AppliesTo;
26 import org.opensaml.ws.wspolicy.Policy;
27 import org.opensaml.ws.wspolicy.PolicyAttachment;
28 import org.opensaml.ws.wspolicy.PolicyReference;
29 import org.opensaml.xml.XMLObject;
30 import org.opensaml.xml.util.AttributeMap;
31 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
32
33
34
35
36 public class PolicyAttachmentImpl extends AbstractWSPolicyObject implements PolicyAttachment {
37
38
39 private AppliesTo appliesTo;
40
41
42 private IndexedXMLObjectChildrenList<XMLObject> policiesAndReferences;
43
44
45 private IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
46
47
48 private AttributeMap unknownAttributes;
49
50
51
52
53
54
55
56
57 public PolicyAttachmentImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
58 super(namespaceURI, elementLocalName, namespacePrefix);
59 policiesAndReferences = new IndexedXMLObjectChildrenList<XMLObject>(this);
60 unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
61 unknownAttributes = new AttributeMap(this);
62 }
63
64
65 public AppliesTo getAppliesTo() {
66 return appliesTo;
67 }
68
69
70 public void setAppliesTo(AppliesTo newAppliesTo) {
71 appliesTo = prepareForAssignment(appliesTo, newAppliesTo);
72 }
73
74
75 public List<Policy> getPolicies() {
76 return (List<Policy>) policiesAndReferences.subList(Policy.ELEMENT_NAME);
77 }
78
79
80 public List<PolicyReference> getPolicyReferences() {
81 return (List<PolicyReference>) policiesAndReferences.subList(PolicyReference.ELEMENT_NAME);
82 }
83
84
85 public List<XMLObject> getUnknownXMLObjects() {
86 return unknownChildren;
87 }
88
89
90 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
91 return (List<XMLObject>) unknownChildren.subList(typeOrName);
92 }
93
94
95 public AttributeMap getUnknownAttributes() {
96 return unknownAttributes;
97 }
98
99
100 public List<XMLObject> getOrderedChildren() {
101 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
102 if (appliesTo != null) {
103 children.add(appliesTo);
104 }
105 children.addAll(policiesAndReferences);
106 children.addAll(unknownChildren);
107 return Collections.unmodifiableList(children);
108 }
109
110 }