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