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.addressbook.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.smsprovider.SmsProvider;
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 AddressbookUserWebSessionController 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 SmsProvider getCellphoneCarrier ();
105 * Setter for cellphone number's carrier prefix
107 * @param cellphoneCarrier Cellphone number's carrier prefix
109 void setCellphoneCarrier (final SmsProvider 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 1 (changing)
184 * @return Email address
186 String getEmailAddress1 ();
189 * Setter for email address 1 (changing)
191 * @param emailAddress1 Email address 1
193 void setEmailAddress1 (final String emailAddress1);
196 * Getter for email address 2 (repeat changing)
198 * @return Email address 2
200 String getEmailAddress2 ();
203 * Setter for email address 2 (repeat changing)
205 * @param emailAddress2 Email address 2
207 void setEmailAddress2 (final String emailAddress2);
210 * Getter for email address, repeated
212 * @return the emailAddress, repeated
214 String getEmailAddressRepeat ();
217 * Setter for email address repeated
219 * @param emailAddressRepeat the emailAddress to set
221 void setEmailAddressRepeat (final String emailAddressRepeat);
226 * @return the familyName
228 String getFamilyName ();
233 * @param familyName the familyName to set
235 void setFamilyName (final String familyName);
238 * Getter for fax number's area code
240 * @return Fax number's area code
242 Integer getFaxAreaCode ();
245 * Setter for fax number's area code
247 * @param faxAreaCode Fax number's area code
249 void setFaxAreaCode (final Integer faxAreaCode);
252 * Getter for fax's country instance
254 * @return Fax' country instance
256 Country getFaxCountry ();
259 * Setter for fax's country instance
261 * @param faxCountry Fax' country instance
263 void setFaxCountry (final Country faxCountry);
266 * Getter for fax number
270 Long getFaxNumber ();
273 * Setter for fax number
275 * @param faxNumber Fax number
277 void setFaxNumber (final Long faxNumber);
282 * @return the first name
284 String getFirstName ();
289 * @param firstName the first name to set
291 void setFirstName (final String firstName);
294 * Gender of the contact
301 * Gender of the contact
303 * @param gender the gender to set
305 void setGender (final Gender gender);
310 * @return the houseNumber
312 Short getHouseNumber ();
317 * @param houseNumber the houseNumber to set
319 void setHouseNumber (final Short houseNumber);
322 * Getter for phone number's area code
324 * @return Phone number's area code
326 Integer getPhoneAreaCode ();
329 * Setter for phone number's area code
331 * @param phoneAreaCode Phone number's area code
333 void setPhoneAreaCode (final Integer phoneAreaCode);
336 * Getter for phone number's country instance
338 * @return Phone number's country instance
340 Country getPhoneCountry ();
343 * Setter for phone number's country instance
345 * @param phoneCountry Phone number's country instance
347 void setPhoneCountry (final Country phoneCountry);
350 * Getter for phone number
352 * @return Phone number
354 Long getPhoneNumber ();
357 * Setter for phone number
359 * @param phoneNumber Phone number
361 void setPhoneNumber (final Long phoneNumber);
373 * @param street the street to set
375 void setStreet (final String street);
387 * @param userId User id
389 void setUserId (final Long userId);
392 * Getter for user name
396 String getUserName ();
399 * Setter for user name
401 * @param userName User name
403 void setUserName (final String userName);
406 * Getter for unencrypted user password
408 * @return Unencrypted user password
410 String getUserPassword ();
413 * Setter for unencrypted user password
415 * @param userPassword Unencrypted user password
417 void setUserPassword (final String userPassword);
420 * Getter for unencrypted user password repeated
422 * @return Unencrypted user password repeated
424 String getUserPasswordRepeat ();
427 * Setter for unencrypted user password repeated
429 * @param userPasswordRepeat Unencrypted user password repeated
431 void setUserPasswordRepeat (final String userPasswordRepeat);
434 * Getter for user profile mode
436 * @return User profile mode
438 ProfileMode getUserProfileMode ();
441 * Setter for user profile mode
443 * @param userProfileMode User profile mode
445 void setUserProfileMode (final ProfileMode userProfileMode);
450 * @return the zipCode
452 Integer getZipCode ();
457 * @param zipCode the zipCode to set
459 void setZipCode (final Integer zipCode);
462 * Checks whether user instance's email address is used
464 * @param user User instance's email address to check
466 * @return Whether it is already used
468 boolean isEmailAddressRegistered (final User user);
471 * Checks whether all required personal data is set
473 * @return Whether the required personal data is set
475 boolean isRequiredPersonalDataSet ();
478 * Checks whether all required personal data is set for changing them
480 * @return Whether the required personal data is set
482 boolean isRequiredChangePersonalDataSet ();
485 * Checks whether same email addresses have been entered
487 * @return Whether same email addresses have been entered
489 boolean isSameEmailAddressEntered ();
492 * Checks whether same passwords has been entered
494 * @return Whether same passwords has been entered
496 boolean isSamePasswordEntered ();
499 * Checks whether given user instance's name is used
501 * @param user User instance's name to check
503 * @return Whether it is already used
505 boolean isUserNameRegistered (final User user);
508 * Checks whether a public user account is registered. This means that at
509 * least one user profile has its flag "public user profile" enabled.
511 * @return Whether at least one user has a public profile
513 boolean isVisibleUserFound ();
516 * Checks if the user id is empty
518 * @return Whether the user id is empty
520 boolean isUserIdEmpty ();