1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.saml1.core.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.joda.time.DateTime;
26 import org.opensaml.common.impl.AbstractSAMLObject;
27 import org.opensaml.common.xml.SAMLConstants;
28 import org.opensaml.saml1.core.AudienceRestrictionCondition;
29 import org.opensaml.saml1.core.Condition;
30 import org.opensaml.saml1.core.Conditions;
31 import org.opensaml.saml1.core.DoNotCacheCondition;
32 import org.opensaml.xml.XMLObject;
33 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
34
35
36
37
38 public class ConditionsImpl extends AbstractSAMLObject implements Conditions {
39
40
41 private DateTime notBefore;
42
43
44 private DateTime notOnOrAfter;
45
46
47 private final IndexedXMLObjectChildrenList<Condition> conditions;
48
49
50
51
52
53
54
55
56 protected ConditionsImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
57 super(namespaceURI, elementLocalName, namespacePrefix);
58 conditions = new IndexedXMLObjectChildrenList<Condition>(this);
59 }
60
61
62 public DateTime getNotBefore() {
63 return notBefore;
64 }
65
66
67 public void setNotBefore(DateTime notBefore) {
68 this.notBefore = prepareForAssignment(this.notBefore, notBefore);
69 }
70
71
72 public DateTime getNotOnOrAfter() {
73 return notOnOrAfter;
74 }
75
76
77 public void setNotOnOrAfter(DateTime notOnOrAfter) {
78 this.notOnOrAfter = prepareForAssignment(this.notOnOrAfter, notOnOrAfter);
79 }
80
81
82 public List<Condition> getConditions() {
83 return conditions;
84 }
85
86
87 public List<Condition> getConditions(QName typeOrName) {
88 return conditions;
89 }
90
91
92 public List<AudienceRestrictionCondition> getAudienceRestrictionConditions() {
93 QName qname = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME);
94 return (List<AudienceRestrictionCondition>) conditions.subList(qname);
95 }
96
97
98 public List<DoNotCacheCondition> getDoNotCacheConditions() {
99 QName qname = new QName(SAMLConstants.SAML1_NS, DoNotCacheCondition.DEFAULT_ELEMENT_LOCAL_NAME);
100 return (List<DoNotCacheCondition>) conditions.subList(qname);
101 }
102
103
104 public List<XMLObject> getOrderedChildren() {
105 if (conditions.size() == 0) {
106 return null;
107 }
108 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
109 children.addAll(conditions);
110 return Collections.unmodifiableList(children);
111 }
112 }