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