]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestController.java
Rewrites:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / user / JobsAdminUserWebRequestController.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.jjobs.beans.user;
18
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;
27
28 /**
29  * An interface for user beans
30  * <p>
31  * @author Roland Haeder<roland@mxchange.org>
32  */
33 public interface JobsAdminUserWebRequestController extends Serializable {
34
35         /**
36          * Event observer for new user registrations
37          * <p>
38          * @param event User registration event
39          */
40         void afterRegistrationEvent (final UserRegisteredEvent event);
41
42         /**
43          * Event observer for logged-in user
44          * <p>
45          * @param event Event instance
46          */
47         void afterUserLogin (final UserLoggedInEvent event);
48
49         /**
50          * Listens to fired event when user updated personal data
51          * <p>
52          * @param event Event being fired
53          */
54         void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
55
56         /**
57          * Checks whether the given contact is a user
58          * <p>
59          * @param contact Contact to check
60          * <p>
61          * @return Whether the contact is a user
62          */
63         boolean isContactFound (final Contact contact);
64
65         /**
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.
68          * <p>
69          * @return Whether at least one user has a public profile
70          */
71         boolean isVisibleUserFound ();
72
73         /**
74          * Checks whether given user instance's name is used
75          * <p>
76          * @param user User instance's name to check
77          * <p>
78          * @return Whether it is already used
79          */
80         boolean isUserNameRegistered (final User user);
81
82         /**
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.
85          * <p>
86          * @param userId User id
87          * <p>
88          * @return User instance
89          * <p>
90          * @throws UserNotFoundException If the user is not found
91          */
92         User lookupUserById (final Long userId) throws UserNotFoundException;
93
94         /**
95          * All users
96          * <p>
97          * @return A list of all public user profiles
98          */
99         List<User> allUsers ();
100
101         /**
102          * All public user profiles
103          * <p>
104          * @return A list of all public user profiles
105          */
106         List<User> allVisibleUsers ();
107
108         /**
109          * Checks whether users are registered
110          * <p>
111          * @return Whether users are registered
112          */
113         boolean hasUsers ();
114
115         /**
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.
119          * <p>
120          * @return Redirect outcome
121          */
122         String addUser ();
123
124         /**
125          * Edits cuirrently loaded user's data in database.
126          * <p>
127          * @return Redirect outcome
128          */
129         String editUserData ();
130
131         /**
132          * Getter for user name
133          * <p>
134          * @return User name
135          */
136         String getUserName ();
137
138         /**
139          * Setter for user name
140          * <p>
141          * @param userName User name
142          */
143         void setUserName (final String userName);
144
145         /**
146          * Getter for unencrypted user password
147          * <p>
148          * @return Unencrypted user password
149          */
150         String getUserPassword ();
151
152         /**
153          * Setter for unencrypted user password
154          * <p>
155          * @param userPassword Unencrypted user password
156          */
157         void setUserPassword (final String userPassword);
158
159         /**
160          * Getter for unencrypted user password repeated
161          * <p>
162          * @return Unencrypted user password repeated
163          */
164         String getUserPasswordRepeat ();
165
166         /**
167          * Setter for unencrypted user password repeated
168          * <p>
169          * @param userPasswordRepeat Unencrypted user password repeated
170          */
171         void setUserPasswordRepeat (final String userPasswordRepeat);
172
173         /**
174          * Returns a list of all selectable contacts for user creation. Contacts
175          * from already existing users are excluded in this list.
176          * <p>
177          * @return A list of all selectable contacts
178          */
179         List<Contact> selectableContacts ();
180
181 }