]> git.mxchange.org Git - pizzaservice-war.git/blob - src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebRequestController.java
c820987d31ce2aae258e103a5f40a863cdbeddfc
[pizzaservice-war.git] / src / java / org / mxchange / pizzaapplication / beans / user / PizzaUserWebRequestController.java
1 /*
2  * Copyright (C) 2016 - 2022 Free Software Foundation
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         @Deprecated
39         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
40
41         /**
42          * Getter for clear-text user password
43          * <p>
44          * @return Clear-text user password
45          */
46         String getUserPassword ();
47
48         /**
49          * Checks if both user passwords are left empty and if this is enabled
50          * (allowed) in context parameter. If true, the calling bean should create a
51          * random password (preferable with UserUtils.createRandomPassword() and set
52          * it in both user password fields.
53          * <p>
54          * @return Whether empty passwords are allowed
55          */
56         boolean ifBothPasswordsEmptyAllowed ();
57
58         /**
59          * All users
60          * <p>
61          * @return A list of all public user profiles
62          */
63         List<User> allUsers ();
64
65         /**
66          * Checks whether the given contact is a user
67          * <p>
68          * @param contact Contact to check
69          * <p>
70          * @return Whether the contact is a user
71          */
72         boolean isContactFound (final Contact contact);
73
74         /**
75          * Checks whether given user instance's name is used
76          * <p>
77          * @param user User instance's name to check
78          * <p>
79          * @return Whether it is already used
80          */
81         boolean isUserNameRegistered (final User user);
82
83         /**
84          * Tries to lookup user by given id number. If the user is not found or the
85          * account status is not CONFIRMED proper exceptions are thrown.
86          * <p>
87          * @param userId User id
88          * <p>
89          * @return User instance
90          * <p>
91          * @throws UserNotFoundException If the user is not found
92          */
93         User lookupUserById (final Long userId) throws UserNotFoundException;
94
95         /**
96          * Tries to lookup user by given email address. If the user is not found a
97          * proper exceptions is thrown.
98          * <p>
99          * @param emailAddress Email address
100          * <p>
101          * @return User instance
102          * <p>
103          * @throws UserEmailAddressNotFoundException If the user's email address is
104          * not found
105          */
106         User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
107
108         /**
109          * Creates an instance from all properties
110          * <p>
111          * @param createContactData Whether contact data should be created
112          * <p>
113          * @return A user instance
114          */
115         User createUserInstance (final boolean createContactData);
116
117         /**
118          * Creates a user instance for login phase
119          * <p>
120          * @return User instance
121          */
122         User createUserLogin ();
123
124         /**
125          * Checks whether all required personal data is set
126          * <p>
127          * @return Whether the required personal data is set
128          */
129         boolean isRequiredPersonalDataSet ();
130
131         /**
132          * Checks whether all required personal data is set for changing them
133          * <p>
134          * @return Whether the required personal data is set
135          */
136         boolean isRequiredChangePersonalDataSet ();
137
138         /**
139          * Checks whether same passwords has been entered
140          * <p>
141          * @return Whether same passwords has been entered
142          */
143         boolean isSamePasswordEntered ();
144
145         /**
146          * Checks if the user id is empty
147          * <p>
148          * @return Whether the user id is empty
149          */
150         boolean isUserIdEmpty ();
151
152         /**
153          * Changes logged-in user's personal data if the current password matches
154          * and TAC + privacy statement has been accepted.
155          * <p>
156          * @return New target page
157          */
158         String doChangePersonalData ();
159
160         /**
161          * Checks whether this application requires a user name to be entered.
162          * Otherwise a random name like "userXXXXX" is generated
163          * <p>
164          * @return Whether this application requires a user name
165          */
166         boolean isUserNameRequired ();
167
168         /**
169          * Checks wether public user profiles are enabled. This requires that user
170          * names are also enabled.
171          * <p>
172          * @return Whether public user profiles are enabled
173          */
174         boolean isPublicUserProfileEnabled ();
175
176 }