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.List;
24  
25  import org.opensaml.common.impl.AbstractSAMLObject;
26  import org.opensaml.saml2.core.NameIDPolicy;
27  import org.opensaml.xml.XMLObject;
28  import org.opensaml.xml.schema.XSBooleanValue;
29  
30  /**
31   * Concrete implementation of {@link org.opensaml.saml2.core.NameIDPolicy}.
32   */
33  public class NameIDPolicyImpl extends AbstractSAMLObject implements NameIDPolicy {
34  
35      /** NameID Format URI. */
36      private String format;
37  
38      /** NameID Format URI. */
39      private String spNameQualifier;
40  
41      /** NameID Format URI. */
42      private XSBooleanValue allowCreate;
43  
44      /**
45       * Constructor.
46       * 
47       * @param namespaceURI the namespace the element is in
48       * @param elementLocalName the local name of the XML element this Object represents
49       * @param namespacePrefix the prefix for the given namespace
50       */
51      protected NameIDPolicyImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
52          super(namespaceURI, elementLocalName, namespacePrefix);
53      }
54  
55      /** {@inheritDoc} */
56      public String getFormat() {
57          return format;
58      }
59  
60      /** {@inheritDoc} */
61      public void setFormat(String newFormat) {
62          format = prepareForAssignment(format, newFormat);
63  
64      }
65  
66      /** {@inheritDoc} */
67      public String getSPNameQualifier() {
68          return spNameQualifier;
69      }
70  
71      /** {@inheritDoc} */
72      public void setSPNameQualifier(String newSPNameQualifier) {
73          spNameQualifier = prepareForAssignment(spNameQualifier, newSPNameQualifier);
74  
75      }
76      
77      /** {@inheritDoc} */
78      public Boolean getAllowCreate(){
79          if(allowCreate != null){
80              return allowCreate.getValue();
81          }
82          
83          return Boolean.FALSE;
84      }
85  
86      /** {@inheritDoc} */
87      public XSBooleanValue getAllowCreateXSBoolean() {
88          return allowCreate;
89      }
90  
91      /** {@inheritDoc} */
92      public void setAllowCreate(Boolean newAllowCreate){
93          if(newAllowCreate != null){
94              allowCreate = prepareForAssignment(allowCreate, new XSBooleanValue(newAllowCreate, false));
95          }else{
96              allowCreate = prepareForAssignment(allowCreate, null);
97          }
98      }
99      
100     /** {@inheritDoc} */
101     public void setAllowCreate(XSBooleanValue newAllowCreate) {
102         allowCreate = prepareForAssignment(allowCreate, newAllowCreate);
103 
104     }
105 
106     /** {@inheritDoc} */
107     public List<XMLObject> getOrderedChildren() {
108         // no children
109         return null;
110     }
111 }