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.model.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 PizzaUserWebRequestController 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 * Checks whether the given contact is a user
67 * @param contact Contact to check
69 * @return Whether the contact is a user
71 boolean isContactFound (final Contact contact);
74 * Checks whether given user instance's name is used
76 * @param user User instance's name to check
78 * @return Whether it is already used
80 boolean isUserNameRegistered (final User user);
83 * Tries to lookup user by given id number. If the user is not found or the
84 * account status is not CONFIRMED proper exceptions are thrown.
86 * @param userId User id
88 * @return User instance
90 * @throws UserNotFoundException If the user is not found
92 User lookupUserById (final Long userId) throws UserNotFoundException;
95 * Tries to lookup user by given email address. If the user is not found a
96 * proper exceptions is thrown.
98 * @param emailAddress Email address
100 * @return User instance
102 * @throws UserEmailAddressNotFoundException If the user's email address is
105 User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
108 * Creates an instance from all properties
110 * @param createContactData Whether contact data should be created
112 * @return A user instance
114 User createUserInstance (final boolean createContactData);
117 * Creates a user instance for login phase
119 * @return User instance
121 User createUserLogin ();
124 * Checks whether all required personal data is set
126 * @return Whether the required personal data is set
128 boolean isRequiredPersonalDataSet ();
131 * Checks whether all required personal data is set for changing them
133 * @return Whether the required personal data is set
135 boolean isRequiredChangePersonalDataSet ();
138 * Checks whether same passwords has been entered
140 * @return Whether same passwords has been entered
142 boolean isSamePasswordEntered ();
145 * Checks if the user id is empty
147 * @return Whether the user id is empty
149 boolean isUserIdEmpty ();
152 * Changes logged-in user's personal data if the current password matches
153 * and TAC + privacy statement has been accepted.
155 * @return New target page
157 String doChangePersonalData ();
160 * Checks whether this application requires a user name to be entered.
161 * Otherwise a random name like "userXXXXX" is generated
163 * @return Whether this application requires a user name
165 boolean isUserNameRequired ();
168 * Checks wether public user profiles are enabled. This requires that user
169 * names are also enabled.
171 * @return Whether public user profiles are enabled
173 boolean isPublicUserProfileEnabled ();