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.List;
21 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
22 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
23 import org.mxchange.jusercore.exceptions.UserNotFoundException;
24 import org.mxchange.jusercore.model.user.User;
25 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
28 * An interface for user beans
30 * @author Roland Haeder<roland@mxchange.org>
32 public interface JobsUserWebSessionController extends Serializable {
35 * Minimum password length
37 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
40 * Tries to lookup user by given id number. If the user is not found or the
41 * account status is not CONFIRMED proper exceptions are thrown.
43 * @param userId User id
45 * @return User instance
47 * @throws UserNotFoundException If the user is not found
49 User lookupUserById (final Long userId) throws UserNotFoundException;
52 * Event observer for new user registrations
54 * @param event User registration event
56 void afterRegistrationEvent (final UserRegisteredEvent event);
59 * Event observer for logged-in user
61 * @param event Event instance
63 void afterUserLogin (final UserLoggedInEvent event);
66 * All public user profiles
68 * @return A list of all public user profiles
70 List<User> allVisibleUsers ();
73 * Creates an instance from all properties
75 * @return A user instance
77 User createUserInstance ();
89 * @param userId User id
91 void setUserId (final Long userId);
94 * Getter for user name
98 String getUserName ();
101 * Setter for user name
103 * @param userName User name
105 void setUserName (final String userName);
108 * Getter for unencrypted user password
110 * @return Unencrypted user password
112 String getUserPassword ();
115 * Setter for unencrypted user password
117 * @param userPassword Unencrypted user password
119 void setUserPassword (final String userPassword);
122 * Getter for unencrypted user password repeated
124 * @return Unencrypted user password repeated
126 String getUserPasswordRepeat ();
129 * Setter for unencrypted user password repeated
131 * @param userPasswordRepeat Unencrypted user password repeated
133 void setUserPasswordRepeat (final String userPasswordRepeat);
136 * Getter for user profile mode
138 * @return User profile mode
140 ProfileMode getUserProfileMode ();
143 * Setter for user profile mode
145 * @param userProfileMode User profile mode
147 void setUserProfileMode (final ProfileMode userProfileMode);
150 * Checks whether all required personal data is set
152 * @return Whether the required personal data is set
154 boolean isRequiredPersonalDataSet ();
157 * Checks whether all required personal data is set for changing them
159 * @return Whether the required personal data is set
161 boolean isRequiredChangePersonalDataSet ();
164 * Checks whether same passwords has been entered
166 * @return Whether same passwords has been entered
168 boolean isSamePasswordEntered ();
171 * Checks whether given user instance's name is used
173 * @param user User instance's name to check
175 * @return Whether it is already used
177 boolean isUserNameRegistered (final User user);
180 * Checks whether a public user account is registered. This means that at
181 * least one user profile has its flag "public user profile" enabled.
183 * @return Whether at least one user has a public profile
185 boolean isVisibleUserFound ();
188 * Checks if the user id is empty
190 * @return Whether the user id is empty
192 boolean isUserIdEmpty ();
195 * Changes logged-in user's personal data if the current password matches
196 * and TAC + privacy statement has been accepted.
198 * @return New target page
200 String doChangePersonalData ();