View Javadoc

1   /*
2   Copyright 2008 Members of the EGEE Collaboration.
3   Copyright 2008 University Corporation for Advanced Internet Development,
4   Inc.
5   
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9   
10      http://www.apache.org/licenses/LICENSE-2.0
11  
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17   */
18  
19  package org.opensaml.xacml.ctx.impl;
20  
21  import java.util.ArrayList;
22  import java.util.Collections;
23  import java.util.List;
24  
25  import org.opensaml.xacml.ctx.StatusCodeType;
26  import org.opensaml.xml.XMLObject;
27  import org.opensaml.xml.validation.AbstractValidatingXMLObject;
28  
29  /** Concrete implementation of {@link StatusCodeType}. */
30  public class StatusCodeTypeImpl extends AbstractValidatingXMLObject implements StatusCodeType {
31  
32      /** Sub status code. */
33      private StatusCodeType statusCode;
34  
35      /** The attribute Value. */
36      private String value;
37  
38      /**
39       * Constructor.
40       * 
41       * @param namespaceURI the namespace the element is in
42       * @param elementLocalName the local name of the XML element this Object represents
43       * @param namespacePrefix the prefix for the given namespace
44       */
45      protected StatusCodeTypeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
46          super(namespaceURI, elementLocalName, namespacePrefix);
47      }
48  
49      /** {@inheritDoc} */
50      public List<XMLObject> getOrderedChildren() {
51          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
52  
53          if (statusCode != null) {
54              children.add(statusCode);
55          }
56  
57          return Collections.unmodifiableList(children);
58      }
59  
60      /** {@inheritDoc} */
61      public StatusCodeType getStatusCode() {
62          return statusCode;
63      }
64  
65      /** {@inheritDoc} */
66      public String getValue() {
67          return value;
68      }
69  
70      /** {@inheritDoc} */
71      public void setStatusCode(StatusCodeType code) {
72          statusCode = prepareForAssignment(statusCode, code);
73      }
74  
75      /** {@inheritDoc} */
76      public void setValue(String newValue) {
77          this.value = prepareForAssignment(this.value, newValue);
78      }
79  
80  }