2 * Copyright (C) 2016, 2017 Roland Häder
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.jcontacts.contact.Contact;
22 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
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 Häder<roland@mxchange.org>
32 public interface JobsUserWebSessionController extends Serializable {
35 * Minimum password length
37 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
40 * Checks if both user passwords are left empty and if this is enabled
41 * (allowed) in context parameter. If true, the calling bean should create a
42 * random password (preferable with UserUtils.createRandomPassword() and set
43 * it in both user password fields.
45 * @return Whether empty passwords are allowed
47 boolean ifBothPasswordsEmptyAllowed ();
52 * @return A list of all public user profiles
54 List<User> allUsers ();
57 * All public user profiles
59 * @return A list of all public user profiles
61 List<User> allVisibleUsers ();
64 * Checks whether the given contact is a user
66 * @param contact Contact to check
68 * @return Whether the contact is a user
70 boolean isContactFound (final Contact contact);
73 * Checks whether a public user account is registered. This means that at
74 * least one user profile has its flag "public user profile" enabled.
76 * @return Whether at least one user has a public profile
78 boolean isVisibleUserFound ();
81 * Checks whether given user instance's name is used
83 * @param user User instance's name to check
85 * @return Whether it is already used
87 boolean isUserNameRegistered (final User user);
90 * Tries to lookup user by given id number. If the user is not found or the
91 * account status is not CONFIRMED proper exceptions are thrown.
93 * @param userId User id
95 * @return User instance
97 * @throws UserNotFoundException If the user is not found
99 User lookupUserById (final Long userId) throws UserNotFoundException;
102 * Tries to lookup user by given email address. If the user is not found a
103 * proper exceptions is thrown.
105 * @param emailAddress Email address
107 * @return User instance
109 * @throws UserEmailAddressNotFoundException If the user's email address is
112 User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
115 * Creates an instance from all properties
117 * @param createContactData Whether contact data should be created
119 * @return A user instance
121 User createUserInstance (final boolean createContactData);
124 * Creates a user instance for login phase
126 * @return User instance
128 User createUserLogin ();
140 * @param userId User id
142 void setUserId (final Long userId);
145 * Getter for user name
149 String getUserName ();
152 * Setter for user name
154 * @param userName User name
156 void setUserName (final String userName);
159 * Getter for clear-text user password
161 * @return Clear-text user password
163 String getUserPassword ();
166 * Setter for clear-text user password
168 * @param userPassword Clear-text user password
170 void setUserPassword (final String userPassword);
173 * Getter for clear-text user password repeated
175 * @return Clear-text user password repeated
177 String getUserPasswordRepeat ();
180 * Setter for clear-text user password repeated
182 * @param userPasswordRepeat Clear-text user password repeated
184 void setUserPasswordRepeat (final String userPasswordRepeat);
187 * Getter for user profile mode
189 * @return User profile mode
191 ProfileMode getUserProfileMode ();
194 * Setter for user profile mode
196 * @param userProfileMode User profile mode
198 void setUserProfileMode (final ProfileMode userProfileMode);
201 * Checks whether all required personal data is set
203 * @return Whether the required personal data is set
205 boolean isRequiredPersonalDataSet ();
208 * Checks whether all required personal data is set for changing them
210 * @return Whether the required personal data is set
212 boolean isRequiredChangePersonalDataSet ();
215 * Checks whether same passwords has been entered
217 * @return Whether same passwords has been entered
219 boolean isSamePasswordEntered ();
222 * Checks if the user id is empty
224 * @return Whether the user id is empty
226 boolean isUserIdEmpty ();
229 * Changes logged-in user's personal data if the current password matches
230 * and TAC + privacy statement has been accepted.
232 * @return New target page
234 String doChangePersonalData ();
237 * Checks whether this application requires a user name to be entered.
238 * Otherwise a random name like "userXXXXX" is generated
240 * @return Whether this application requires a user name
242 boolean isUserNameRequired ();
245 * Checks wether public user profiles are enabled. This requires that user
246 * names are also enabled.
248 * @return Whether public user profiles are enabled
250 boolean isPublicUserProfileEnabled ();