]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java
Please cherry-pick:
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / user / PizzaUserWebSessionController.java
1 /*
2  * Copyright (C) 2016, 2017 Roland Häder
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.exceptions.UserEmailAddressNotFoundException;
23 import org.mxchange.jusercore.exceptions.UserNotFoundException;
24 import org.mxchange.jusercore.model.user.User;
25 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
26
27 /**
28  * An interface for user beans
29  * <p>
30  * @author Roland Häder<roland@mxchange.org>
31  */
32 public interface PizzaUserWebSessionController extends Serializable {
33
34         /**
35          * Minimum password length
36          */
37         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
38
39         /**
40          * Checks if both user passwords are left empty and if this is enabled
41          * (allowed) in context parameter. If true, the calling bean should create a
42          * random password (preferable with UserUtils.createRandomPassword() and set
43          * it in both user password fields.
44          * <p>
45          * @return Whether empty passwords are allowed
46          */
47         boolean ifBothPasswordsEmptyAllowed ();
48
49         /**
50          * All users
51          * <p>
52          * @return A list of all public user profiles
53          */
54         List<User> allUsers ();
55
56         /**
57          * All public user profiles
58          * <p>
59          * @return A list of all public user profiles
60          */
61         List<User> allVisibleUsers ();
62
63         /**
64          * Checks whether the given contact is a user
65          * <p>
66          * @param contact Contact to check
67          * <p>
68          * @return Whether the contact is a user
69          */
70         boolean isContactFound (final Contact contact);
71
72         /**
73          * Checks whether a public user account is registered. This means that at
74          * least one user profile has its flag "public user profile" enabled.
75          * <p>
76          * @return Whether at least one user has a public profile
77          */
78         boolean isVisibleUserFound ();
79
80         /**
81          * Checks whether given user instance's name is used
82          * <p>
83          * @param user User instance's name to check
84          * <p>
85          * @return Whether it is already used
86          */
87         boolean isUserNameRegistered (final User user);
88
89         /**
90          * Tries to lookup user by given id number. If the user is not found or the
91          * account status is not CONFIRMED proper exceptions are thrown.
92          * <p>
93          * @param userId User id
94          * <p>
95          * @return User instance
96          * <p>
97          * @throws UserNotFoundException If the user is not found
98          */
99         User lookupUserById (final Long userId) throws UserNotFoundException;
100
101         /**
102          * Tries to lookup user by given email address. If the user is not found a
103          * proper exceptions is thrown.
104          * <p>
105          * @param emailAddress Email address
106          * <p>
107          * @return User instance
108          * <p>
109          * @throws UserEmailAddressNotFoundException If the user's email address is
110          * not found
111          */
112         User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
113
114         /**
115          * Creates an instance from all properties
116          * <p>
117          * @param createContactData Whether contact data should be created
118          * <p>
119          * @return A user instance
120          */
121         User createUserInstance (final boolean createContactData);
122
123         /**
124          * Creates a user instance for login phase
125          * <p>
126          * @return User instance
127          */
128         User createUserLogin ();
129
130         /**
131          * Getter for user id
132          * <p>
133          * @return User id
134          */
135         Long getUserId ();
136
137         /**
138          * Setter for user id
139          * <p>
140          * @param userId User id
141          */
142         void setUserId (final Long userId);
143
144         /**
145          * Getter for user name
146          * <p>
147          * @return User name
148          */
149         String getUserName ();
150
151         /**
152          * Setter for user name
153          * <p>
154          * @param userName User name
155          */
156         void setUserName (final String userName);
157
158         /**
159          * Getter for clear-text user password
160          * <p>
161          * @return Clear-text user password
162          */
163         String getUserPassword ();
164
165         /**
166          * Setter for clear-text user password
167          * <p>
168          * @param userPassword Clear-text user password
169          */
170         void setUserPassword (final String userPassword);
171
172         /**
173          * Getter for clear-text user password repeated
174          * <p>
175          * @return Clear-text user password repeated
176          */
177         String getUserPasswordRepeat ();
178
179         /**
180          * Setter for clear-text user password repeated
181          * <p>
182          * @param userPasswordRepeat Clear-text user password repeated
183          */
184         void setUserPasswordRepeat (final String userPasswordRepeat);
185
186         /**
187          * Getter for user profile mode
188          * <p>
189          * @return User profile mode
190          */
191         ProfileMode getUserProfileMode ();
192
193         /**
194          * Setter for user profile mode
195          * <p>
196          * @param userProfileMode User profile mode
197          */
198         void setUserProfileMode (final ProfileMode userProfileMode);
199
200         /**
201          * Checks whether all required personal data is set
202          * <p>
203          * @return Whether the required personal data is set
204          */
205         boolean isRequiredPersonalDataSet ();
206
207         /**
208          * Checks whether all required personal data is set for changing them
209          * <p>
210          * @return Whether the required personal data is set
211          */
212         boolean isRequiredChangePersonalDataSet ();
213
214         /**
215          * Checks whether same passwords has been entered
216          * <p>
217          * @return Whether same passwords has been entered
218          */
219         boolean isSamePasswordEntered ();
220
221         /**
222          * Checks if the user id is empty
223          * <p>
224          * @return Whether the user id is empty
225          */
226         boolean isUserIdEmpty ();
227
228         /**
229          * Changes logged-in user's personal data if the current password matches
230          * and TAC + privacy statement has been accepted.
231          * <p>
232          * @return New target page
233          */
234         String doChangePersonalData ();
235
236         /**
237          * Checks whether this application requires a user name to be entered.
238          * Otherwise a random name like "userXXXXX" is generated
239          * <p>
240          * @return Whether this application requires a user name
241          */
242         boolean isUserNameRequired ();
243
244         /**
245          * Checks wether public user profiles are enabled. This requires that user
246          * names are also enabled.
247          * <p>
248          * @return Whether public user profiles are enabled
249          */
250         boolean isPublicUserProfileEnabled ();
251
252 }