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