View Javadoc

1   /*
2    * Copyright 2009 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.ecp.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.IDPList;
25  import org.opensaml.saml2.core.Issuer;
26  import org.opensaml.saml2.ecp.Request;
27  import org.opensaml.xml.XMLObject;
28  import org.opensaml.xml.schema.XSBooleanValue;
29  
30  /**
31   *  A concrete implementation of {@link Request}.
32   */
33  public class RequestImpl extends AbstractSAMLObject implements Request {
34      
35      /** IDPList child element. */
36      private IDPList idpList;
37      
38      /** Issuer child element. */
39      private Issuer issuer;
40      
41      /** ProviderName attribute. */
42      private String providerName;
43      
44      /** IsPassive attribute value. */
45      private XSBooleanValue isPassive;
46      
47      /** soap11:actor attribute. */
48      private String soap11Actor;
49      
50      /** soap11:mustUnderstand. */
51      private XSBooleanValue soap11MustUnderstand;
52      
53      /**
54       * Constructor.
55       * 
56       * @param namespaceURI the namespace the element is in
57       * @param elementLocalName the local name of the XML element this Object represents
58       * @param namespacePrefix the prefix for the given namespace
59       */
60      protected RequestImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
61          super(namespaceURI, elementLocalName, namespacePrefix);
62      }
63  
64      /** {@inheritDoc} */
65      public IDPList getIDPList() {
66          return idpList;
67      }
68      
69      /** {@inheritDoc} */
70      public void setIDPList(IDPList newIDPList) {
71          idpList = prepareForAssignment(idpList, newIDPList);
72      }
73  
74      /** {@inheritDoc} */
75      public Issuer getIssuer() {
76          return issuer;
77      }
78      
79      /** {@inheritDoc} */
80      public void setIssuer(Issuer newIssuer) {
81          issuer = prepareForAssignment(issuer, newIssuer);
82      }
83  
84      /** {@inheritDoc} */
85      public String getProviderName() {
86          return providerName;
87      }
88  
89      /** {@inheritDoc} */
90      public void setProviderName(String newProviderName) {
91          providerName = prepareForAssignment(providerName, newProviderName);
92      }
93  
94      /** {@inheritDoc} */
95      public Boolean isPassive() {
96          if (isPassive != null) {
97              return isPassive.getValue();
98          }
99  
100         return Boolean.FALSE;
101     }
102 
103     /** {@inheritDoc} */
104     public XSBooleanValue isPassiveXSBoolean() {
105         return isPassive;
106     }
107 
108     /** {@inheritDoc} */
109     public void setPassive(Boolean newIsPassive) {
110         if (newIsPassive != null) {
111             isPassive = prepareForAssignment(isPassive, new XSBooleanValue(newIsPassive, false));
112         } else {
113             isPassive = prepareForAssignment(isPassive, null);
114         }
115     }
116 
117     /** {@inheritDoc} */
118     public void setPassive(XSBooleanValue newIsPassive) {
119         this.isPassive = prepareForAssignment(this.isPassive, newIsPassive);
120     }
121     
122     /** {@inheritDoc} */
123     public Boolean isSOAP11MustUnderstand() {
124         if (soap11MustUnderstand != null) {
125             return soap11MustUnderstand.getValue();
126         }
127         return Boolean.FALSE;
128     }
129 
130     /** {@inheritDoc} */
131     public XSBooleanValue isSOAP11MustUnderstandXSBoolean() {
132         return soap11MustUnderstand;
133     }
134 
135     /** {@inheritDoc} */
136     public void setSOAP11MustUnderstand(Boolean newMustUnderstand) {
137         if (newMustUnderstand != null) {
138             soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, 
139                     new XSBooleanValue(newMustUnderstand, true));
140         } else {
141             soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, null);
142         }
143     }
144 
145     /** {@inheritDoc} */
146     public void setSOAP11MustUnderstand(XSBooleanValue newMustUnderstand) {
147             soap11MustUnderstand = prepareForAssignment(soap11MustUnderstand, newMustUnderstand);
148     }
149 
150     /** {@inheritDoc} */
151     public String getSOAP11Actor() {
152         return soap11Actor;
153     }
154 
155     /** {@inheritDoc} */
156     public void setSOAP11Actor(String newActor) {
157         soap11Actor = prepareForAssignment(soap11Actor, newActor);
158     }
159 
160     /** {@inheritDoc} */
161     public List<XMLObject> getOrderedChildren() {
162         ArrayList<XMLObject> children = new ArrayList<XMLObject>();
163         if (issuer!=null) {
164             children.add(issuer);
165         }
166         if (idpList!=null) {
167             children.add(idpList);
168         }
169         return Collections.unmodifiableList(children);
170     }
171 
172 }