View Javadoc

1   /*
2    * Copyright 2009 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  package org.opensaml.ws.wspolicy.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import javax.xml.namespace.QName;
24  
25  import org.opensaml.ws.wspolicy.All;
26  import org.opensaml.ws.wspolicy.ExactlyOne;
27  import org.opensaml.ws.wspolicy.OperatorContentType;
28  import org.opensaml.ws.wspolicy.Policy;
29  import org.opensaml.ws.wspolicy.PolicyReference;
30  import org.opensaml.xml.XMLObject;
31  import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
32  
33  /**
34   * OperatorContentTypeImpl.
35   */
36  public class OperatorContentTypeImpl extends AbstractWSPolicyObject implements OperatorContentType {
37      
38      /** All child elements. */
39      private IndexedXMLObjectChildrenList<XMLObject> xmlObjects;
40  
41      /**
42       * Constructor.
43       *
44       * @param namespaceURI The namespace of the element
45       * @param elementLocalName The local name of the element
46       * @param namespacePrefix The namespace prefix of the element
47       */
48      public OperatorContentTypeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
49          super(namespaceURI, elementLocalName, namespacePrefix);
50          xmlObjects = new IndexedXMLObjectChildrenList<XMLObject>(this);
51      }
52  
53      /** {@inheritDoc} */
54      public List<All> getAlls() {
55          return (List<All>) xmlObjects.subList(All.ELEMENT_NAME);
56      }
57  
58      /** {@inheritDoc} */
59      public List<ExactlyOne> getExactlyOnes() {
60          return (List<ExactlyOne>) xmlObjects.subList(ExactlyOne.ELEMENT_NAME);
61      }
62  
63      /** {@inheritDoc} */
64      public List<Policy> getPolicies() {
65          return (List<Policy>) xmlObjects.subList(Policy.ELEMENT_NAME);
66      }
67  
68      /** {@inheritDoc} */
69      public List<PolicyReference> getPolicyReferences() {
70          return (List<PolicyReference>) xmlObjects.subList(PolicyReference.ELEMENT_NAME);
71      }
72  
73      /** {@inheritDoc} */
74      public List<XMLObject> getXMLObjects() {
75          return xmlObjects;
76      }
77  
78      /** {@inheritDoc} */
79      public List<XMLObject> getXMLObjects(QName typeOrName) {
80          return (List<XMLObject>) xmlObjects.subList(typeOrName);
81      }
82  
83      /** {@inheritDoc} */
84      public List<XMLObject> getOrderedChildren() {
85          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
86          children.addAll(xmlObjects);
87          return Collections.unmodifiableList(children);
88      }
89  
90  }