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.profile.saml.impl;
20  
21  import java.util.ArrayList;
22  import java.util.Collections;
23  import java.util.List;
24  
25  import org.opensaml.common.impl.AbstractSAMLObject;
26  import org.opensaml.xacml.ctx.RequestType;
27  import org.opensaml.xacml.ctx.ResponseType;
28  import org.opensaml.xacml.profile.saml.XACMLAuthzDecisionStatementType;
29  import org.opensaml.xml.XMLObject;
30  
31  /** A concrete implementation of {@link org.opensaml.xacml.profile.saml.XACMLAuthzDecisionStatementType}. */
32  public class XACMLAuthzDecisionStatementTypeImpl extends AbstractSAMLObject implements XACMLAuthzDecisionStatementType {
33  
34      /** The request of the authorization request. */
35      private RequestType request;
36  
37      /** The response of the authorization request. */
38      private ResponseType response;
39  
40      /**
41       * Constructor.
42       * 
43       * @param namespaceURI the namespace the element is in
44       * @param elementLocalName the local name of the XML element this Object represents
45       * @param namespacePrefix the prefix for the given namespace
46       */
47      protected XACMLAuthzDecisionStatementTypeImpl(String namespaceURI, String elementLocalName,
48              String namespacePrefix) {
49          super(namespaceURI, elementLocalName, namespacePrefix);
50      }
51  
52      /** {@inheritDoc} */
53      public RequestType getRequest() {
54          return request;
55      }
56  
57      /** {@inheritDoc} */
58      public ResponseType getResponse() {
59          return response;
60      }
61  
62      /** {@inheritDoc} */
63      public void setRequest(RequestType request) {
64          this.request = prepareForAssignment(this.request, request);
65      }
66  
67      /** {@inheritDoc} */
68      public void setResponse(ResponseType response) {
69          this.response = prepareForAssignment(this.response, response);
70      }
71  
72      /** {@inheritDoc} */
73      public List<XMLObject> getOrderedChildren() {
74          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
75  
76          if (request != null) {
77              children.add(request);
78          }
79          if (response != null) {
80              children.add(response);
81          }
82  
83          return Collections.unmodifiableList(children);
84      }
85  }