]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java
Cleanups:
[addressbook-war.git] / src / java / org / mxchange / addressbook / beans / user / AddressbookAdminUserWebRequestController.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
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.events.login.UserLoggedInEvent;
23 import org.mxchange.jusercore.events.registration.UserRegisteredEvent;
24 import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
25 import org.mxchange.jusercore.exceptions.UserNotFoundException;
26 import org.mxchange.jusercore.model.user.User;
27
28 /**
29  * An interface for user beans
30  * <p>
31  * @author Roland Haeder<roland@mxchange.org>
32  */
33 public interface AddressbookAdminUserWebRequestController extends Serializable {
34
35         /**
36          * Event observer for new user registrations
37          * <p>
38          * @param event User registration event
39          */
40         void afterRegistrationEvent (final UserRegisteredEvent event);
41
42         /**
43          * Event observer for logged-in user
44          * <p>
45          * @param event Event instance
46          */
47         void afterUserLogin (final UserLoggedInEvent event);
48
49         /**
50          * Listens to fired event when user updated personal data
51          * <p>
52          * @param event Event being fired
53          */
54         void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
55
56         /**
57          * All public user profiles
58          * <p>
59          * @return A list of all public user profiles
60          */
61         List<User> allVisibleUsers ();
62
63         /**
64          * Returns a list of all selectable contacts for user creation. Contacts
65          * from already existing users are excluded in this list.
66          * <p>
67          * @return A list of all selectable contacts
68          */
69         List<Contact> selectableContacts ();
70
71         /**
72          * Updates list with given user
73          * <p>
74          * @param user User to update
75          */
76         void updateList (final User user);
77
78         /**
79          * Checks whether the given contact is a user
80          * <p>
81          * @param contact Contact to check
82          * <p>
83          * @return Whether the contact is a user
84          */
85         boolean isContactFound (final Contact contact);
86
87         /**
88          * Checks whether a public user account is registered. This means that at
89          * least one user profile has its flag "public user profile" enabled.
90          * <p>
91          * @return Whether at least one user has a public profile
92          */
93         boolean isVisibleUserFound ();
94
95         /**
96          * Checks whether given user instance's name is used
97          * <p>
98          * @param user User instance's 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          * All users
118          * <p>
119          * @return A list of all public user profiles
120          */
121         List<User> allUsers ();
122
123         /**
124          * Checks whether users are registered
125          * <p>
126          * @return Whether users are registered
127          */
128         boolean hasUsers ();
129
130         /**
131          * Adds user instance to database by preparing a complete user instance and
132          * sending it to the EJB. The data set in the controller is being verified,
133          * e.g. if the user name or email address is not used yet.
134          * <p>
135          * @return Redirect outcome
136          */
137         String addUser ();
138
139         /**
140          * Edits cuirrently loaded user's data in database.
141          * <p>
142          * @return Redirect outcome
143          */
144         String editUserData ();
145
146         /**
147          * Getter for user name
148          * <p>
149          * @return User name
150          */
151         String getUserName ();
152
153         /**
154          * Setter for user name
155          * <p>
156          * @param userName User name
157          */
158         void setUserName (final String userName);
159
160         /**
161          * Getter for unencrypted user password
162          * <p>
163          * @return Unencrypted user password
164          */
165         String getUserPassword ();
166
167         /**
168          * Setter for unencrypted user password
169          * <p>
170          * @param userPassword Unencrypted user password
171          */
172         void setUserPassword (final String userPassword);
173
174         /**
175          * Getter for unencrypted user password repeated
176          * <p>
177          * @return Unencrypted user password repeated
178          */
179         String getUserPasswordRepeat ();
180
181         /**
182          * Setter for unencrypted user password repeated
183          * <p>
184          * @param userPasswordRepeat Unencrypted user password repeated
185          */
186         void setUserPasswordRepeat (final String userPasswordRepeat);
187
188 }