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.events.user.update.UpdatedUserPersonalDataEvent;
26 import org.mxchange.jusercore.exceptions.UserNotFoundException;
27 import org.mxchange.jusercore.model.user.User;
28 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
31 * An interface for user beans
33 * @author Roland Haeder<roland@mxchange.org>
35 public interface PizzaUserWebSessionController extends Serializable {
38 * Minimum password length
40 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
45 * @return A list of all public user profiles
47 List<User> allUsers ();
50 * Checks whether users are registered
52 * @return Whether users are registered
57 * Checks whether the given contact is a user
59 * @param contact Contact to check
61 * @return Whether the contact is a user
63 boolean isContactFound (final Contact contact);
66 * Listens to fired event when user updated personal data
68 * @param event Event being fired
70 void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
73 * Updates list with given user
75 * @param user User to update
77 void updateList (final User user);
80 * Returns a list of all selectable contacts for user creation. Contacts
81 * from already existing users are excluded in this list.
83 * @return A list of all selectable contacts
85 List<Contact> selectableContacts ();
88 * Tries to lookup user by given id number. If the user is not found or the
89 * account status is not CONFIRMED proper exceptions are thrown.
91 * @param userId User id
93 * @return User instance
95 * @throws UserNotFoundException If the user is not found
97 User lookupUserById (final Long userId) throws UserNotFoundException;
100 * Event observer for newly added users by an administrator
102 * @param event Event being fired
104 void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
107 * Event observer for new user registrations
109 * @param event User registration event
111 void afterRegistrationEvent (final UserRegisteredEvent event);
114 * Event observer for logged-in user
116 * @param event Event instance
118 void afterUserLogin (final UserLoggedInEvent event);
121 * All public user profiles
123 * @return A list of all public user profiles
125 List<User> allVisibleUsers ();
128 * Creates an instance from all properties
130 * @return A user instance
132 User createUserInstance ();
144 * @param userId User id
146 void setUserId (final Long userId);
149 * Getter for user name
153 String getUserName ();
156 * Setter for user name
158 * @param userName User name
160 void setUserName (final String userName);
163 * Getter for unencrypted user password
165 * @return Unencrypted user password
167 String getUserPassword ();
170 * Setter for unencrypted user password
172 * @param userPassword Unencrypted user password
174 void setUserPassword (final String userPassword);
177 * Getter for unencrypted user password repeated
179 * @return Unencrypted user password repeated
181 String getUserPasswordRepeat ();
184 * Setter for unencrypted user password repeated
186 * @param userPasswordRepeat Unencrypted user password repeated
188 void setUserPasswordRepeat (final String userPasswordRepeat);
191 * Getter for user profile mode
193 * @return User profile mode
195 ProfileMode getUserProfileMode ();
198 * Setter for user profile mode
200 * @param userProfileMode User profile mode
202 void setUserProfileMode (final ProfileMode userProfileMode);
205 * Checks whether all required personal data is set
207 * @return Whether the required personal data is set
209 boolean isRequiredPersonalDataSet ();
212 * Checks whether all required personal data is set for changing them
214 * @return Whether the required personal data is set
216 boolean isRequiredChangePersonalDataSet ();
219 * Checks whether same passwords has been entered
221 * @return Whether same passwords has been entered
223 boolean isSamePasswordEntered ();
226 * Checks whether given user instance's name is used
228 * @param user User instance's name to check
230 * @return Whether it is already used
232 boolean isUserNameRegistered (final User user);
235 * Checks whether a public user account is registered. This means that at
236 * least one user profile has its flag "public user profile" enabled.
238 * @return Whether at least one user has a public profile
240 boolean isVisibleUserFound ();
243 * Checks if the user id is empty
245 * @return Whether the user id is empty
247 boolean isUserIdEmpty ();
250 * Changes logged-in user's personal data if the current password matches
251 * and TAC + privacy statement has been accepted.
253 * @return New target page
255 String doChangePersonalData ();