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.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.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 PizzaUserWebSessionController 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 * Clears both user passwords
50 void clearUserPasswords ();
55 void clearUserName ();
58 * Checks if both user passwords are left empty and if this is enabled
59 * (allowed) in context parameter. If true, the calling bean should create a
60 * random password (preferable with UserUtils.createRandomPassword() and set
61 * it in both user password fields.
63 * @return Whether empty passwords are allowed
65 boolean ifBothPasswordsEmptyAllowed ();
70 * @return A list of all public user profiles
72 List<User> allUsers ();
75 * All public user profiles
77 * @return A list of all public user profiles
79 List<User> allVisibleUsers ();
82 * Checks whether the given contact is a user
84 * @param contact Contact to check
86 * @return Whether the contact is a user
88 boolean isContactFound (final Contact contact);
91 * Checks whether a public user account is registered. This means that at
92 * least one user profile has its flag "public user profile" enabled.
94 * @return Whether at least one user has a public profile
96 boolean isVisibleUserFound ();
99 * Checks whether given user instance's name is used
101 * @param user User instance's name to check
103 * @return Whether it is already used
105 boolean isUserNameRegistered (final User user);
108 * Tries to lookup user by given id number. If the user is not found or the
109 * account status is not CONFIRMED proper exceptions are thrown.
111 * @param userId User id
113 * @return User instance
115 * @throws UserNotFoundException If the user is not found
117 User lookupUserById (final Long userId) throws UserNotFoundException;
120 * Tries to lookup user by given email address. If the user is not found a
121 * proper exceptions is thrown.
123 * @param emailAddress Email address
125 * @return User instance
127 * @throws UserEmailAddressNotFoundException If the user's email address is
130 User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
133 * Creates an instance from all properties
135 * @param createContactData Whether contact data should be created
137 * @return A user instance
139 User createUserInstance (final boolean createContactData);
142 * Creates a user instance for login phase
144 * @return User instance
146 User createUserLogin ();
149 * Checks whether all required personal data is set
151 * @return Whether the required personal data is set
153 boolean isRequiredPersonalDataSet ();
156 * Checks whether all required personal data is set for changing them
158 * @return Whether the required personal data is set
160 boolean isRequiredChangePersonalDataSet ();
163 * Checks whether same passwords has been entered
165 * @return Whether same passwords has been entered
167 boolean isSamePasswordEntered ();
170 * Checks if the user id is empty
172 * @return Whether the user id is empty
174 boolean isUserIdEmpty ();
177 * Changes logged-in user's personal data if the current password matches
178 * and TAC + privacy statement has been accepted.
180 * @return New target page
182 String doChangePersonalData ();
185 * Checks whether this application requires a user name to be entered.
186 * Otherwise a random name like "userXXXXX" is generated
188 * @return Whether this application requires a user name
190 boolean isUserNameRequired ();
193 * Checks wether public user profiles are enabled. This requires that user
194 * names are also enabled.
196 * @return Whether public user profiles are enabled
198 boolean isPublicUserProfileEnabled ();