1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.webscripts;
20
21 import org.springframework.extensions.surf.FrameworkUtil;
22 import org.springframework.extensions.surf.RequestContext;
23 import org.springframework.extensions.surf.exception.UserFactoryException;
24 import org.springframework.extensions.webscripts.ScriptableMap;
25 import org.springframework.extensions.webscripts.ScriptableWrappedMap;
26 import org.springframework.extensions.webscripts.connector.User;
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 public final class ScriptUser extends ScriptBase
42 {
43 private final User user;
44
45
46
47
48
49
50
51
52 public ScriptUser(RequestContext context, User user)
53 {
54 super(context);
55
56
57 this.user = user;
58 }
59
60
61
62
63
64
65
66 protected ScriptableMap buildProperties()
67 {
68 if (this.properties == null)
69 {
70 this.properties = new ScriptableWrappedMap(user.getProperties());
71 }
72
73 return this.properties;
74 }
75
76
77
78
79
80
81 public String getId()
82 {
83 return this.user.getId();
84 }
85
86
87
88
89
90
91 public String getName()
92 {
93 return this.user.getName();
94 }
95
96 public String getFullName()
97 {
98 return this.user.getFullName();
99 }
100
101 public String getFirstName()
102 {
103 return this.user.getFirstName();
104 }
105
106 public void setFirstName(String value)
107 {
108 this.user.setFirstName(value);
109 }
110
111 public String getLastName()
112 {
113 return this.user.getLastName();
114 }
115
116 public void setLastName(String value)
117 {
118 this.user.setLastName(value);
119 }
120
121 public String getMiddleName()
122 {
123 return this.user.getMiddleName();
124 }
125
126 public void setMiddleName(String value)
127 {
128 this.user.setMiddleName(value);
129 }
130
131 public String getEmail()
132 {
133 return this.user.getEmail();
134 }
135
136 public void setEmail(String value)
137 {
138 this.user.setEmail(value);
139 }
140
141 public String getOrganization()
142 {
143 return this.user.getOrganization();
144 }
145
146 public void setOrganization(String value)
147 {
148 this.user.setEmail(value);
149 }
150
151 public String getJobTitle()
152 {
153 return this.user.getJobTitle();
154 }
155
156 public void setJobTitle(String value)
157 {
158 this.user.setJobTitle(value);
159 }
160
161 public String getLocation()
162 {
163 return this.user.getLocation();
164 }
165
166 public void setLocation(String value)
167 {
168 this.user.setLocation(value);
169 }
170
171 public String getBiography()
172 {
173 return this.user.getBiography();
174 }
175
176 public void setBiography(String value)
177 {
178 this.user.setBiography(value);
179 }
180
181 public String getTelephone()
182 {
183 return this.user.getTelephone();
184 }
185
186 public void setTelephone(String value)
187 {
188 this.user.setTelephone(value);
189 }
190
191 public String getMobilePhone()
192 {
193 return this.user.getMobilePhone();
194 }
195
196 public void setMobilePhone(String value)
197 {
198 this.user.setMobilePhone(value);
199 }
200
201 public String getSkype()
202 {
203 return this.user.getSkype();
204 }
205
206 public void setSkype(String value)
207 {
208 this.user.setSkype(value);
209 }
210
211 public String getInstantMsg()
212 {
213 return this.user.getInstantMsg();
214 }
215
216 public void setInstantMsg(String value)
217 {
218 this.user.setInstantMsg(value);
219 }
220
221 public String getCompanyPostcode()
222 {
223 return this.user.getCompanyPostcode();
224 }
225
226 public void setCompanyPostcode(String value)
227 {
228 this.user.setCompanyPostcode(value);
229 }
230
231 public String getCompanyTelephone()
232 {
233 return this.user.getCompanyTelephone();
234 }
235
236 public void setCompanyTelephone(String value)
237 {
238 this.user.setCompanyTelephone(value);
239 }
240
241 public String getCompanyFax()
242 {
243 return this.user.getCompanyFax();
244 }
245
246 public void setCompanyFax(String value)
247 {
248 this.user.setCompanyFax(value);
249 }
250
251 public String getCompanyEmail()
252 {
253 return this.user.getCompanyEmail();
254 }
255
256 public void setCompanyEmail(String value)
257 {
258 this.user.setCompanyEmail(value);
259 }
260
261 public String getCompanyAddress1()
262 {
263 return this.user.getCompanyAddress1();
264 }
265
266 public void setCompanyAddress1(String value)
267 {
268 this.user.setCompanyAddress1(value);
269 }
270
271 public String getCompanyAddress2()
272 {
273 return this.user.getCompanyAddress2();
274 }
275
276 public void setCompanyAddress2(String value)
277 {
278 this.user.setCompanyAddress2(value);
279 }
280
281 public String getCompanyAddress3()
282 {
283 return this.user.getCompanyAddress3();
284 }
285
286 public void setCompanyAddress3(String value)
287 {
288 this.user.setCompanyAddress3(value);
289 }
290
291 public boolean getIsAdmin()
292 {
293 return this.user.isAdmin();
294 }
295
296 public boolean getIsGuest()
297 {
298 return this.user.isGuest();
299 }
300
301
302
303
304 public void save()
305 {
306 this.user.save();
307 }
308
309
310
311
312
313
314
315
316 public ScriptUser getUser(String userId)
317 {
318 try
319 {
320 User user = FrameworkUtil.getServiceRegistry().getUserFactory().loadUser(this.context, userId);
321 return new ScriptUser(this.context, user);
322 }
323 catch (UserFactoryException err)
324 {
325
326 return null;
327 }
328 }
329
330
331
332
333
334 @Override
335 public String toString()
336 {
337 return user.getProperties().toString();
338 }
339 }