View Javadoc

1   /*
2    * Copyright 2008 Members of the EGEE Collaboration.
3    * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
4    *
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.opensaml.ws.wstrust.impl;
19  
20  import java.util.List;
21  
22  import org.opensaml.ws.wstrust.Renewing;
23  import org.opensaml.xml.XMLObject;
24  import org.opensaml.xml.schema.XSBooleanValue;
25  
26  /**
27   * RenewingImpl.
28   * 
29   */
30  public class RenewingImpl extends AbstractWSTrustObject implements Renewing {
31      
32      /** The Allow attribute value. */
33      private XSBooleanValue allow;
34      
35      /** The OK attribute value. */
36      private XSBooleanValue ok;
37  
38      /**
39       * Constructor.
40       * 
41       * @param namespaceURI The namespace of the element
42       * @param elementLocalName The local name of the element
43       * @param namespacePrefix The namespace prefix of the element
44       */
45      public RenewingImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
46          super(namespaceURI, elementLocalName, namespacePrefix);
47      }
48  
49      /** {@inheritDoc} */
50      public Boolean isAllow() {
51          if (allow != null) {
52              return allow.getValue();
53          }
54  
55          // Note: Default is true here, rather than the more common default of false.
56          return Boolean.TRUE;
57      }
58  
59      /** {@inheritDoc} */
60      public XSBooleanValue isAllowXSBoolean() {
61          return allow;
62      }
63  
64      /** {@inheritDoc} */
65      public void setAllow(Boolean newAllow) {
66          if (newAllow != null) {
67              allow = prepareForAssignment(allow, new XSBooleanValue(newAllow, false));
68          } else {
69              allow = prepareForAssignment(allow, null);
70          }        
71      }
72  
73      /** {@inheritDoc} */
74      public void setAllow(XSBooleanValue newAllow) {
75          allow = prepareForAssignment(allow, newAllow);
76      }
77  
78      /** {@inheritDoc} */
79      public Boolean isOK() {
80          if (ok != null) {
81              return ok.getValue();
82          }
83  
84          // Default is false.
85          return Boolean.FALSE;
86      }
87  
88      /** {@inheritDoc} */
89      public XSBooleanValue isOKXSBoolean() {
90          return ok;
91      }
92  
93      /** {@inheritDoc} */
94      public void setOK(Boolean newOK) {
95          if (newOK != null) {
96              ok = prepareForAssignment(ok, new XSBooleanValue(newOK, false));
97          } else {
98              ok = prepareForAssignment(ok, null);
99          }        
100     }
101 
102     /** {@inheritDoc} */
103     public void setOK(XSBooleanValue newOK) {
104         ok = prepareForAssignment(ok, newOK);
105     }
106 
107     /** {@inheritDoc} */
108     public List<XMLObject> getOrderedChildren() {
109         return null;
110     }
111 
112 }