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.ArrayList;
24  import java.util.Collections;
25  import java.util.List;
26  
27  import org.opensaml.common.impl.AbstractSAMLObject;
28  import org.opensaml.saml2.core.Status;
29  import org.opensaml.saml2.core.StatusCode;
30  import org.opensaml.saml2.core.StatusDetail;
31  import org.opensaml.saml2.core.StatusMessage;
32  import org.opensaml.xml.XMLObject;
33  
34  /**
35   * Concrete implementation of {@link org.opensaml.saml2.core.Status}.
36   */
37  public class StatusImpl extends AbstractSAMLObject implements Status {
38  
39      /** StatusCode element. */
40      private StatusCode statusCode;
41  
42      /** StatusMessage element. */
43      private StatusMessage statusMessage;
44  
45      /** StatusDetail element. */
46      private StatusDetail statusDetail;
47  
48      /**
49       * Constructor.
50       * 
51       * @param namespaceURI namespace uri
52       * @param elementLocalName element name
53       * @param namespacePrefix namespace prefix
54       */
55      protected StatusImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
56          super(namespaceURI, elementLocalName, namespacePrefix);
57      }
58  
59      /** {@inheritDoc} */
60      public StatusCode getStatusCode() {
61          return this.statusCode;
62      }
63  
64      /** {@inheritDoc} */
65      public void setStatusCode(StatusCode newStatusCode) {
66          this.statusCode = prepareForAssignment(this.statusCode, newStatusCode);
67  
68      }
69  
70      /** {@inheritDoc} */
71      public StatusMessage getStatusMessage() {
72          return this.statusMessage;
73      }
74  
75      /** {@inheritDoc} */
76      public void setStatusMessage(StatusMessage newStatusMessage) {
77          this.statusMessage = prepareForAssignment(this.getStatusMessage(), newStatusMessage);
78      }
79  
80      /** {@inheritDoc} */
81      public StatusDetail getStatusDetail() {
82          return this.statusDetail;
83      }
84  
85      /** {@inheritDoc} */
86      public void setStatusDetail(StatusDetail newStatusDetail) {
87          this.statusDetail = prepareForAssignment(this.statusDetail, newStatusDetail);
88      }
89  
90      /** {@inheritDoc} */
91      public List<XMLObject> getOrderedChildren() {
92          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
93  
94          children.add(statusCode);
95          if (statusMessage != null) {
96              children.add(statusMessage);
97          }
98          if (statusDetail != null) {
99              children.add(statusDetail);
100         }
101         return Collections.unmodifiableList(children);
102     }
103 }