View Javadoc

1   /*
2    * Copyright 2008 University Corporation for Advanced Internet Development, Inc.
3    * Copyright 2008 Members of the EGEE Collaboration.
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.xacml.policy.impl;
19  
20  import java.util.List;
21  
22  import org.opensaml.xacml.policy.AttributeSelectorType;
23  import org.opensaml.xml.XMLObject;
24  import org.opensaml.xml.schema.XSBooleanValue;
25  import org.opensaml.xml.util.LazyList;
26  import org.opensaml.xml.validation.AbstractValidatingXMLObject;
27  
28  /**
29   * Implementation {@link AttributeSelectorType}.
30   */
31  public class AttributeSelectorTypeImpl extends AbstractValidatingXMLObject
32  	implements AttributeSelectorType {
33  
34      /** Datatype. */
35      private String dataType;
36  
37      /** Issuer. */
38      private String requestContextPath;
39  
40      /** Must be present.Default = false */
41      private XSBooleanValue mustBePresentXS = null;
42  
43      /**
44       * Constructor.
45       * 
46       * @param namespaceURI
47       *                the namespace the element is in
48       * @param elementLocalName
49       *                the local name of the XML element this Object represents
50       * @param namespacePrefix
51       *                the prefix for the given namespace
52       */
53      protected AttributeSelectorTypeImpl(String namespaceURI,
54  	    String elementLocalName, String namespacePrefix) {
55  	super(namespaceURI, elementLocalName, namespacePrefix);
56  	mustBePresentXS = XSBooleanValue.valueOf("false");
57      }
58  
59      /** {@inheritDoc} */
60      public String getDataType() {
61  	return dataType;
62      }
63  
64      /** {@inheritDoc} */
65      public Boolean getMustBePresent() {
66  	if (mustBePresentXS != null) {
67  	    return mustBePresentXS.getValue();
68  	}
69  	return Boolean.FALSE;
70      }
71  
72      /** {@inheritDoc} */
73      public XSBooleanValue getMustBePresentXSBoolean() {
74  	return mustBePresentXS;
75      }
76  
77      /** {@inheritDoc} */
78      public String getRequestContextPath() {
79  	return requestContextPath;
80      }
81  
82      /** {@inheritDoc} */
83      public void setDataType(String type) {
84  	this.dataType = prepareForAssignment(this.dataType, type);
85      }
86  
87      /** {@inheritDoc} */
88      public void setMustBePresentXSBoolean(XSBooleanValue present) {
89  	mustBePresentXS = prepareForAssignment(this.mustBePresentXS, present);
90      }
91  
92      /** {@inheritDoc} */
93      public void setMustBePresent(Boolean present) {
94  	if (present != null) {
95  	    mustBePresentXS = prepareForAssignment(mustBePresentXS,
96  		    new XSBooleanValue(present, false));
97  	} else {
98  	    mustBePresentXS = prepareForAssignment(mustBePresentXS, null);
99  	}
100     }
101 
102     /** {@inheritDoc} */
103     public void setRequestContextPath(String path) {
104 	requestContextPath = prepareForAssignment(this.requestContextPath, path);
105     }
106 
107     /** {@inheritDoc} */
108     public List<XMLObject> getOrderedChildren() {
109         return new LazyList<XMLObject>();
110     }
111 
112 }