1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.ws.security.saml.ext.bean;
21
22
23 /**
24 * Class SamlAction represents the raw data required by the <code>AssertionWrapper</code> when
25 * creating the <code>Action</code> element of the SAML Authorization Decision Statement.
26 *
27 * Created on May 19, 2009
28 */
29 public class ActionBean {
30
31 /**
32 * A URI reference representing the namespace in which the name of the specified action is to be
33 * interpreted. If this element is absent, the namespace
34 * urn:oasis:names:tc:SAML:1.0:action:rwedcnegation specified in Section 7.2.2 is in effect.
35 */
36 private String actionNamespace;
37
38 /**
39 * An action sought to be performed on the specified resource (i.e. Read, Write, Update, Delete)
40 */
41 private String contents;
42
43 /**
44 * Constructor SamlAction creates a new SamlAction instance.
45 */
46 public ActionBean() {
47 }
48
49 /**
50 * Constructor SamlAction creates a new SamlAction instance.
51 *
52 * @param actionNamespace of type String
53 * @param contents of type String
54 */
55 public ActionBean(String actionNamespace, String contents) {
56 this.actionNamespace = actionNamespace;
57 this.contents = contents;
58 }
59
60 /**
61 * Method getActionNamespace returns the actionNamespace of this SamlAction object.
62 *
63 * @return the actionNamespace (type String) of this SamlAction object.
64 */
65 public String getActionNamespace() {
66 return actionNamespace;
67 }
68
69 /**
70 * Method setActionNamespace sets the actionNamespace of this SamlAction object.
71 *
72 * @param actionNamespace the actionNamespace of this SamlAction object.
73 */
74 public void setActionNamespace(String actionNamespace) {
75 this.actionNamespace = actionNamespace;
76 }
77
78 /**
79 * Method getContents returns the contents of this SamlAction object.
80 *
81 * @return the contents (type String) of this SamlAction object.
82 */
83 public String getContents() {
84 return contents;
85 }
86
87 /**
88 * Method setContents sets the contents of this SamlAction object.
89 *
90 * @param contents the contents of this SamlAction object.
91 */
92 public void setContents(String contents) {
93 this.contents = contents;
94 }
95
96 @Override
97 public boolean equals(Object o) {
98 if (this == o) return true;
99 if (!(o instanceof ActionBean)) return false;
100
101 ActionBean that = (ActionBean) o;
102
103 if (contents == null && that.contents != null) {
104 return false;
105 } else if (contents != null && !contents.equals(that.contents)) {
106 return false;
107 }
108
109 if (actionNamespace == null && that.actionNamespace != null) {
110 return false;
111 } else if (actionNamespace != null && !actionNamespace.equals(that.actionNamespace)) {
112 return false;
113 }
114
115 return true;
116 }
117
118 @Override
119 public int hashCode() {
120 int result = 0;
121 if (contents != null) {
122 result = 31 * result + contents.hashCode();
123 }
124 if (actionNamespace != null) {
125 result = 31 * result + actionNamespace.hashCode();
126 }
127 return result;
128 }
129 }