]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionController.java
Please cherry-pick:
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / user / AddressbookUserWebSessionController.java
1 /*
2  * Copyright (C) 2016 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.addressbook.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 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
26
27 /**
28  * An interface for user beans
29  * <p>
30  * @author Roland Häder<roland@mxchange.org>
31  */
32 public interface AddressbookUserWebSessionController extends Serializable {
33
34         /**
35          * Minimum password length
36          */
37         public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
38
39         /**
40          * All users
41          * <p>
42          * @return A list of all public user profiles
43          */
44         List<User> allUsers ();
45
46         /**
47          * All public user profiles
48          * <p>
49          * @return A list of all public user profiles
50          */
51         List<User> allVisibleUsers ();
52
53         /**
54          * Checks whether the given contact is a user
55          * <p>
56          * @param contact Contact to check
57          * <p>
58          * @return Whether the contact is a user
59          */
60         boolean isContactFound (final Contact contact);
61
62         /**
63          * Checks whether a public user account is registered. This means that at
64          * least one user profile has its flag "public user profile" enabled.
65          * <p>
66          * @return Whether at least one user has a public profile
67          */
68         boolean isVisibleUserFound ();
69
70         /**
71          * Checks whether given user instance's name is used
72          * <p>
73          * @param user User instance's name to check
74          * <p>
75          * @return Whether it is already used
76          */
77         boolean isUserNameRegistered (final User user);
78
79         /**
80          * Tries to lookup user by given id number. If the user is not found or the
81          * account status is not CONFIRMED proper exceptions are thrown.
82          * <p>
83          * @param userId User id
84          * <p>
85          * @return User instance
86          * <p>
87          * @throws UserNotFoundException If the user is not found
88          */
89         User lookupUserById (final Long userId) throws UserNotFoundException;
90
91         /**
92          * Tries to lookup user by given email address. If the user is not found a
93          * proper exceptions is thrown.
94          * <p>
95          * @param emailAddress Email address
96          * <p>
97          * @return User instance
98          * <p>
99          * @throws UserEmailAddressNotFoundException If the user's email address is not found
100          */
101         User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException;
102
103         /**
104          * Creates an instance from all properties
105          * <p>
106          * @param createContactData Whether contact data should be created
107          * <p>
108          * @return A user instance
109          */
110         User createUserInstance (final boolean createContactData);
111
112         /**
113          * Creates a user instance for login phase
114          * <p>
115          * @return User instance
116          */
117         User createUserLogin ();
118
119         /**
120          * Getter for user id
121          * <p>
122          * @return User id
123          */
124         Long getUserId ();
125
126         /**
127          * Setter for user id
128          * <p>
129          * @param userId User id
130          */
131         void setUserId (final Long userId);
132
133         /**
134          * Getter for user name
135          * <p>
136          * @return User name
137          */
138         String getUserName ();
139
140         /**
141          * Setter for user name
142          * <p>
143          * @param userName User name
144          */
145         void setUserName (final String userName);
146
147         /**
148          * Getter for clear-text user password
149          * <p>
150          * @return Clear-text user password
151          */
152         String getUserPassword ();
153
154         /**
155          * Setter for clear-text user password
156          * <p>
157          * @param userPassword Clear-text user password
158          */
159         void setUserPassword (final String userPassword);
160
161         /**
162          * Getter for clear-text user password repeated
163          * <p>
164          * @return Clear-text user password repeated
165          */
166         String getUserPasswordRepeat ();
167
168         /**
169          * Setter for clear-text user password repeated
170          * <p>
171          * @param userPasswordRepeat Clear-text user password repeated
172          */
173         void setUserPasswordRepeat (final String userPasswordRepeat);
174
175         /**
176          * Getter for user profile mode
177          * <p>
178          * @return User profile mode
179          */
180         ProfileMode getUserProfileMode ();
181
182         /**
183          * Setter for user profile mode
184          * <p>
185          * @param userProfileMode User profile mode
186          */
187         void setUserProfileMode (final ProfileMode userProfileMode);
188
189         /**
190          * Checks whether all required personal data is set
191          * <p>
192          * @return Whether the required personal data is set
193          */
194         boolean isRequiredPersonalDataSet ();
195
196         /**
197          * Checks whether all required personal data is set for changing them
198          * <p>
199          * @return Whether the required personal data is set
200          */
201         boolean isRequiredChangePersonalDataSet ();
202
203         /**
204          * Checks whether same passwords has been entered
205          * <p>
206          * @return Whether same passwords has been entered
207          */
208         boolean isSamePasswordEntered ();
209
210         /**
211          * Checks if the user id is empty
212          * <p>
213          * @return Whether the user id is empty
214          */
215         boolean isUserIdEmpty ();
216
217         /**
218          * Changes logged-in user's personal data if the current password matches
219          * and TAC + privacy statement has been accepted.
220          * <p>
221          * @return New target page
222          */
223         String doChangePersonalData ();
224
225         /**
226          * Checks whether this application requires a user name to be entered.
227          * Otherwise a random name like "userXXXXX" is generated
228          * <p>
229          * @return Whether this application requires a user name
230          */
231         boolean isUserNameRequired ();
232
233         /**
234          * Checks wether public user profiles are enabled. This requires that user
235          * names are also enabled.
236          * <p>
237          * @return Whether public user profiles are enabled
238          */
239         boolean isPublicUserProfileEnabled ();
240
241 }