]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java
Continued again with customer:
[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         /**
73          * Updates list with given user
74          * <p>
75          * @param user User to update
76          */
77         void updateList (final User user);
78
79         /**
80          * Returns a list of all selectable contacts for user creation. Contacts
81          * from already existing users are excluded in this list.
82          * <p>
83          * @return A list of all selectable contacts
84          */
85         List<Contact> selectableContacts ();
86
87         /**
88          * Tries to lookup user by given id number. If the user is not found or the
89          * account status is not CONFIRMED proper exceptions are thrown.
90          * <p>
91          * @param userId User id
92          * <p>
93          * @return User instance
94          * <p>
95          * @throws UserNotFoundException If the user is not found
96          */
97         User lookupUserById (final Long userId) throws UserNotFoundException;
98
99         /**
100          * Event observer for newly added users by an administrator
101          * <p>
102          * @param event Event being fired
103          */
104         void afterAdminAddedUserEvent (final AdminAddedUserEvent event);
105
106         /**
107          * Event observer for new user registrations
108          * <p>
109          * @param event User registration event
110          */
111         void afterRegistrationEvent (final UserRegisteredEvent event);
112
113         /**
114          * Event observer for logged-in user
115          * <p>
116          * @param event Event instance
117          */
118         void afterUserLogin (final UserLoggedInEvent event);
119
120         /**
121          * All public user profiles
122          * <p>
123          * @return A list of all public user profiles
124          */
125         List<User> allVisibleUsers ();
126
127         /**
128          * Creates an instance from all properties
129          * <p>
130          * @return A user instance
131          */
132         User createUserInstance ();
133
134         /**
135          * Getter for user id
136          * <p>
137          * @return User id
138          */
139         Long getUserId ();
140
141         /**
142          * Setter for user id
143          * <p>
144          * @param userId User id
145          */
146         void setUserId (final Long userId);
147
148         /**
149          * Getter for user name
150          * <p>
151          * @return User name
152          */
153         String getUserName ();
154
155         /**
156          * Setter for user name
157          * <p>
158          * @param userName User name
159          */
160         void setUserName (final String userName);
161
162         /**
163          * Getter for unencrypted user password
164          * <p>
165          * @return Unencrypted user password
166          */
167         String getUserPassword ();
168
169         /**
170          * Setter for unencrypted user password
171          * <p>
172          * @param userPassword Unencrypted user password
173          */
174         void setUserPassword (final String userPassword);
175
176         /**
177          * Getter for unencrypted user password repeated
178          * <p>
179          * @return Unencrypted user password repeated
180          */
181         String getUserPasswordRepeat ();
182
183         /**
184          * Setter for unencrypted user password repeated
185          * <p>
186          * @param userPasswordRepeat Unencrypted user password repeated
187          */
188         void setUserPasswordRepeat (final String userPasswordRepeat);
189
190         /**
191          * Getter for user profile mode
192          * <p>
193          * @return User profile mode
194          */
195         ProfileMode getUserProfileMode ();
196
197         /**
198          * Setter for user profile mode
199          * <p>
200          * @param userProfileMode User profile mode
201          */
202         void setUserProfileMode (final ProfileMode userProfileMode);
203
204         /**
205          * Checks whether all required personal data is set
206          * <p>
207          * @return Whether the required personal data is set
208          */
209         boolean isRequiredPersonalDataSet ();
210
211         /**
212          * Checks whether all required personal data is set for changing them
213          * <p>
214          * @return Whether the required personal data is set
215          */
216         boolean isRequiredChangePersonalDataSet ();
217
218         /**
219          * Checks whether same passwords has been entered
220          * <p>
221          * @return Whether same passwords has been entered
222          */
223         boolean isSamePasswordEntered ();
224
225         /**
226          * Checks whether given user instance's name is used
227          * <p>
228          * @param user User instance's name to check
229          * <p>
230          * @return Whether it is already used
231          */
232         boolean isUserNameRegistered (final User user);
233
234         /**
235          * Checks whether a public user account is registered. This means that at
236          * least one user profile has its flag "public user profile" enabled.
237          * <p>
238          * @return Whether at least one user has a public profile
239          */
240         boolean isVisibleUserFound ();
241
242         /**
243          * Checks if the user id is empty
244          * <p>
245          * @return Whether the user id is empty
246          */
247         boolean isUserIdEmpty ();
248
249         /**
250          * Changes logged-in user's personal data if the current password matches
251          * and TAC + privacy statement has been accepted.
252          * <p>
253          * @return New target page
254          */
255         String doChangePersonalData ();
256
257 }