2 * Copyright (C) 2016 Roland Haeder
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.events.login.UserLoggedInEvent;
23 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
24 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
25 import org.mxchange.jusercore.exceptions.UserNotFoundException;
26 import org.mxchange.jusercore.model.user.User;
29 * An interface for user beans
31 * @author Roland Haeder<roland@mxchange.org>
33 public interface AddressbookAdminUserWebRequestController extends Serializable {
36 * Event observer for new user registrations
38 * @param event User registration event
40 void afterRegistrationEvent (final UserRegisteredEvent event);
43 * Event observer for logged-in user
45 * @param event Event instance
47 void afterUserLogin (final UserLoggedInEvent event);
50 * Listens to fired event when user updated personal data
52 * @param event Event being fired
54 void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
57 * All public user profiles
59 * @return A list of all public user profiles
61 List<User> allVisibleUsers ();
64 * Returns a list of all selectable contacts for user creation. Contacts
65 * from already existing users are excluded in this list.
67 * @return A list of all selectable contacts
69 List<Contact> selectableContacts ();
72 * Updates list with given user
74 * @param user User to update
76 void updateList (final User user);
79 * Checks whether the given contact is a user
81 * @param contact Contact to check
83 * @return Whether the contact is a user
85 boolean isContactFound (final Contact contact);
88 * Checks whether a public user account is registered. This means that at
89 * least one user profile has its flag "public user profile" enabled.
91 * @return Whether at least one user has a public profile
93 boolean isVisibleUserFound ();
96 * Checks whether given user instance's name is used
98 * @param user User instance's name to check
100 * @return Whether it is already used
102 boolean isUserNameRegistered (final User user);
105 * Tries to lookup user by given id number. If the user is not found or the
106 * account status is not CONFIRMED proper exceptions are thrown.
108 * @param userId User id
110 * @return User instance
112 * @throws UserNotFoundException If the user is not found
114 User lookupUserById (final Long userId) throws UserNotFoundException;
119 * @return A list of all public user profiles
121 List<User> allUsers ();
124 * Checks whether users are registered
126 * @return Whether users are registered
131 * Adds user instance to database by preparing a complete user instance and
132 * sending it to the EJB. The data set in the controller is being verified,
133 * e.g. if the user name or email address is not used yet.
135 * @return Redirect outcome
140 * Edits cuirrently loaded user's data in database.
142 * @return Redirect outcome
144 String editUserData ();
147 * Getter for user name
151 String getUserName ();
154 * Setter for user name
156 * @param userName User name
158 void setUserName (final String userName);
161 * Getter for unencrypted user password
163 * @return Unencrypted user password
165 String getUserPassword ();
168 * Setter for unencrypted user password
170 * @param userPassword Unencrypted user password
172 void setUserPassword (final String userPassword);
175 * Getter for unencrypted user password repeated
177 * @return Unencrypted user password repeated
179 String getUserPasswordRepeat ();
182 * Setter for unencrypted user password repeated
184 * @param userPasswordRepeat Unencrypted user password repeated
186 void setUserPasswordRepeat (final String userPasswordRepeat);