]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java
Use other (new) exception
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / user / JobsUserWebSessionController.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Affero General Public License for more details.
13  *
14  * You should have received a copy of the GNU Affero General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jjobs.beans.user;
18
19 import java.io.Serializable;
20 import java.util.Date;
21 import java.util.List;
22 import org.mxchange.jcontacts.contact.gender.Gender;
23 import org.mxchange.jcountry.data.Country;
24 import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
25 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
26 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
27 import org.mxchange.jusercore.exceptions.UserNotFoundException;
28 import org.mxchange.jusercore.model.user.User;
29 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
30
31 /**
32  * An interface for user beans
33  * <p>
34  * @author Roland Haeder<roland@mxchange.org>
35  */
36 public interface JobsUserWebSessionController extends Serializable {
37
38         /**
39          * Minimum password length
40          */
41         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
42
43         /**
44          * Tries to lookup user by given id number. If the user is not found or the
45          * account status is not CONFIRMED proper exceptions are thrown.
46          * <p>
47          * @param userId User id
48          * <p>
49          * @return User instance
50          * <p>
51          * @throws UserNotFoundException If the user is not found
52          */
53         User lookupUserById (final Long userId) throws UserNotFoundException;
54
55         /**
56          * Event observer for new user registrations
57          * <p>
58          * @param event User registration event
59          */
60         void afterRegistrationEvent (final UserRegisteredEvent event);
61
62         /**
63          * Event observer for logged-in user
64          * <p>
65          * @param event Event instance
66          */
67         void afterUserLogin (final UserLoggedInEvent event);
68
69         /**
70          * All public user profiles
71          * <p>
72          * @return A list of all public user profiles
73          */
74         List<User> allVisibleUsers ();
75
76         /**
77          * Creates an instance from all properties
78          * <p>
79          * @return A user instance
80          */
81         User createUserInstance ();
82
83         /**
84          * Getter for birth day
85          * <p>
86          * @return Birth day
87          */
88         Date getBirthday ();
89
90         /**
91          * Setter for birth day
92          * <p>
93          * @param birthday Birth day
94          */
95         void setBirthday (final Date birthday);
96
97         /**
98          * Getter for ellphone number's carrier
99          * <p>
100          * @return Cellphone number's carrier
101          */
102         MobileProvider getCellphoneCarrier ();
103
104         /**
105          * Setter for cellphone number's carrier prefix
106          * <p>
107          * @param cellphoneCarrier Cellphone number's carrier prefix
108          */
109         void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
110
111         /**
112          * Getter for ellphone number
113          * <p>
114          * @return Cellphone number
115          */
116         Long getCellphoneNumber ();
117
118         /**
119          * Setter for ellphone number
120          * <p>
121          * @param cellphoneNumber Cellphone number
122          */
123         void setCellphoneNumber (final Long cellphoneNumber);
124
125         /**
126          * City
127          * <p>
128          * @return the city
129          */
130         String getCity ();
131
132         /**
133          * City
134          * <p>
135          * @param city the city to set
136          */
137         void setCity (final String city);
138
139         /**
140          * Getter for comments
141          * <p>
142          * @return Comments
143          */
144         String getComment ();
145
146         /**
147          * Setter for comment
148          * <p>
149          * @param comment Comments
150          */
151         void setComment (final String comment);
152
153         /**
154          * Getter for country instance
155          * <p>
156          * @return Country instance
157          */
158         Country getCountry ();
159
160         /**
161          * Setter for country instance
162          * <p>
163          * @param country Country instance
164          */
165         void setCountry (final Country country);
166
167         /**
168          * Getter for email address
169          * <p>
170          * @return Email address
171          */
172         String getEmailAddress ();
173
174         /**
175          * Setter for email address
176          * <p>
177          * @param emailAddress Email address
178          */
179         void setEmailAddress (final String emailAddress);
180
181         /**
182          * Getter for email address, repeated
183          * <p>
184          * @return the emailAddress, repeated
185          */
186         String getEmailAddressRepeat ();
187
188         /**
189          * Setter for email address repeated
190          * <p>
191          * @param emailAddressRepeat the emailAddress to set
192          */
193         void setEmailAddressRepeat (final String emailAddressRepeat);
194
195         /**
196          * Family name
197          * <p>
198          * @return the familyName
199          */
200         String getFamilyName ();
201
202         /**
203          * Family name
204          * <p>
205          * @param familyName the familyName to set
206          */
207         void setFamilyName (final String familyName);
208
209         /**
210          * Getter for fax number's area code
211          * <p>
212          * @return Fax number's area code
213          */
214         Integer getFaxAreaCode ();
215
216         /**
217          * Setter for fax number's area code
218          * <p>
219          * @param faxAreaCode Fax number's area code
220          */
221         void setFaxAreaCode (final Integer faxAreaCode);
222
223         /**
224          * Getter for fax's country instance
225          * <p>
226          * @return Fax' country instance
227          */
228         Country getFaxCountry ();
229
230         /**
231          * Setter for fax's country instance
232          * <p>
233          * @param faxCountry Fax' country instance
234          */
235         void setFaxCountry (final Country faxCountry);
236
237         /**
238          * Getter for fax number
239          * <p>
240          * @return Fax number
241          */
242         Long getFaxNumber ();
243
244         /**
245          * Setter for fax number
246          * <p>
247          * @param faxNumber Fax number
248          */
249         void setFaxNumber (final Long faxNumber);
250
251         /**
252          * First name
253          * <p>
254          * @return the first name
255          */
256         String getFirstName ();
257
258         /**
259          * First name
260          * <p>
261          * @param firstName the first name to set
262          */
263         void setFirstName (final String firstName);
264
265         /**
266          * Gender of the contact
267          * <p>
268          * @return the gender
269          */
270         Gender getGender ();
271
272         /**
273          * Gender of the contact
274          * <p>
275          * @param gender the gender to set
276          */
277         void setGender (final Gender gender);
278
279         /**
280          * House number
281          * <p>
282          * @return the houseNumber
283          */
284         Short getHouseNumber ();
285
286         /**
287          * House number
288          * <p>
289          * @param houseNumber the houseNumber to set
290          */
291         void setHouseNumber (final Short houseNumber);
292
293         /**
294          * Getter for phone number's area code
295          * <p>
296          * @return Phone number's area code
297          */
298         Integer getPhoneAreaCode ();
299
300         /**
301          * Setter for phone number's area code
302          * <p>
303          * @param phoneAreaCode Phone number's area code
304          */
305         void setPhoneAreaCode (final Integer phoneAreaCode);
306
307         /**
308          * Getter for phone number's country instance
309          * <p>
310          * @return Phone number's country instance
311          */
312         Country getPhoneCountry ();
313
314         /**
315          * Setter for phone number's country instance
316          * <p>
317          * @param phoneCountry Phone number's country instance
318          */
319         void setPhoneCountry (final Country phoneCountry);
320
321         /**
322          * Getter for phone number
323          * <p>
324          * @return Phone number
325          */
326         Long getPhoneNumber ();
327
328         /**
329          * Setter for phone number
330          * <p>
331          * @param phoneNumber Phone number
332          */
333         void setPhoneNumber (final Long phoneNumber);
334
335         /**
336          * Street
337          * <p>
338          * @return the street
339          */
340         String getStreet ();
341
342         /**
343          * Street
344          * <p>
345          * @param street the street to set
346          */
347         void setStreet (final String street);
348
349         /**
350          * Getter for user id
351          * <p>
352          * @return User id
353          */
354         Long getUserId ();
355
356         /**
357          * Setter for user id
358          * <p>
359          * @param userId User id
360          */
361         void setUserId (final Long userId);
362
363         /**
364          * Getter for user name
365          * <p>
366          * @return User name
367          */
368         String getUserName ();
369
370         /**
371          * Setter for user name
372          * <p>
373          * @param userName User name
374          */
375         void setUserName (final String userName);
376
377         /**
378          * Getter for unencrypted user password
379          * <p>
380          * @return Unencrypted user password
381          */
382         String getUserPassword ();
383
384         /**
385          * Setter for unencrypted user password
386          * <p>
387          * @param userPassword Unencrypted user password
388          */
389         void setUserPassword (final String userPassword);
390
391         /**
392          * Getter for unencrypted user password repeated
393          * <p>
394          * @return Unencrypted user password repeated
395          */
396         String getUserPasswordRepeat ();
397
398         /**
399          * Setter for unencrypted user password repeated
400          * <p>
401          * @param userPasswordRepeat Unencrypted user password repeated
402          */
403         void setUserPasswordRepeat (final String userPasswordRepeat);
404
405         /**
406          * Getter for user profile mode
407          * <p>
408          * @return User profile mode
409          */
410         ProfileMode getUserProfileMode ();
411
412         /**
413          * Setter for user profile mode
414          * <p>
415          * @param userProfileMode User profile mode
416          */
417         void setUserProfileMode (final ProfileMode userProfileMode);
418
419         /**
420          * ZIP code
421          * <p>
422          * @return the zipCode
423          */
424         Integer getZipCode ();
425
426         /**
427          * ZIP code
428          * <p>
429          * @param zipCode the zipCode to set
430          */
431         void setZipCode (final Integer zipCode);
432
433         /**
434          * Checks whether user instance's email address is used
435          * <p>
436          * @param user User instance's email address to check
437          * <p>
438          * @return Whether it is already used
439          */
440         boolean isEmailAddressRegistered (final User user);
441
442         /**
443          * Checks whether all required personal data is set
444          * <p>
445          * @return Whether the required personal data is set
446          */
447         boolean isRequiredPersonalDataSet ();
448
449         /**
450          * Checks whether all required personal data is set for changing them
451          * <p>
452          * @return Whether the required personal data is set
453          */
454         boolean isRequiredChangePersonalDataSet ();
455
456         /**
457          * Checks whether same email addresses have been entered
458          * <p>
459          * @return Whether same email addresses have been entered
460          */
461         boolean isSameEmailAddressEntered ();
462
463         /**
464          * Checks whether same passwords has been entered
465          * <p>
466          * @return Whether same passwords has been entered
467          */
468         boolean isSamePasswordEntered ();
469
470         /**
471          * Checks whether given user instance's name is used
472          * <p>
473          * @param user User instance's name to check
474          * <p>
475          * @return Whether it is already used
476          */
477         boolean isUserNameRegistered (final User user);
478
479         /**
480          * Checks whether a public user account is registered. This means that at
481          * least one user profile has its flag "public user profile" enabled.
482          * <p>
483          * @return Whether at least one user has a public profile
484          */
485         boolean isVisibleUserFound ();
486
487         /**
488          * Checks if the user id is empty
489          * <p>
490          * @return Whether the user id is empty
491          */
492         boolean isUserIdEmpty ();
493
494         /**
495          * Changes logged-in user's personal data if the current password matches
496          * and TAC + privacy statement has been accepted.
497          * <p>
498          * @return New target page
499          */
500         String doChangePersonalData ();
501
502 }