This project has retired. For details please refer to its
Attic page.
MemoryPermission 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.Operation;
23 import org.apache.archiva.redback.rbac.Resource;
24 import org.apache.archiva.redback.rbac.Permission;
25
26
27
28
29
30
31
32 public class MemoryPermission
33 implements Permission, java.io.Serializable
34 {
35
36
37
38
39 private String name;
40
41
42
43
44 private String description;
45
46
47
48
49 private MemoryOperation operation;
50
51
52
53
54 private MemoryResource resource;
55
56
57
58
59 private boolean permanent = false;
60
61
62
63
64
65
66 public boolean equals( Object other )
67 {
68 if ( this == other )
69 {
70 return true;
71 }
72
73 if ( !( other instanceof MemoryPermission ) )
74 {
75 return false;
76 }
77
78 MemoryPermission that = (MemoryPermission) other;
79 boolean result = true;
80 result = result && ( getName() == null ? that.getName() == null : getName().equals( that.getName() ) );
81 return result;
82 }
83
84
85
86
87 public String getDescription()
88 {
89 return this.description;
90 }
91
92
93
94
95 public String getName()
96 {
97 return this.name;
98 }
99
100
101
102
103 public Operation getOperation()
104 {
105 return (Operation) this.operation;
106 }
107
108
109
110
111 public Resource getResource()
112 {
113 return (Resource) this.resource;
114 }
115
116
117
118
119 public int hashCode()
120 {
121 int result = 17;
122 result = 37 * result + ( name != null ? name.hashCode() : 0 );
123 return result;
124 }
125
126
127
128
129
130
131 public void setDescription( String description )
132 {
133 this.description = description;
134 }
135
136
137
138
139
140
141 public void setName( String name )
142 {
143 this.name = name;
144 }
145
146
147
148
149
150
151 public void setOperation( Operation operation )
152 {
153 if ( !( operation instanceof Operation ) )
154 {
155 throw new ClassCastException( "MemoryPermission.setOperation(operation) parameter must be instanceof "
156 + Operation.class.getName() );
157 }
158 this.operation = (MemoryOperation) operation;
159 }
160
161
162
163
164
165
166 public void setResource( Resource resource )
167 {
168 if ( !( resource instanceof Resource ) )
169 {
170 throw new ClassCastException( "MemoryPermission.setResource(resource) parameter must be instanceof "
171 + Resource.class.getName() );
172 }
173 this.resource = (MemoryResource) resource;
174 }
175
176
177
178
179 public String toString()
180 {
181 StringBuilder buf = new StringBuilder();
182 buf.append( "name = '" );
183 buf.append( getName() + "'" );
184 return buf.toString();
185 }
186
187 public boolean isPermanent()
188 {
189 return permanent;
190 }
191
192 public void setPermanent( boolean permanent )
193 {
194 this.permanent = permanent;
195 }
196 }