1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.opensaml.saml2.metadata.impl;
22
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
26
27 import org.joda.time.DateTime;
28 import org.opensaml.common.impl.AbstractSignableSAMLObject;
29 import org.opensaml.saml2.common.Extensions;
30 import org.opensaml.saml2.metadata.AffiliateMember;
31 import org.opensaml.saml2.metadata.AffiliationDescriptor;
32 import org.opensaml.saml2.metadata.KeyDescriptor;
33 import org.opensaml.xml.XMLObject;
34 import org.opensaml.xml.util.AttributeMap;
35 import org.opensaml.xml.util.XMLObjectChildrenList;
36
37
38
39
40 public class AffiliationDescriptorImpl extends AbstractSignableSAMLObject implements AffiliationDescriptor {
41
42
43 private String ownerID;
44
45
46 private String id;
47
48
49 private DateTime validUntil;
50
51
52 private Long cacheDuration;
53
54
55 private Extensions extensions;
56
57
58 private final AttributeMap unknownAttributes;
59
60
61 private final XMLObjectChildrenList<AffiliateMember> members;
62
63
64 private final XMLObjectChildrenList<KeyDescriptor> keyDescriptors;
65
66
67
68
69
70
71
72
73 protected AffiliationDescriptorImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
74 super(namespaceURI, elementLocalName, namespacePrefix);
75 unknownAttributes = new AttributeMap(this);
76 members = new XMLObjectChildrenList<AffiliateMember>(this);
77 keyDescriptors = new XMLObjectChildrenList<KeyDescriptor>(this);
78 }
79
80
81 public String getOwnerID() {
82 return ownerID;
83 }
84
85
86 public void setOwnerID(String newOwnerID) {
87 if (newOwnerID != null && newOwnerID.length() > 1024) {
88 throw new IllegalArgumentException("Owner ID can not exceed 1024 characters in length");
89 }
90 ownerID = prepareForAssignment(ownerID, newOwnerID);
91 }
92
93 public String getID() {
94 return id;
95 }
96
97 public void setID(String newID) {
98 String oldID = this.id;
99 this.id = prepareForAssignment(this.id, newID);
100 registerOwnID(oldID, this.id);
101 }
102
103
104 public boolean isValid() {
105 return validUntil.isBeforeNow();
106 }
107
108
109 public DateTime getValidUntil() {
110 return validUntil;
111 }
112
113
114 public void setValidUntil(DateTime validUntil) {
115 this.validUntil = prepareForAssignment(this.validUntil, validUntil);
116 }
117
118
119 public Long getCacheDuration() {
120 return cacheDuration;
121 }
122
123
124 public void setCacheDuration(Long duration) {
125 cacheDuration = prepareForAssignment(cacheDuration, duration);
126 }
127
128
129 public Extensions getExtensions() {
130 return extensions;
131 }
132
133
134 public void setExtensions(Extensions extensions) throws IllegalArgumentException {
135 this.extensions = prepareForAssignment(this.extensions, extensions);
136 }
137
138
139 public List<AffiliateMember> getMembers() {
140 return members;
141 }
142
143
144 public List<KeyDescriptor> getKeyDescriptors() {
145 return keyDescriptors;
146 }
147
148
149
150
151 public AttributeMap getUnknownAttributes() {
152 return unknownAttributes;
153 }
154
155
156 public String getSignatureReferenceID(){
157 return id;
158 }
159
160
161 public List<XMLObject> getOrderedChildren() {
162 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
163
164 if(getSignature() != null){
165 children.add(getSignature());
166 }
167
168 children.add(getExtensions());
169
170 children.addAll(getMembers());
171
172 children.addAll(getKeyDescriptors());
173
174 return Collections.unmodifiableList(children);
175 }
176 }