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