@@ -115,21 +115,10 @@ public class User {
115
115
116
116
@ Temporal (TemporalType .DATE ) private Date dateOfBirth ;
117
117
118
- /**
119
- * Creates a new empty instance of {@code User}.
120
- */
121
118
public User () {
122
119
this (null , null , null );
123
120
}
124
121
125
- /**
126
- * Creates a new instance of {@code User} with preinitialized values for firstname, lastname, email address and roles.
127
- *
128
- * @param firstname
129
- * @param lastname
130
- * @param emailAddress
131
- * @param roles
132
- */
133
122
public User (String firstname , String lastname , String emailAddress , Role ... roles ) {
134
123
135
124
this .firstname = firstname ;
@@ -142,222 +131,119 @@ public User(String firstname, String lastname, String emailAddress, Role... role
142
131
this .createdAt = new Date ();
143
132
}
144
133
145
- /**
146
- * @return the id
147
- */
148
134
public Integer getId () {
149
-
150
135
return id ;
151
136
}
152
137
153
- /**
154
- * @param id the id to set
155
- */
156
138
public void setId (Integer id ) {
157
-
158
139
this .id = id ;
159
140
}
160
141
161
- /**
162
- * Returns the firstname.
163
- *
164
- * @return the firstname
165
- */
166
142
public String getFirstname () {
167
-
168
143
return firstname ;
169
144
}
170
145
171
- /**
172
- * Sets the firstname.
173
- *
174
- * @param firstname the firstname to set
175
- */
176
146
public void setFirstname (final String firstname ) {
177
-
178
147
this .firstname = firstname ;
179
148
}
180
149
181
- /**
182
- * Returns the lastname.
183
- *
184
- * @return the lastname
185
- */
186
150
public String getLastname () {
187
-
188
151
return lastname ;
189
152
}
190
153
191
- /**
192
- * Sets the lastname.
193
- *
194
- * @param lastname the lastname to set
195
- */
196
154
public void setLastname (String lastname ) {
197
-
198
155
this .lastname = lastname ;
199
156
}
200
157
201
- /**
202
- * @return the age
203
- */
204
158
public int getAge () {
205
159
return age ;
206
160
}
207
161
208
- /**
209
- * @param age the age to set
210
- */
211
162
public void setAge (int age ) {
212
163
this .age = age ;
213
164
}
214
165
215
- /**
216
- * Returns the email address.
217
- *
218
- * @return the emailAddress
219
- */
220
166
public String getEmailAddress () {
221
167
222
168
return emailAddress ;
223
169
}
224
170
225
- /**
226
- * Sets the email address.
227
- *
228
- * @param emailAddress the emailAddress to set
229
- */
230
171
public void setEmailAddress (String emailAddress ) {
231
172
232
173
this .emailAddress = emailAddress ;
233
174
}
234
175
235
- /**
236
- * @param active the active to set
237
- */
238
176
public void setActive (boolean active ) {
239
177
this .active = active ;
240
178
}
241
179
242
- /**
243
- * @return the active
244
- */
245
180
public boolean isActive () {
246
181
return active ;
247
182
}
248
183
249
- /**
250
- * Returns the user's roles.
251
- *
252
- * @return the roles
253
- */
254
184
public Set <Role > getRoles () {
255
185
256
186
return roles ;
257
187
}
258
188
259
- /**
260
- * Gives the user a role. Adding a role the user already owns is a no-op.
261
- */
262
189
public void addRole (Role role ) {
263
190
264
191
roles .add (role );
265
192
}
266
193
267
- /**
268
- * Revokes a role from a user.
269
- *
270
- * @param role
271
- */
272
194
public void removeRole (Role role ) {
273
195
274
196
roles .remove (role );
275
197
}
276
198
277
- /**
278
- * Returns the colleagues of the user.
279
- *
280
- * @return the colleagues
281
- */
282
199
public Set <User > getColleagues () {
283
200
284
201
return colleagues ;
285
202
}
286
203
287
- /**
288
- * Adds a new colleague to the user. Adding the user himself as colleague is a no-op.
289
- *
290
- * @param collegue
291
- */
292
- public void addColleague (User collegue ) {
204
+ public void addColleague (User colleague ) {
293
205
294
206
// Prevent from adding the user himself as colleague.
295
- if (this .equals (collegue )) {
207
+ if (this .equals (colleague )) {
296
208
return ;
297
209
}
298
210
299
- colleagues .add (collegue );
300
- collegue .getColleagues ().add (this );
211
+ colleagues .add (colleague );
212
+ colleague .getColleagues ().add (this );
301
213
}
302
214
303
- /**
304
- * Removes a colleague from the list of colleagues.
305
- *
306
- * @param colleague
307
- */
308
215
public void removeColleague (User colleague ) {
309
216
310
217
colleagues .remove (colleague );
311
218
colleague .getColleagues ().remove (this );
312
219
}
313
220
314
- /**
315
- * @return the manager
316
- */
317
221
public User getManager () {
318
222
319
223
return manager ;
320
224
}
321
225
322
- /**
323
- * @param manager the manager to set
324
- */
325
226
public void setManager (User manager ) {
326
227
327
228
this .manager = manager ;
328
229
}
329
230
330
- /**
331
- * @return the createdAt
332
- */
333
231
public Date getCreatedAt () {
334
232
return createdAt ;
335
233
}
336
234
337
- /**
338
- * @return the address
339
- */
340
235
public Address getAddress () {
341
236
return address ;
342
237
}
343
238
344
- /**
345
- * @param address the address to set
346
- */
347
239
public void setAddress (Address address ) {
348
240
this .address = address ;
349
241
}
350
242
351
- /**
352
- * @param binaryData the binaryData to set
353
- */
354
243
public void setBinaryData (byte [] binaryData ) {
355
244
this .binaryData = binaryData ;
356
245
}
357
246
358
- /**
359
- * @return the binaryData
360
- */
361
247
public byte [] getBinaryData () {
362
248
return binaryData ;
363
249
}
@@ -378,16 +264,10 @@ public boolean equals(Object obj) {
378
264
return this .getId ().equals (that .getId ());
379
265
}
380
266
381
- /**
382
- * @return the attributes
383
- */
384
267
public Set <String > getAttributes () {
385
268
return attributes ;
386
269
}
387
270
388
- /**
389
- * @param attributes the attributes to set
390
- */
391
271
public void setAttributes (Set <String > attributes ) {
392
272
this .attributes = attributes ;
393
273
}
@@ -406,7 +286,6 @@ public void setCreatedAt(Date createdAt) {
406
286
407
287
@ Override
408
288
public String toString () {
409
-
410
289
return "User: " + getId () + ", " + getFirstname () + " " + getLastname () + ", " + getEmailAddress ();
411
290
}
412
291
}
0 commit comments