2 * Copyright (C) 2016 Roland Haeder
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.
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.
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/>.
17 package org.mxchange.jjobs.beans.user;
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;
32 * An interface for user beans
34 * @author Roland Haeder<roland@mxchange.org>
36 public interface JobsUserWebSessionController extends Serializable {
39 * Minimum password length
41 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
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.
47 * @param userId User id
49 * @return User instance
51 * @throws UserNotFoundException If the user is not found
53 User lookupUserById (final Long userId) throws UserNotFoundException;
56 * Event observer for new user registrations
58 * @param event User registration event
60 void afterRegistrationEvent (final UserRegisteredEvent event);
63 * Event observer for logged-in user
65 * @param event Event instance
67 void afterUserLogin (final UserLoggedInEvent event);
70 * All public user profiles
72 * @return A list of all public user profiles
74 List<User> allVisibleUsers ();
77 * Creates an instance from all properties
79 * @return A user instance
81 User createUserInstance ();
84 * Getter for birth day
91 * Setter for birth day
93 * @param birthday Birth day
95 void setBirthday (final Date birthday);
98 * Getter for ellphone number's carrier
100 * @return Cellphone number's carrier
102 MobileProvider getCellphoneCarrier ();
105 * Setter for cellphone number's carrier prefix
107 * @param cellphoneCarrier Cellphone number's carrier prefix
109 void setCellphoneCarrier (final MobileProvider cellphoneCarrier);
112 * Getter for ellphone number
114 * @return Cellphone number
116 Long getCellphoneNumber ();
119 * Setter for ellphone number
121 * @param cellphoneNumber Cellphone number
123 void setCellphoneNumber (final Long cellphoneNumber);
135 * @param city the city to set
137 void setCity (final String city);
140 * Getter for comments
144 String getComment ();
149 * @param comment Comments
151 void setComment (final String comment);
154 * Getter for country instance
156 * @return Country instance
158 Country getCountry ();
161 * Setter for country instance
163 * @param country Country instance
165 void setCountry (final Country country);
168 * Getter for email address
170 * @return Email address
172 String getEmailAddress ();
175 * Setter for email address
177 * @param emailAddress Email address
179 void setEmailAddress (final String emailAddress);
182 * Getter for email address, repeated
184 * @return the emailAddress, repeated
186 String getEmailAddressRepeat ();
189 * Setter for email address repeated
191 * @param emailAddressRepeat the emailAddress to set
193 void setEmailAddressRepeat (final String emailAddressRepeat);
198 * @return the familyName
200 String getFamilyName ();
205 * @param familyName the familyName to set
207 void setFamilyName (final String familyName);
210 * Getter for fax number's area code
212 * @return Fax number's area code
214 Integer getFaxAreaCode ();
217 * Setter for fax number's area code
219 * @param faxAreaCode Fax number's area code
221 void setFaxAreaCode (final Integer faxAreaCode);
224 * Getter for fax's country instance
226 * @return Fax' country instance
228 Country getFaxCountry ();
231 * Setter for fax's country instance
233 * @param faxCountry Fax' country instance
235 void setFaxCountry (final Country faxCountry);
238 * Getter for fax number
242 Long getFaxNumber ();
245 * Setter for fax number
247 * @param faxNumber Fax number
249 void setFaxNumber (final Long faxNumber);
254 * @return the first name
256 String getFirstName ();
261 * @param firstName the first name to set
263 void setFirstName (final String firstName);
266 * Gender of the contact
273 * Gender of the contact
275 * @param gender the gender to set
277 void setGender (final Gender gender);
282 * @return the houseNumber
284 Short getHouseNumber ();
289 * @param houseNumber the houseNumber to set
291 void setHouseNumber (final Short houseNumber);
294 * Getter for phone number's area code
296 * @return Phone number's area code
298 Integer getPhoneAreaCode ();
301 * Setter for phone number's area code
303 * @param phoneAreaCode Phone number's area code
305 void setPhoneAreaCode (final Integer phoneAreaCode);
308 * Getter for phone number's country instance
310 * @return Phone number's country instance
312 Country getPhoneCountry ();
315 * Setter for phone number's country instance
317 * @param phoneCountry Phone number's country instance
319 void setPhoneCountry (final Country phoneCountry);
322 * Getter for phone number
324 * @return Phone number
326 Long getPhoneNumber ();
329 * Setter for phone number
331 * @param phoneNumber Phone number
333 void setPhoneNumber (final Long phoneNumber);
345 * @param street the street to set
347 void setStreet (final String street);
350 * Getter for user instance (e.g. from show_user)
352 * @return User instance
357 * Setter for user instance (e.g. from show_user)
359 * @param user User instance
361 void setUser (final User user);
373 * @param userId User id
375 void setUserId (final Long userId);
378 * Getter for user name
382 String getUserName ();
385 * Setter for user name
387 * @param userName User name
389 void setUserName (final String userName);
392 * Getter for unencrypted user password
394 * @return Unencrypted user password
396 String getUserPassword ();
399 * Setter for unencrypted user password
401 * @param userPassword Unencrypted user password
403 void setUserPassword (final String userPassword);
406 * Getter for unencrypted user password repeated
408 * @return Unencrypted user password repeated
410 String getUserPasswordRepeat ();
413 * Setter for unencrypted user password repeated
415 * @param userPasswordRepeat Unencrypted user password repeated
417 void setUserPasswordRepeat (final String userPasswordRepeat);
420 * Getter for user profile mode
422 * @return User profile mode
424 ProfileMode getUserProfileMode ();
427 * Setter for user profile mode
429 * @param userProfileMode User profile mode
431 void setUserProfileMode (final ProfileMode userProfileMode);
436 * @return the zipCode
438 Integer getZipCode ();
443 * @param zipCode the zipCode to set
445 void setZipCode (final Integer zipCode);
448 * Checks whether user instance's email address is used
450 * @param user User instance's email address to check
452 * @return Whether it is already used
454 boolean isEmailAddressRegistered (final User user);
457 * Checks whether all required personal data is set
459 * @return Whether the required personal data is set
461 boolean isRequiredPersonalDataSet ();
464 * Checks whether all required personal data is set for changing them
466 * @return Whether the required personal data is set
468 boolean isRequiredChangePersonalDataSet ();
471 * Checks whether same email addresses have been entered
473 * @return Whether same email addresses have been entered
475 boolean isSameEmailAddressEntered ();
478 * Checks whether same passwords has been entered
480 * @return Whether same passwords has been entered
482 boolean isSamePasswordEntered ();
485 * Checks whether given user instance's name is used
487 * @param user User instance's name to check
489 * @return Whether it is already used
491 boolean isUserNameRegistered (final User user);
494 * Checks whether a public user account is registered. This means that at
495 * least one user profile has its flag "public user profile" enabled.
497 * @return Whether at least one user has a public profile
499 boolean isVisibleUserFound ();
502 * Checks if the user id is empty
504 * @return Whether the user id is empty
506 boolean isUserIdEmpty ();
509 * Changes logged-in user's personal data if the current password matches
510 * and TAC + privacy statement has been accepted.
512 * @return New target page
514 String doChangePersonalData ();