This project has retired. For details please refer to its
Attic page.
MemoryRole xref
1 package org.apache.archiva.redback.rbac.memory;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.archiva.redback.rbac.AbstractRole;
23 import org.apache.archiva.redback.rbac.Permission;
24 import org.apache.archiva.redback.rbac.Role;
25
26 import java.util.ArrayList;
27 import java.util.List;
28
29
30
31
32
33
34
35 public class MemoryRole
36 extends AbstractRole
37 implements Role, java.io.Serializable
38 {
39
40
41
42
43 private String name;
44
45
46
47
48 private String description;
49
50
51
52
53 private boolean assignable = false;
54
55
56
57
58 private List<String> childRoleNames = new ArrayList<String>( 0 );
59
60
61
62
63 private List<Permission> permissions = new ArrayList<Permission>( 0 );
64
65
66
67
68 private boolean permanent = false;
69
70
71
72
73
74
75 public void addPermission( Permission memoryPermission )
76 {
77 if ( !( memoryPermission instanceof MemoryPermission ) )
78 {
79 throw new ClassCastException( "MemoryRole.addPermissions(memoryPermission) parameter must be instanceof "
80 + MemoryPermission.class.getName() );
81 }
82 getPermissions().add( memoryPermission );
83 }
84
85
86
87
88
89
90 public boolean equals( Object other )
91 {
92 if ( this == other )
93 {
94 return true;
95 }
96
97 if ( !( other instanceof MemoryRole ) )
98 {
99 return false;
100 }
101
102 MemoryRole that = (MemoryRole) other;
103 boolean result = true;
104 result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
105 return result;
106 }
107
108
109
110
111 public List<String> getChildRoleNames()
112 {
113 return this.childRoleNames;
114 }
115
116
117
118
119 public String getDescription()
120 {
121 return this.description;
122 }
123
124
125
126
127 public String getName()
128 {
129 return this.name;
130 }
131
132
133
134
135 public List<Permission> getPermissions()
136 {
137 return this.permissions;
138 }
139
140
141
142
143 public int hashCode()
144 {
145 int result = 17;
146 result = 37 * result + ( name != null ? name.hashCode() : 0 );
147 return result;
148 }
149
150
151
152
153
154
155 public boolean isAssignable()
156 {
157 return this.assignable;
158 }
159
160
161
162
163
164
165 public void removePermission( Permission memoryPermission )
166 {
167 if ( !( memoryPermission instanceof MemoryPermission ) )
168 {
169 throw new ClassCastException( "MemoryRole.removePermissions(memoryPermission) parameter must be instanceof "
170 + MemoryPermission.class.getName() );
171 }
172 getPermissions().remove( memoryPermission );
173 }
174
175
176
177
178
179
180
181
182 public void setAssignable( boolean assignable )
183 {
184 this.assignable = assignable;
185 }
186
187
188
189
190
191
192 public void setDescription( String description )
193 {
194 this.description = description;
195 }
196
197
198
199
200
201
202 public void setName( String name )
203 {
204 this.name = name;
205 }
206
207
208
209
210
211
212 public void setPermissions( List<Permission> permissions )
213 {
214 this.permissions = permissions;
215 }
216
217
218
219
220 public java.lang.String toString()
221 {
222 StringBuilder buf = new StringBuilder();
223 buf.append( "name = '" );
224 buf.append( getName() + "'" );
225 return buf.toString();
226 }
227
228 public void addChildRoleName( String name )
229 {
230 this.childRoleNames.add( name );
231 }
232
233 public void setChildRoleNames( List<String> names )
234 {
235 if ( names == null )
236 {
237 this.childRoleNames.clear();
238 }
239 else
240 {
241 this.childRoleNames = names;
242 }
243 }
244
245 public boolean isPermanent()
246 {
247 return permanent;
248 }
249
250 public void setPermanent( boolean permanent )
251 {
252 this.permanent = permanent;
253 }
254 }