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.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 JobsUserWebRequestController extends Serializable {
34 * Minimum password length
36 * @deprecated Better set as context parameter
39 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
42 * Getter for clear-text user password
44 * @return Clear-text user password
46 String getUserPassword ();
49 * Checks if both user passwords are left empty and if this is enabled
50 * (allowed) in context parameter. If true, the calling bean should create a
51 * random password (preferable with UserUtils.createRandomPassword() and set
52 * it in both user password fields.
54 * @return Whether empty passwords are allowed
56 boolean ifBothPasswordsEmptyAllowed ();
61 * @return A list of all public user profiles
63 List<User> allUsers ();
66 * Checks whether the given contact is a user
68 * @param contact Contact to check
70 * @return Whether the contact is a user
72 boolean isContactFound (final Contact contact);
75 * Checks whether given user instance's name is used
77 * @param user User instance's name to check
79 * @return Whether it is already used
81 boolean isUserNameRegistered (final User user);
84 * Tries to lookup user by given id number. If the user is not found or the
85 * account status is not CONFIRMED proper exceptions are thrown.
87 * @param userId User id
89 * @return User instance
91 * @throws UserNotFoundException If the user is not found
93 User lookupUserById (final Long userId) throws UserNotFoundException;
96 * Tries to lookup user by given email address. If the user is not found a
97 * proper exceptions is thrown.
99 * @param emailAddress Email address
101 * @return User instance
103 * @throws UserEmailAddressNotFoundException If the user's email address is
106 User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
109 * Creates an instance from all properties
111 * @param createContactData Whether contact data should be created
113 * @return A user instance
115 User createUserInstance (final boolean createContactData);
118 * Creates a user instance for login phase
120 * @return User instance
122 User createUserLogin ();
125 * Checks whether all required personal data is set
127 * @return Whether the required personal data is set
129 boolean isRequiredPersonalDataSet ();
132 * Checks whether all required personal data is set for changing them
134 * @return Whether the required personal data is set
136 boolean isRequiredChangePersonalDataSet ();
139 * Checks whether same passwords has been entered
141 * @return Whether same passwords has been entered
143 boolean isSamePasswordEntered ();
146 * Checks if the user id is empty
148 * @return Whether the user id is empty
150 boolean isUserIdEmpty ();
153 * Changes logged-in user's personal data if the current password matches
154 * and TAC + privacy statement has been accepted.
156 * @return New target page
158 String doChangePersonalData ();
161 * Checks whether this application requires a user name to be entered.
162 * Otherwise a random name like "userXXXXX" is generated
164 * @return Whether this application requires a user name
166 boolean isUserNameRequired ();
169 * Checks wether public user profiles are enabled. This requires that user
170 * names are also enabled.
172 * @return Whether public user profiles are enabled
174 boolean isPublicUserProfileEnabled ();