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