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;
27 * An interface for user beans
29 * @author Roland Häder<roland@mxchange.org>
31 public interface JobsUserWebSessionController extends Serializable {
34 * Minimum password length
36 * @deprecated Better set as context parameter
38 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
41 * Getter for clear-text user password
43 * @return Clear-text user password
45 String getUserPassword ();
48 * Checks if both user passwords are left empty and if this is enabled
49 * (allowed) in context parameter. If true, the calling bean should create a
50 * random password (preferable with UserUtils.createRandomPassword() and set
51 * it in both user password fields.
53 * @return Whether empty passwords are allowed
55 boolean ifBothPasswordsEmptyAllowed ();
60 * @return A list of all public user profiles
62 List<User> allUsers ();
65 * All public user profiles
67 * @return A list of all public user profiles
69 List<User> allVisibleUsers ();
72 * Checks whether the given contact is a user
74 * @param contact Contact to check
76 * @return Whether the contact is a user
78 boolean isContactFound (final Contact contact);
81 * Checks whether a public user account is registered. This means that at
82 * least one user profile has its flag "public user profile" enabled.
84 * @return Whether at least one user has a public profile
86 boolean isVisibleUserFound ();
89 * Checks whether given user instance's name is used
91 * @param user User instance's name to check
93 * @return Whether it is already used
95 boolean isUserNameRegistered (final User user);
98 * Tries to lookup user by given id number. If the user is not found or the
99 * account status is not CONFIRMED proper exceptions are thrown.
101 * @param userId User id
103 * @return User instance
105 * @throws UserNotFoundException If the user is not found
107 User lookupUserById (final Long userId) throws UserNotFoundException;
110 * Tries to lookup user by given email address. If the user is not found a
111 * proper exceptions is thrown.
113 * @param emailAddress Email address
115 * @return User instance
117 * @throws UserEmailAddressNotFoundException If the user's email address is
120 User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
123 * Creates an instance from all properties
125 * @param createContactData Whether contact data should be created
127 * @return A user instance
129 User createUserInstance (final boolean createContactData);
132 * Creates a user instance for login phase
134 * @return User instance
136 User createUserLogin ();
139 * Checks whether all required personal data is set
141 * @return Whether the required personal data is set
143 boolean isRequiredPersonalDataSet ();
146 * Checks whether all required personal data is set for changing them
148 * @return Whether the required personal data is set
150 boolean isRequiredChangePersonalDataSet ();
153 * Checks whether same passwords has been entered
155 * @return Whether same passwords has been entered
157 boolean isSamePasswordEntered ();
160 * Checks if the user id is empty
162 * @return Whether the user id is empty
164 boolean isUserIdEmpty ();
167 * Changes logged-in user's personal data if the current password matches
168 * and TAC + privacy statement has been accepted.
170 * @return New target page
172 String doChangePersonalData ();
175 * Checks whether this application requires a user name to be entered.
176 * Otherwise a random name like "userXXXXX" is generated
178 * @return Whether this application requires a user name
180 boolean isUserNameRequired ();
183 * Checks wether public user profiles are enabled. This requires that user
184 * names are also enabled.
186 * @return Whether public user profiles are enabled
188 boolean isPublicUserProfileEnabled ();