View Javadoc

1   /*
2    * Copyright [2006] [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.samlext.saml2mdquery.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.opensaml.saml2.metadata.NameIDFormat;
24  import org.opensaml.saml2.metadata.impl.RoleDescriptorImpl;
25  import org.opensaml.samlext.saml2mdquery.QueryDescriptorType;
26  import org.opensaml.xml.XMLObject;
27  import org.opensaml.xml.schema.XSBooleanValue;
28  import org.opensaml.xml.util.XMLObjectChildrenList;
29  
30  /**
31   * Concrete implementation of {@link QueryDescriptorType}.
32   */
33  public abstract class QueryDescriptorTypeImpl extends RoleDescriptorImpl implements QueryDescriptorType {
34  
35      /** WantAssertionSigned attribute value. */
36      private XSBooleanValue wantAssertionsSigned;
37      
38      /** Supported NameID formats. */
39      private XMLObjectChildrenList<NameIDFormat> nameIDFormats;
40      
41      /**
42       * Constructor.
43       * 
44       * @param namespaceURI the namespace the element is in
45       * @param elementLocalName the local name of the XML element this Object represents
46       * @param namespacePrefix the prefix for the given namespace
47       */
48      protected QueryDescriptorTypeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
49          super(namespaceURI, elementLocalName, namespacePrefix);
50          
51          nameIDFormats = new XMLObjectChildrenList<NameIDFormat>(this);
52      }
53      
54      /** {@inheritDoc} */
55      public Boolean getWantAssertionsSigned() {
56          if (wantAssertionsSigned != null) {
57              return wantAssertionsSigned.getValue();
58          }
59          return Boolean.FALSE;
60      }
61  
62      /** {@inheritDoc} */
63      public void setWantAssertionsSigned(Boolean newWantAssertionsSigned) {
64          if (newWantAssertionsSigned != null) {
65              wantAssertionsSigned = prepareForAssignment(wantAssertionsSigned, 
66                      new XSBooleanValue(newWantAssertionsSigned, false));
67          } else {
68              wantAssertionsSigned = prepareForAssignment(wantAssertionsSigned, null);
69          }
70      }
71  
72      /** {@inheritDoc} */
73      public XSBooleanValue getWantAssertionsSignedXSBoolean(){
74          return wantAssertionsSigned;
75      }
76      
77      /** {@inheritDoc} */
78      public void setWantAssertionsSigned(XSBooleanValue wantAssertionSigned){
79          this.wantAssertionsSigned = prepareForAssignment(this.wantAssertionsSigned, wantAssertionSigned);
80      }
81      
82      /** {@inheritDoc} */
83      public List<NameIDFormat> getNameIDFormat(){
84          return nameIDFormats;
85      }
86      
87      /** {@inheritDoc} */
88      public List<XMLObject> getOrderedChildren() {
89          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
90          
91          children.addAll(nameIDFormats);
92          
93          return Collections.unmodifiableList(children);
94      }
95  }