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.jjobs.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 JobsAdminUserWebRequestController 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 * Checks whether the given contact is a user
59 * @param contact Contact to check
61 * @return Whether the contact is a user
63 boolean isContactFound (final Contact contact);
66 * Checks whether a public user account is registered. This means that at
67 * least one user profile has its flag "public user profile" enabled.
69 * @return Whether at least one user has a public profile
71 boolean isVisibleUserFound ();
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;
97 * @return A list of all public user profiles
99 List<User> allUsers ();
102 * All public user profiles
104 * @return A list of all public user profiles
106 List<User> allVisibleUsers ();
109 * Checks whether users are registered
111 * @return Whether users are registered
116 * Adds user instance to database by preparing a complete user instance and
117 * sending it to the EJB. The data set in the controller is being verified,
118 * e.g. if the user name or email address is not used yet.
120 * @return Redirect outcome
125 * Edits cuirrently loaded user's data in database.
127 * @return Redirect outcome
129 String editUserData ();
132 * Getter for user name
136 String getUserName ();
139 * Setter for user name
141 * @param userName User name
143 void setUserName (final String userName);
146 * Getter for unencrypted user password
148 * @return Unencrypted user password
150 String getUserPassword ();
153 * Setter for unencrypted user password
155 * @param userPassword Unencrypted user password
157 void setUserPassword (final String userPassword);
160 * Getter for unencrypted user password repeated
162 * @return Unencrypted user password repeated
164 String getUserPasswordRepeat ();
167 * Setter for unencrypted user password repeated
169 * @param userPasswordRepeat Unencrypted user password repeated
171 void setUserPasswordRepeat (final String userPasswordRepeat);
174 * Returns a list of all selectable contacts for user creation. Contacts
175 * from already existing users are excluded in this list.
177 * @return A list of all selectable contacts
179 List<Contact> selectableContacts ();