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.wsaddressing.impl;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.List;
22  
23  import org.opensaml.ws.wsaddressing.Action;
24  import org.opensaml.ws.wsaddressing.ProblemAction;
25  import org.opensaml.ws.wsaddressing.SoapAction;
26  import org.opensaml.xml.XMLObject;
27  import org.opensaml.xml.util.AttributeMap;
28  
29  /**
30   * Implementation of {@link ProblemAction}.
31   */
32  public class ProblemActionImpl extends AbstractWSAddressingObject implements ProblemAction {
33      
34      /** Action child element. */
35      private Action action;
36      
37      /** SoapAction child element. */
38      private SoapAction soapAction;
39      
40      /** Wildcard attributes. */
41      private AttributeMap unknownAttributes;
42  
43      /**
44       * Constructor.
45       * 
46       * @param namespaceURI The namespace of the element
47       * @param elementLocalName The local name of the element
48       * @param namespacePrefix The namespace prefix of the element
49       */
50      public ProblemActionImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
51          super(namespaceURI, elementLocalName, namespacePrefix);
52          unknownAttributes = new AttributeMap(this);
53      }
54  
55      /** {@inheritDoc} */
56      public Action getAction() {
57          return action;
58      }
59  
60      /** {@inheritDoc} */
61      public SoapAction getSoapAction() {
62          return soapAction;
63      }
64  
65      /** {@inheritDoc} */
66      public void setAction(Action newAction) {
67          action = prepareForAssignment(action, newAction);
68      }
69  
70      /** {@inheritDoc} */
71      public void setSoapAction(SoapAction newSoapAction) {
72          soapAction = prepareForAssignment(soapAction, newSoapAction);
73      }
74  
75      /** {@inheritDoc} */
76      public AttributeMap getUnknownAttributes() {
77          return unknownAttributes;
78      }
79  
80      /** {@inheritDoc} */
81      public List<XMLObject> getOrderedChildren() {
82          ArrayList<XMLObject> children = new ArrayList<XMLObject>();
83          if (action != null) {
84              children.add(action);
85          }
86          if (soapAction != null) {
87              children.add(soapAction);
88          }
89  
90          return Collections.unmodifiableList(children);
91      }
92  
93  }