]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / user / JobsUserWebSessionController.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.confirmation.UserConfirmedAccountEvent;
23 import org.mxchange.jusercore.events.login.UserLoggedInEvent;
24 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
25 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
26 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
27 import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
28 import org.mxchange.jusercore.events.user.password_change.UpdatedUserPasswordEvent;
29 import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
30 import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
31 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
32 import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException;
33 import org.mxchange.jusercore.exceptions.UserNotFoundException;
34 import org.mxchange.jusercore.model.user.User;
35 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
36
37 /**
38  * An interface for user beans
39  * <p>
40  * @author Roland Haeder<roland@mxchange.org>
41  */
42 public interface JobsUserWebSessionController extends Serializable {
43
44         /**
45          * Minimum password length
46          */
47         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
48
49         /**
50          * Event observer for newly added users by adminstrator
51          * <p>
52          * @param event Event being fired
53          */
54         void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
55
56         /**
57          * Event observer for linked users with existing contact data
58          * <p>
59          * @param event Event being fired
60          */
61         void afterAdminLinkedUserEvent (final AdminLinkedUserEvent event);
62
63         /**
64          * Event observer for locked users
65          * <p>
66          * @param event Event being fired
67          */
68         void afterAdminLockedUserEvent (final AdminLockedUserEvent event);
69
70         /**
71          * Event observer for unlocked users
72          * <p>
73          * @param event Event being fired
74          */
75         void afterAdminUnlockedUserEvent (final AdminUnlockedUserEvent event);
76
77         /**
78          * Event observer for updated user data by administrator
79          * <p>
80          * @param event Event being updated
81          */
82         void afterAdminUpdatedUserDataEvent (final AdminUpdatedUserDataEvent event);
83
84         /**
85          * Event observer when user confirmed account.
86          * <p>
87          * @param event Event being fired
88          */
89         void afterUserConfirmedAccountEvent (final UserConfirmedAccountEvent event);
90
91         /**
92          * Method being call after user's password has been updated (and history
93          * entry has been created).
94          * <p>
95          * @param event Event being observed
96          */
97         void afterUserUpdatedPasswordEvent (final UpdatedUserPasswordEvent event);
98
99         /**
100          * Listens to fired event when user updated personal data
101          * <p>
102          * @param event Event being fired
103          */
104         void afterUserUpdatedPersonalDataEvent (final UpdatedUserPersonalDataEvent event);
105
106         /**
107          * Event observer for new user registrations
108          * <p>
109          * @param event User registration event
110          */
111         void afterUserRegistrationEvent (final UserRegisteredEvent event);
112
113         /**
114          * Event observer for logged-in user
115          * <p>
116          * @param event Event instance
117          */
118         void afterUserLoginEvent (final UserLoggedInEvent event);
119
120         /**
121          * All users
122          * <p>
123          * @return A list of all public user profiles
124          */
125         List<User> allUsers ();
126
127         /**
128          * All public user profiles
129          * <p>
130          * @return A list of all public user profiles
131          */
132         List<User> allVisibleUsers ();
133
134         /**
135          * Checks whether the given contact is a user
136          * <p>
137          * @param contact Contact to check
138          * <p>
139          * @return Whether the contact is a user
140          */
141         boolean isContactFound (final Contact contact);
142
143         /**
144          * Checks whether a public user account is registered. This means that at
145          * least one user profile has its flag "public user profile" enabled.
146          * <p>
147          * @return Whether at least one user has a public profile
148          */
149         boolean isVisibleUserFound ();
150
151         /**
152          * Checks whether given user instance's name is used
153          * <p>
154          * @param user User instance's name to check
155          * <p>
156          * @return Whether it is already used
157          */
158         boolean isUserNameRegistered (final User user);
159
160         /**
161          * Tries to lookup user by given id number. If the user is not found or the
162          * account status is not CONFIRMED proper exceptions are thrown.
163          * <p>
164          * @param userId User id
165          * <p>
166          * @return User instance
167          * <p>
168          * @throws UserNotFoundException If the user is not found
169          */
170         User lookupUserById (final Long userId) throws UserNotFoundException;
171
172         /**
173          * Tries to lookup user by given email address. If the user is not found a
174          * proper exceptions is thrown.
175          * <p>
176          * @param emailAddress Email address
177          * <p>
178          * @return User instance
179          * <p>
180          * @throws UserEmailAddressNotFoundException If the user's email address is not found
181          */
182         User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
183
184         /**
185          * Creates an instance from all properties
186          * <p>
187          * @param createContactData Whether contact data should be created
188          * <p>
189          * @return A user instance
190          */
191         User createUserInstance (final boolean createContactData);
192
193         /**
194          * Creates a user instance for login phase
195          * <p>
196          * @return User instance
197          */
198         User createUserLogin ();
199
200         /**
201          * Getter for user id
202          * <p>
203          * @return User id
204          */
205         Long getUserId ();
206
207         /**
208          * Setter for user id
209          * <p>
210          * @param userId User id
211          */
212         void setUserId (final Long userId);
213
214         /**
215          * Getter for user name
216          * <p>
217          * @return User name
218          */
219         String getUserName ();
220
221         /**
222          * Setter for user name
223          * <p>
224          * @param userName User name
225          */
226         void setUserName (final String userName);
227
228         /**
229          * Getter for unencrypted user password
230          * <p>
231          * @return Unencrypted user password
232          */
233         String getUserPassword ();
234
235         /**
236          * Setter for unencrypted user password
237          * <p>
238          * @param userPassword Unencrypted user password
239          */
240         void setUserPassword (final String userPassword);
241
242         /**
243          * Getter for unencrypted user password repeated
244          * <p>
245          * @return Unencrypted user password repeated
246          */
247         String getUserPasswordRepeat ();
248
249         /**
250          * Setter for unencrypted user password repeated
251          * <p>
252          * @param userPasswordRepeat Unencrypted user password repeated
253          */
254         void setUserPasswordRepeat (final String userPasswordRepeat);
255
256         /**
257          * Getter for user profile mode
258          * <p>
259          * @return User profile mode
260          */
261         ProfileMode getUserProfileMode ();
262
263         /**
264          * Setter for user profile mode
265          * <p>
266          * @param userProfileMode User profile mode
267          */
268         void setUserProfileMode (final ProfileMode userProfileMode);
269
270         /**
271          * Checks whether all required personal data is set
272          * <p>
273          * @return Whether the required personal data is set
274          */
275         boolean isRequiredPersonalDataSet ();
276
277         /**
278          * Checks whether all required personal data is set for changing them
279          * <p>
280          * @return Whether the required personal data is set
281          */
282         boolean isRequiredChangePersonalDataSet ();
283
284         /**
285          * Checks whether same passwords has been entered
286          * <p>
287          * @return Whether same passwords has been entered
288          */
289         boolean isSamePasswordEntered ();
290
291         /**
292          * Checks if the user id is empty
293          * <p>
294          * @return Whether the user id is empty
295          */
296         boolean isUserIdEmpty ();
297
298         /**
299          * Changes logged-in user's personal data if the current password matches
300          * and TAC + privacy statement has been accepted.
301          * <p>
302          * @return New target page
303          */
304         String doChangePersonalData ();
305
306         /**
307          * Checks whether this application requires a user name to be entered.
308          * Otherwise a random name like "userXXXXX" is generated
309          * <p>
310          * @return Whether this application requires a user name
311          */
312         boolean isUserNameRequired ();
313
314         /**
315          * Checks wether public user profiles are enabled. This requires that user
316          * names are also enabled.
317          * <p>
318          * @return Whether public user profiles are enabled
319          */
320         boolean isPublicUserProfileEnabled ();
321
322 }