View Javadoc

1   /*
2    * Copyright [2005] [University Corporation for Advanced Internet Development, Inc.]
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  /**
18   * 
19   */
20  
21  package org.opensaml.saml2.core.impl;
22  
23  import java.util.Collections;
24  import java.util.List;
25  
26  import javax.xml.namespace.QName;
27  
28  import org.joda.time.DateTime;
29  import org.opensaml.common.impl.AbstractSAMLObject;
30  import org.opensaml.saml2.core.SubjectConfirmationData;
31  import org.opensaml.xml.XMLObject;
32  import org.opensaml.xml.util.AttributeMap;
33  import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
34  
35  /**
36   * Concrete implementation of {@link org.opensaml.saml2.core.SubjectConfirmationData}.
37   */
38  public class SubjectConfirmationDataImpl extends AbstractSAMLObject implements SubjectConfirmationData {
39  
40      /** NotBefore of the Confirmation Data. */
41      private DateTime notBefore;
42  
43      /** NotOnOrAfter of the Confirmation Data. */
44      private DateTime notOnOrAfter;
45  
46      /** Recipient of the Confirmation Data. */
47      private String recipient;
48  
49      /** InResponseTo of the Confirmation Data. */
50      private String inResponseTo;
51  
52      /** Address of the Confirmation Data. */
53      private String address;
54      
55      /** "anyAttribute" attributes. */
56      private final AttributeMap unknownAttributes;
57      
58      /** "any" children. */
59      private final IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
60  
61      /**
62       * Constructor.
63       * 
64       * @param namespaceURI the namespace the element is in
65       * @param elementLocalName the local name of the XML element this Object represents
66       * @param namespacePrefix the prefix for the given namespace
67       */
68      protected SubjectConfirmationDataImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
69          super(namespaceURI, elementLocalName, namespacePrefix);
70          unknownAttributes = new AttributeMap(this);
71          unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
72      }
73  
74      /** {@inheritDoc} */
75      public DateTime getNotBefore() {
76          return notBefore;
77      }
78  
79      /** {@inheritDoc} */
80      public void setNotBefore(DateTime newNotBefore) {
81          this.notBefore = prepareForAssignment(this.notBefore, newNotBefore);
82      }
83  
84      /** {@inheritDoc} */
85      public DateTime getNotOnOrAfter() {
86          return notOnOrAfter;
87      }
88  
89      /** {@inheritDoc} */
90      public void setNotOnOrAfter(DateTime newNotOnOrAfter) {
91          this.notOnOrAfter = prepareForAssignment(this.notOnOrAfter, newNotOnOrAfter);
92      }
93  
94      /** {@inheritDoc} */
95      public String getRecipient() {
96          return recipient;
97      }
98  
99      /** {@inheritDoc} */
100     public void setRecipient(String newRecipient) {
101         this.recipient = prepareForAssignment(this.recipient, newRecipient);
102     }
103 
104     /** {@inheritDoc} */
105     public String getInResponseTo() {
106         return inResponseTo;
107     }
108 
109     /** {@inheritDoc} */
110     public void setInResponseTo(String newInResponseTo) {
111         this.inResponseTo = prepareForAssignment(this.inResponseTo, newInResponseTo);
112     }
113 
114     /** {@inheritDoc} */
115     public String getAddress() {
116         return address;
117     }
118 
119     /** {@inheritDoc} */
120     public void setAddress(String newAddress) {
121         this.address = prepareForAssignment(this.address, newAddress);
122     }
123     
124     /**
125      * {@inheritDoc}
126      */
127     public AttributeMap getUnknownAttributes() {
128         return unknownAttributes;
129     }
130     
131     /**
132      * {@inheritDoc}
133      */
134     public List<XMLObject> getUnknownXMLObjects() {
135         return unknownChildren;
136     }
137     
138     /** {@inheritDoc} */
139     public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
140         return (List<XMLObject>) unknownChildren.subList(typeOrName);
141     }
142 
143     /** {@inheritDoc} */
144     public List<XMLObject> getOrderedChildren() {
145         return Collections.unmodifiableList(unknownChildren);
146     }
147 }