]> git.mxchange.org Git - addressbook-war.git/blob - src/java/org/mxchange/addressbook/beans/user/AddressbookAdminUserWebRequestController.java
Rewrites:
[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.user.update.UpdatedUserPersonalDataEvent;
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 Haeder<roland@mxchange.org>
30  */
31 public interface AddressbookAdminUserWebRequestController extends Serializable {
32
33         /**
34          * Listens to fired event when user updated personal data
35          * <p>
36          * @param event Event being fired
37          */
38         void afterUserUpdatedPersonalData (final UpdatedUserPersonalDataEvent event);
39
40         /**
41          * All public user profiles
42          * <p>
43          * @return A list of all public user profiles
44          */
45         List<User> allVisibleUsers ();
46
47         /**
48          * Returns a list of all selectable contacts for user creation. Contacts
49          * from already existing users are excluded in this list.
50          * <p>
51          * @return A list of all selectable contacts
52          */
53         List<Contact> selectableContacts ();
54
55         /**
56          * Updates list with given user
57          * <p>
58          * @param user User to update
59          */
60         void updateList (final User user);
61
62         /**
63          * Checks whether the given contact is a user
64          * <p>
65          * @param contact Contact to check
66          * <p>
67          * @return Whether the contact is a user
68          */
69         boolean isContactFound (final Contact contact);
70
71         /**
72          * Checks whether a public user account is registered. This means that at
73          * least one user profile has its flag "public user profile" enabled.
74          * <p>
75          * @return Whether at least one user has a public profile
76          */
77         boolean isVisibleUserFound ();
78
79         /**
80          * Checks whether given user instance's name is used
81          * <p>
82          * @param user User instance's name to check
83          * <p>
84          * @return Whether it is already used
85          */
86         boolean isUserNameRegistered (final User user);
87
88         /**
89          * Tries to lookup user by given id number. If the user is not found or the
90          * account status is not CONFIRMED proper exceptions are thrown.
91          * <p>
92          * @param userId User id
93          * <p>
94          * @return User instance
95          * <p>
96          * @throws UserNotFoundException If the user is not found
97          */
98         User lookupUserById (final Long userId) throws UserNotFoundException;
99
100         /**
101          * All users
102          * <p>
103          * @return A list of all public user profiles
104          */
105         List<User> allUsers ();
106
107         /**
108          * Checks whether users are registered
109          * <p>
110          * @return Whether users are registered
111          */
112         boolean hasUsers ();
113
114         /**
115          * Adds user instance to database by preparing a complete user instance and
116          * sending it to the EJB. The data set in the controller is being verified,
117          * e.g. if the user name or email address is not used yet.
118          * <p>
119          * @return Redirect outcome
120          */
121         String addUser ();
122
123         /**
124          * Edits cuirrently loaded user's data in database.
125          * <p>
126          * @return Redirect outcome
127          */
128         String editUserData ();
129
130         /**
131          * Getter for user name
132          * <p>
133          * @return User name
134          */
135         String getUserName ();
136
137         /**
138          * Setter for user name
139          * <p>
140          * @param userName User name
141          */
142         void setUserName (final String userName);
143
144         /**
145          * Getter for unencrypted user password
146          * <p>
147          * @return Unencrypted user password
148          */
149         String getUserPassword ();
150
151         /**
152          * Setter for unencrypted user password
153          * <p>
154          * @param userPassword Unencrypted user password
155          */
156         void setUserPassword (final String userPassword);
157
158         /**
159          * Getter for unencrypted user password repeated
160          * <p>
161          * @return Unencrypted user password repeated
162          */
163         String getUserPasswordRepeat ();
164
165         /**
166          * Setter for unencrypted user password repeated
167          * <p>
168          * @param userPasswordRepeat Unencrypted user password repeated
169          */
170         void setUserPasswordRepeat (final String userPasswordRepeat);
171
172 }