View Javadoc

1   /*
2    * Copyright [2006] [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.xml.encryption.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.opensaml.xml.XMLObject;
24  import org.opensaml.xml.encryption.Transforms;
25  import org.opensaml.xml.signature.Transform;
26  import org.opensaml.xml.util.XMLObjectChildrenList;
27  import org.opensaml.xml.validation.AbstractValidatingXMLObject;
28  
29  /**
30   * Concrete implementation of {@link org.opensaml.xml.encryption.Transforms}
31   */
32  public class TransformsImpl extends AbstractValidatingXMLObject implements Transforms {
33      
34      private final XMLObjectChildrenList transforms;
35  
36      /**
37       * Constructor
38       *
39       * @param namespaceURI
40       * @param elementLocalName
41       * @param namespacePrefix
42       */
43      protected TransformsImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
44          super(namespaceURI, elementLocalName, namespacePrefix);
45          transforms = new XMLObjectChildrenList<Transform>(this);
46      }
47  
48      /** {@inheritDoc} */
49      public List<Transform> getTransforms() {
50          return (List<Transform>) this.transforms;
51      }
52  
53      /** {@inheritDoc} */
54      public List<XMLObject> getOrderedChildren() {
55          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
56          
57          children.addAll((List<Transform>) transforms);
58          
59          if (children.size() == 0) {
60              return null;
61          }
62          
63          return Collections.unmodifiableList(children);
64      }
65  
66  }