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.pizzaapplication.beans.user;
19 import java.io.Serializable;
20 import java.util.List;
21 import org.mxchange.jcontacts.contact.Contact;
22 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
23 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
24 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
25 import org.mxchange.jusercore.exceptions.UserNotFoundException;
26 import org.mxchange.jusercore.model.user.User;
27 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
30 * An interface for user beans
32 * @author Roland Haeder<roland@mxchange.org>
34 public interface PizzaUserWebSessionController extends Serializable {
37 * Minimum password length
39 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
42 * Returns a list of all selectable contacts for user creation. Contacts
43 * from already existing users are excluded in this list.
45 * @return A list of all selectable contacts
47 List<Contact> selectableContacts ();
50 * Tries to lookup user by given id number. If the user is not found or the
51 * account status is not CONFIRMED proper exceptions are thrown.
53 * @param userId User id
55 * @return User instance
57 * @throws UserNotFoundException If the user is not found
59 User lookupUserById (final Long userId) throws UserNotFoundException;
62 * Event observer for newly added users by an administrator
64 * @param event Event being fired
66 void afterAdminAddedUserEvent(final AdminAddedUserEvent event);
69 * Event observer for new user registrations
71 * @param event User registration event
73 void afterRegistrationEvent (final UserRegisteredEvent event);
76 * Event observer for logged-in user
78 * @param event Event instance
80 void afterUserLogin (final UserLoggedInEvent event);
83 * All public user profiles
85 * @return A list of all public user profiles
87 List<User> allVisibleUsers ();
90 * Creates an instance from all properties
92 * @return A user instance
94 User createUserInstance ();
106 * @param userId User id
108 void setUserId (final Long userId);
111 * Getter for user name
115 String getUserName ();
118 * Setter for user name
120 * @param userName User name
122 void setUserName (final String userName);
125 * Getter for unencrypted user password
127 * @return Unencrypted user password
129 String getUserPassword ();
132 * Setter for unencrypted user password
134 * @param userPassword Unencrypted user password
136 void setUserPassword (final String userPassword);
139 * Getter for unencrypted user password repeated
141 * @return Unencrypted user password repeated
143 String getUserPasswordRepeat ();
146 * Setter for unencrypted user password repeated
148 * @param userPasswordRepeat Unencrypted user password repeated
150 void setUserPasswordRepeat (final String userPasswordRepeat);
153 * Getter for user profile mode
155 * @return User profile mode
157 ProfileMode getUserProfileMode ();
160 * Setter for user profile mode
162 * @param userProfileMode User profile mode
164 void setUserProfileMode (final ProfileMode userProfileMode);
167 * Checks whether all required personal data is set
169 * @return Whether the required personal data is set
171 boolean isRequiredPersonalDataSet ();
174 * Checks whether all required personal data is set for changing them
176 * @return Whether the required personal data is set
178 boolean isRequiredChangePersonalDataSet ();
181 * Checks whether same passwords has been entered
183 * @return Whether same passwords has been entered
185 boolean isSamePasswordEntered ();
188 * Checks whether given user instance's name is used
190 * @param user User instance's name to check
192 * @return Whether it is already used
194 boolean isUserNameRegistered (final User user);
197 * Checks whether a public user account is registered. This means that at
198 * least one user profile has its flag "public user profile" enabled.
200 * @return Whether at least one user has a public profile
202 boolean isVisibleUserFound ();
205 * Checks if the user id is empty
207 * @return Whether the user id is empty
209 boolean isUserIdEmpty ();
212 * Changes logged-in user's personal data if the current password matches
213 * and TAC + privacy statement has been accepted.
215 * @return New target page
217 String doChangePersonalData ();