]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionController.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / user / JobsUserWebSessionController.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 JobsUserWebSessionController 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          * All public user profiles
66          * <p>
67          * @return A list of all public user profiles
68          */
69         List<User> allVisibleUsers ();
70
71         /**
72          * Checks whether the given contact is a user
73          * <p>
74          * @param contact Contact to check
75          * <p>
76          * @return Whether the contact is a user
77          */
78         boolean isContactFound (final Contact contact);
79
80         /**
81          * Checks whether a public user account is registered. This means that at
82          * least one user profile has its flag "public user profile" enabled.
83          * <p>
84          * @return Whether at least one user has a public profile
85          */
86         boolean isVisibleUserFound ();
87
88         /**
89          * Checks whether given user instance's name is used
90          * <p>
91          * @param user User instance's name to check
92          * <p>
93          * @return Whether it is already used
94          */
95         boolean isUserNameRegistered (final User user);
96
97         /**
98          * Tries to lookup user by given id number. If the user is not found or the
99          * account status is not CONFIRMED proper exceptions are thrown.
100          * <p>
101          * @param userId User id
102          * <p>
103          * @return User instance
104          * <p>
105          * @throws UserNotFoundException If the user is not found
106          */
107         User lookupUserById (final Long userId) throws UserNotFoundException;
108
109         /**
110          * Tries to lookup user by given email address. If the user is not found a
111          * proper exceptions is thrown.
112          * <p>
113          * @param emailAddress Email address
114          * <p>
115          * @return User instance
116          * <p>
117          * @throws UserEmailAddressNotFoundException If the user's email address is
118          * not found
119          */
120         User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
121
122         /**
123          * Creates an instance from all properties
124          * <p>
125          * @param createContactData Whether contact data should be created
126          * <p>
127          * @return A user instance
128          */
129         User createUserInstance (final boolean createContactData);
130
131         /**
132          * Creates a user instance for login phase
133          * <p>
134          * @return User instance
135          */
136         User createUserLogin ();
137
138         /**
139          * Checks whether all required personal data is set
140          * <p>
141          * @return Whether the required personal data is set
142          */
143         boolean isRequiredPersonalDataSet ();
144
145         /**
146          * Checks whether all required personal data is set for changing them
147          * <p>
148          * @return Whether the required personal data is set
149          */
150         boolean isRequiredChangePersonalDataSet ();
151
152         /**
153          * Checks whether same passwords has been entered
154          * <p>
155          * @return Whether same passwords has been entered
156          */
157         boolean isSamePasswordEntered ();
158
159         /**
160          * Checks if the user id is empty
161          * <p>
162          * @return Whether the user id is empty
163          */
164         boolean isUserIdEmpty ();
165
166         /**
167          * Changes logged-in user's personal data if the current password matches
168          * and TAC + privacy statement has been accepted.
169          * <p>
170          * @return New target page
171          */
172         String doChangePersonalData ();
173
174         /**
175          * Checks whether this application requires a user name to be entered.
176          * Otherwise a random name like "userXXXXX" is generated
177          * <p>
178          * @return Whether this application requires a user name
179          */
180         boolean isUserNameRequired ();
181
182         /**
183          * Checks wether public user profiles are enabled. This requires that user
184          * names are also enabled.
185          * <p>
186          * @return Whether public user profiles are enabled
187          */
188         boolean isPublicUserProfileEnabled ();
189
190 }