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  package org.opensaml.saml2.core.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.opensaml.common.impl.AbstractSAMLObject;
24  import org.opensaml.saml2.core.BaseID;
25  import org.opensaml.saml2.core.EncryptedID;
26  import org.opensaml.saml2.core.NameID;
27  import org.opensaml.saml2.core.SubjectConfirmation;
28  import org.opensaml.saml2.core.SubjectConfirmationData;
29  import org.opensaml.xml.XMLObject;
30  
31  /**
32   * Concrete implementation of {@link org.opensaml.saml2.core.SubjectConfirmation}.
33   */
34  public class SubjectConfirmationImpl extends AbstractSAMLObject implements SubjectConfirmation {
35  
36      /** BaseID child element. */
37      private BaseID baseID;
38  
39      /** NameID child element. */
40      private NameID nameID;
41  
42      /** EncryptedID child element. */
43      private EncryptedID encryptedID;
44      
45      /** SubjectConfirmationData of the Confirmation. */
46      private SubjectConfirmationData subjectConfirmationData;
47  
48      /** Method of the Confirmation. */
49      private String method;
50  
51      /**
52       * Constructor.
53       * 
54       * @param namespaceURI the namespace the element is in
55       * @param elementLocalName the local name of the XML element this Object represents
56       * @param namespacePrefix the prefix for the given namespace
57       */
58      protected SubjectConfirmationImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
59          super(namespaceURI, elementLocalName, namespacePrefix);
60      }
61  
62      /** {@inheritDoc} */
63      public BaseID getBaseID() {
64          return baseID;
65      }
66  
67      /** {@inheritDoc} */
68      public void setBaseID(BaseID newBaseID) {
69          baseID = prepareForAssignment(baseID, newBaseID);
70      }
71  
72      /** {@inheritDoc} */
73      public NameID getNameID() {
74          return nameID;
75      }
76  
77      /** {@inheritDoc} */
78      public void setNameID(NameID newNameID) {
79          nameID = prepareForAssignment(nameID, newNameID);
80      }
81  
82      /** {@inheritDoc} */
83      public EncryptedID getEncryptedID() {
84          return this.encryptedID;
85      }
86  
87      /** {@inheritDoc} */
88      public void setEncryptedID(EncryptedID newEncryptedID) {
89          this.encryptedID = prepareForAssignment(this.encryptedID, newEncryptedID);
90      }
91  
92      /** {@inheritDoc} */
93      public SubjectConfirmationData getSubjectConfirmationData() {
94          return subjectConfirmationData;
95      }
96  
97      /** {@inheritDoc} */
98      public void setSubjectConfirmationData(SubjectConfirmationData newSubjectConfirmationData) {
99          this.subjectConfirmationData = prepareForAssignment(this.subjectConfirmationData, newSubjectConfirmationData);
100 
101     }
102 
103     /** {@inheritDoc} */
104     public String getMethod() {
105         return method;
106     }
107 
108     /** {@inheritDoc} */
109     public void setMethod(String newMethod) {
110         this.method = prepareForAssignment(this.method, newMethod);
111     }
112 
113     /** {@inheritDoc} */
114     public List<XMLObject> getOrderedChildren() {
115         ArrayList<XMLObject> children = new ArrayList<XMLObject>();
116 
117         if (baseID != null) {
118             children.add(baseID);
119         }
120 
121         if (nameID != null) {
122             children.add(nameID);
123         }
124         
125         if (encryptedID != null) {
126             children.add(encryptedID);
127         }
128 
129         children.add(subjectConfirmationData);
130 
131         return Collections.unmodifiableList(children);
132     }
133 }