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