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