1 package org.apache.archiva.redback.rbac.memory;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import org.apache.archiva.redback.rbac.Operation;
23
24 /**
25 * MemoryOperation
26 *
27 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
28 *
29 */
30 public class MemoryOperation
31 implements Operation, java.io.Serializable
32 {
33
34 /**
35 * Field name
36 */
37 private String name;
38
39 /**
40 * Field description
41 */
42 private String description;
43
44 /**
45 * Field resourceRequired
46 */
47 private boolean resourceRequired = false;
48
49 /**
50 * Field permanent
51 */
52 private boolean permanent = false;
53
54 /**
55 * Method equals
56 *
57 * @param other
58 */
59 public boolean equals( Object other )
60 {
61 if ( this == other )
62 {
63 return true;
64 }
65
66 if ( !( other instanceof MemoryOperation ) )
67 {
68 return false;
69 }
70
71 MemoryOperation that = (MemoryOperation) other;
72 boolean result = true;
73 result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
74 return result;
75 }
76
77 /**
78 * Get null
79 */
80 public String getDescription()
81 {
82 return this.description;
83 }
84
85 /**
86 * Get null
87 */
88 public String getName()
89 {
90 return this.name;
91 }
92
93 /**
94 * Method hashCode
95 */
96 public int hashCode()
97 {
98 int result = 17;
99 result = 37 * result + ( name != null ? name.hashCode() : 0 );
100 return result;
101 }
102
103 /**
104 * Get
105 * true if the resource is required for
106 * authorization to be granted
107 *
108 */
109 public boolean isResourceRequired()
110 {
111 return this.resourceRequired;
112 }
113
114 /**
115 * Set null
116 *
117 * @param description
118 */
119 public void setDescription( String description )
120 {
121 this.description = description;
122 }
123
124 /**
125 * Set null
126 *
127 * @param name
128 */
129 public void setName( String name )
130 {
131 this.name = name;
132 }
133
134 /**
135 * Set
136 * true if the resource is required for
137 * authorization to be granted
138 *
139 *
140 * @param resourceRequired
141 */
142 public void setResourceRequired( boolean resourceRequired )
143 {
144 this.resourceRequired = resourceRequired;
145 }
146
147 /**
148 * Method toString
149 */
150 public String toString()
151 {
152 StringBuilder buf = new StringBuilder();
153 buf.append( "name = '" );
154 buf.append( getName() + "'" );
155 return buf.toString();
156 }
157
158 public boolean isPermanent()
159 {
160 return permanent;
161 }
162
163 public void setPermanent( boolean permanent )
164 {
165 this.permanent = permanent;
166 }
167 }