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