View Javadoc

1   /*
2    * Copyright [2005] [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  /**
18   * 
19   */
20  
21  package org.opensaml.saml2.metadata.impl;
22  
23  import java.util.ArrayList;
24  import java.util.List;
25  
26  import org.opensaml.common.impl.AbstractSAMLObject;
27  import org.opensaml.saml2.common.Extensions;
28  import org.opensaml.saml2.metadata.Organization;
29  import org.opensaml.saml2.metadata.OrganizationDisplayName;
30  import org.opensaml.saml2.metadata.OrganizationName;
31  import org.opensaml.saml2.metadata.OrganizationURL;
32  import org.opensaml.xml.XMLObject;
33  import org.opensaml.xml.util.AttributeMap;
34  import org.opensaml.xml.util.XMLObjectChildrenList;
35  
36  /**
37   * Concrete implementation of {@link org.opensaml.saml2.metadata.Organization}
38   */
39  public class OrganizationImpl extends AbstractSAMLObject implements Organization {
40  
41      /** element extensions */
42      private Extensions extensions;
43  
44      /** OrganizationName children */
45      private final XMLObjectChildrenList<OrganizationName> names;
46  
47      /** OrganizationDisplayName children */
48      private final XMLObjectChildrenList<OrganizationDisplayName> displayNames;
49  
50      /** OrganizationURL children */
51      private final XMLObjectChildrenList<OrganizationURL> urls;
52      
53      /** "anyAttribute" attributes */
54      private final AttributeMap unknownAttributes;
55  
56      /**
57       * Constructor
58       * 
59       * @param namespaceURI
60       * @param elementLocalName
61       * @param namespacePrefix
62       */
63      protected OrganizationImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
64          super(namespaceURI, elementLocalName, namespacePrefix);
65          names = new XMLObjectChildrenList<OrganizationName>(this);
66          displayNames = new XMLObjectChildrenList<OrganizationDisplayName>(this);
67          urls = new XMLObjectChildrenList<OrganizationURL>(this);
68          unknownAttributes = new AttributeMap(this);
69      }
70  
71      /** {@inheritDoc} */
72      public Extensions getExtensions() {
73          return extensions;
74      }
75  
76      /** {@inheritDoc} */
77      public void setExtensions(Extensions extensions) throws IllegalArgumentException {
78          this.extensions = prepareForAssignment(this.extensions, extensions);
79      }
80  
81      /** {@inheritDoc} */
82      public List<OrganizationName> getOrganizationNames() {
83          return names;
84      }
85  
86      /** {@inheritDoc} */
87      public List<OrganizationDisplayName> getDisplayNames() {
88          return displayNames;
89      }
90  
91      /** {@inheritDoc} */
92      public List<OrganizationURL> getURLs() {
93          return urls;
94      }
95      
96      /**
97       * {@inheritDoc}
98       */
99      public AttributeMap getUnknownAttributes() {
100         return unknownAttributes;
101     }
102 
103     /** {@inheritDoc} */
104     public List<XMLObject> getOrderedChildren() {
105         ArrayList<XMLObject> children = new ArrayList<XMLObject>();
106 
107         children.add(extensions);
108         children.addAll(names);
109         children.addAll(displayNames);
110         children.addAll(urls);
111 
112         return children;
113     }
114 }