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