2 * Copyright (C) 2016 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.addressbook.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 AddressbookUserWebSessionController extends Serializable {
35 * Minimum password length
37 public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
42 * @return A list of all public user profiles
44 List<User> allUsers ();
47 * All public user profiles
49 * @return A list of all public user profiles
51 List<User> allVisibleUsers ();
54 * Checks whether the given contact is a user
56 * @param contact Contact to check
58 * @return Whether the contact is a user
60 boolean isContactFound (final Contact contact);
63 * Checks whether a public user account is registered. This means that at
64 * least one user profile has its flag "public user profile" enabled.
66 * @return Whether at least one user has a public profile
68 boolean isVisibleUserFound ();
71 * Checks whether given user instance's name is used
73 * @param user User instance's name to check
75 * @return Whether it is already used
77 boolean isUserNameRegistered (final User user);
80 * Tries to lookup user by given id number. If the user is not found or the
81 * account status is not CONFIRMED proper exceptions are thrown.
83 * @param userId User id
85 * @return User instance
87 * @throws UserNotFoundException If the user is not found
89 User lookupUserById (final Long userId) throws UserNotFoundException;
92 * Tries to lookup user by given email address. If the user is not found a
93 * proper exceptions is thrown.
95 * @param emailAddress Email address
97 * @return User instance
99 * @throws UserEmailAddressNotFoundException If the user's email address is not found
101 User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
104 * Creates an instance from all properties
106 * @param createContactData Whether contact data should be created
108 * @return A user instance
110 User createUserInstance (final boolean createContactData);
113 * Creates a user instance for login phase
115 * @return User instance
117 User createUserLogin ();
129 * @param userId User id
131 void setUserId (final Long userId);
134 * Getter for user name
138 String getUserName ();
141 * Setter for user name
143 * @param userName User name
145 void setUserName (final String userName);
148 * Getter for clear-text user password
150 * @return Clear-text user password
152 String getUserPassword ();
155 * Setter for clear-text user password
157 * @param userPassword Clear-text user password
159 void setUserPassword (final String userPassword);
162 * Getter for clear-text user password repeated
164 * @return Clear-text user password repeated
166 String getUserPasswordRepeat ();
169 * Setter for clear-text user password repeated
171 * @param userPasswordRepeat Clear-text user password repeated
173 void setUserPasswordRepeat (final String userPasswordRepeat);
176 * Getter for user profile mode
178 * @return User profile mode
180 ProfileMode getUserProfileMode ();
183 * Setter for user profile mode
185 * @param userProfileMode User profile mode
187 void setUserProfileMode (final ProfileMode userProfileMode);
190 * Checks whether all required personal data is set
192 * @return Whether the required personal data is set
194 boolean isRequiredPersonalDataSet ();
197 * Checks whether all required personal data is set for changing them
199 * @return Whether the required personal data is set
201 boolean isRequiredChangePersonalDataSet ();
204 * Checks whether same passwords has been entered
206 * @return Whether same passwords has been entered
208 boolean isSamePasswordEntered ();
211 * Checks if the user id is empty
213 * @return Whether the user id is empty
215 boolean isUserIdEmpty ();
218 * Changes logged-in user's personal data if the current password matches
219 * and TAC + privacy statement has been accepted.
221 * @return New target page
223 String doChangePersonalData ();
226 * Checks whether this application requires a user name to be entered.
227 * Otherwise a random name like "userXXXXX" is generated
229 * @return Whether this application requires a user name
231 boolean isUserNameRequired ();
234 * Checks wether public user profiles are enabled. This requires that user
235 * names are also enabled.
237 * @return Whether public user profiles are enabled
239 boolean isPublicUserProfileEnabled ();