1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 package org.astrogrid.community.common.policy.data ;
26
27 public class GroupData
28 {
29 /***
30 * Type value to for a normal Group.
31 * @todo Chnage this to public and private.
32 *
33 */
34 public static final String MULTI_TYPE = "MULTI";
35
36 /***
37 * Type value to for an Account Group.
38 * @todo Chnage this to public and private.
39 *
40 */
41 public static final String SINGLE_TYPE = "SINGLE";
42
43 /***
44 * Public constructor.
45 *
46 */
47 public GroupData()
48 {
49 this(null) ;
50 }
51
52 /***
53 * Public constructor.
54 * @param ident The Account ident.
55 * @todo Add syntax checking.
56 *
57 */
58 public GroupData(String ident)
59 {
60 this.setIdent(ident) ;
61 }
62
63 /***
64 * The Group identifier.
65 * @todo Refactor to use Ivorns.
66 * @todo Move this to a common data object base class
67 *
68 */
69 private String ident ;
70
71 /***
72 * Access to the Group identifier.
73 * @return The Group identifier.
74 * @todo Move this to a common data object base class
75 *
76 */
77 public String getIdent()
78 {
79 return this.ident ;
80 }
81
82 /***
83 * Access to the Group identifier.
84 * This will fail the the identifier is already set - you can't change the identifier of an existing Group.
85 * @param value The Group identifier.
86 * @todo Refactor to use Ivorns.
87 * @todo Move this to a common data object base class
88 *
89 */
90 public void setIdent(String value)
91 {
92 if (null == this.ident)
93 {
94 this.ident = value ;
95 }
96 }
97
98 /***
99 * The Group display name.
100 * This is intended for use in the portal display pages.
101 *
102 */
103 private String display ;
104
105 /***
106 * Access to the Group display name.
107 * @return The current display name.
108 *
109 */
110 public String getDisplayName()
111 {
112 return this.display ;
113 }
114
115 /***
116 * Access to the Group display name.
117 * @param value The new display name.
118 *
119 */
120 public void setDisplayName(String value)
121 {
122 this.display = value ;
123 }
124
125 /***
126 * The Group description.
127 * This is intended for use in the portal display pages.
128 *
129 */
130 private String description ;
131
132 /***
133 * Access to the Group description.
134 * @return The current description.
135 *
136 */
137 public String getDescription()
138 {
139 return this.description ;
140 }
141
142 /***
143 * Access to the Group description.
144 * @param value The new description.
145 *
146 */
147 public void setDescription(String value)
148 {
149 this.description = value ;
150 }
151
152 /***
153 * Our Group type, MULTI_TYPE or SINGLE_TYPE.
154 * Defaults to MULTI_TYPE if not set.
155 * @todo Change this to public and protected, and add a simple test method.
156 *
157 */
158 private String type = MULTI_TYPE ;
159
160 /***
161 * Access to our Group type.
162 *
163 */
164 public String getType()
165 {
166 return this.type ;
167 }
168
169 /***
170 * Access to our Group type.
171 *
172 */
173 public void setType(String value)
174 {
175 this.type = value ;
176 }
177
178
179
180
181
182
183
184
185
186
187 public synchronized boolean equals(Object that)
188 {
189
190
191 if (null == that)
192 {
193 return false ;
194 }
195
196
197 else {
198
199
200 if (that instanceof GroupData)
201 {
202 GroupData group = (GroupData) that ;
203
204
205 if (null == this.getIdent())
206 {
207
208
209 return (null == group.getIdent()) ;
210 }
211
212
213 else {
214
215
216 return (this.getIdent().equals(group.getIdent())) ;
217 }
218 }
219
220
221 else {
222 return false ;
223 }
224 }
225 }
226
227 /***
228 * Generate a hash code for comparison tests.
229 * Just uses the ident.hashCode().
230 * @todo Needs to refactored to check for local community in the ident.
231 * @todo Move this to a common data object base class
232 *
233 */
234 public synchronized int hashCode()
235 {
236 return (null != this.ident) ? this.ident.hashCode() : 0 ;
237 }
238
239 }