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
26 package org.astrogrid.community.common.policy.data ;
27
28 /***
29 * A data object to represent an Account.
30 * @todo Refactor this into AccountData and AccountDetails.
31 * @todo Refactor this to inherit from CommunityBase (common code for equals and ident handling).
32 *
33 */
34 public class AccountData
35 {
36 /***
37 * Public constructor.
38 *
39 */
40 public AccountData()
41 {
42 this(null) ;
43 }
44
45 /***
46 * Public constructor.
47 * @param ident The Account ident.
48 * @todo Add syntax checking.
49 *
50 */
51 public AccountData(String ident)
52 {
53 this.setIdent(ident) ;
54 }
55
56 /***
57 * The Account identifier.
58 * @todo Move this to a common data object base class
59 *
60 */
61 private String ident ;
62
63 /***
64 * Access to the Account identifier.
65 * @return The Account identifier.
66 * @todo Move this to a common data object base class
67 *
68 */
69 public String getIdent()
70 {
71 return this.ident ;
72 }
73
74 /***
75 * Access to the Account identifier.
76 * This will fail the the identifier is already set - you can't change the identifier of an existing Account.
77 * No syntax checking is applied to the value.
78 * @param value The Account identifier.
79 * @todo Refactor to use Ivorns.
80 * @todo Move this to a common data object base class
81 *
82 */
83 public void setIdent(String value)
84 {
85 if (null == this.ident)
86 {
87 this.ident = value ;
88 }
89 }
90
91 /***
92 * The Account display name.
93 * This is intended for use in the portal display pages.
94 *
95 */
96 private String display ;
97
98 /***
99 * Access to the Account display name.
100 * @return The current display name.
101 *
102 */
103 public String getDisplayName()
104 {
105 return this.display ;
106 }
107
108 /***
109 * Access to the Account display name.
110 * @param value The new display name.
111 *
112 */
113 public void setDisplayName(String value)
114 {
115 this.display = value ;
116 }
117
118 /***
119 * The Account description.
120 * This is intended for use in the portal display pages.
121 *
122 */
123 private String description ;
124
125 /***
126 * Access to the Account description.
127 * @return The current description.
128 *
129 */
130 public String getDescription()
131 {
132 return this.description ;
133 }
134
135 /***
136 * Access to the Account description.
137 * @param value The new description.
138 *
139 */
140 public void setDescription(String value)
141 {
142 this.description = value ;
143 }
144
145 /***
146 * The Account home space URI.
147 * This is the MySpace or VoSpace URI for the account home.
148 * @todo Add syntax checking.
149 *
150 */
151 private String home ;
152
153 /***
154 * Access to the Account home space URI.
155 * @return The current home space URI.
156 *
157 */
158 public String getHomeSpace()
159 {
160 return this.home ;
161 }
162
163 /***
164 * Access to the Account home space URI (Ivorn).
165 * No syntax checking is applied to the value.
166 * @param value The new home space URI.
167 * @todo Add syntax checking.
168 *
169 */
170 public void setHomeSpace(String value)
171 {
172 this.home = value ;
173 }
174
175 /***
176 * The Account email address.
177 * The contact email address for the Account owner.
178 * No syntax checking is applied to the value.
179 * @todo Add syntax checking.
180 *
181 */
182 private String email ;
183
184 /***
185 * Access to the Account email address.
186 * @return The current email address.
187 *
188 */
189 public String getEmailAddress()
190 {
191 return this.email ;
192 }
193
194 /***
195 * Access to the Account email address.
196 * No syntax checking is applied to the value.
197 * @param value The new email address.
198 * @todo Add syntax checking.
199 *
200 */
201 public void setEmailAddress(String value)
202 {
203 this.email = value ;
204 }
205
206
207
208
209
210
211
212
213
214
215 public synchronized boolean equals(Object object)
216 {
217
218
219 if (null == object)
220 {
221 return false ;
222 }
223
224
225 else {
226
227
228 if (object instanceof AccountData)
229 {
230 AccountData that = (AccountData) object ;
231
232
233 if (null == this.ident)
234 {
235
236
237 return (null == that.getIdent()) ;
238 }
239
240
241 else {
242
243
244 return (this.ident.equals(that.getIdent())) ;
245 }
246 }
247
248
249 else {
250 return false ;
251 }
252 }
253 }
254
255 /***
256 * Generate a hash code for comparison tests.
257 * At the moment, this just uses the ident.hashCode().
258 * @todo This needs to refactored to check for local community in the ident.
259 * @todo Move this to a common data object base class
260 *
261 */
262 public synchronized int hashCode()
263 {
264 return (null != this.ident) ? this.ident.hashCode() : 0 ;
265 }
266 }