]> git.mxchange.org Git - juser-lib.git/blob - src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java
tpzo fixed
[juser-lib.git] / src / org / mxchange / jusercore / model / user / UserSessionBeanRemote.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 General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (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 General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jusercore.model.user;
18
19 import java.io.Serializable;
20 import java.util.List;
21 import javax.ejb.Remote;
22 import org.mxchange.jusercore.exceptions.UserNotFoundException;
23 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
24 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
25 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
26 import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
27
28 /**
29  * An interface for user beans
30  * <p>
31  * @author Roland Häder<roland@mxchange.org>
32  */
33 @Remote
34 public interface UserSessionBeanRemote extends Serializable {
35
36         /**
37          * Updates user's password (must be set encrypted before calling this
38          * method) and records the password change in user's password history.
39          * <p>
40          * @param user User instance with updated password
41          * @param baseUrl Base URL for all links
42          * <p>
43          * @return Password history entry with updated user instance
44          *
45          * @throws UserNotFoundException If the user is not found
46          * @throws UserStatusUnconfirmedException If the user status is unconfirmed
47          * @throws UserStatusLockedException If the user status is locked
48          */
49         PasswordHistory updateUserPassword (final User user, final String baseUrl) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException;
50
51         /**
52          * Changes the user' account status to CONFIRMED if the status is
53          * UNCONFIRMED, else proper exceptions are thrown.
54          * <p>
55          * @param user Unconfirmed user instance
56          * @param baseUrl Base URL
57          * <p>
58          * @return Updated user instance
59          * <p>
60          * @throws UserStatusConfirmedException If the user account is confirmed
61          * @throws UserStatusLockedException If the user account is locked
62          */
63         User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException;
64
65         /**
66          * Generates random user name that is available.
67          * <p>
68          * @return Generated user name
69          */
70         String generateRandomUserName ();
71
72         /**
73          * Updates entity from given user instance and returns updated instance.
74          * <p>
75          * @param user User instance to update
76          * <p>
77          * @return Updated user instance
78          */
79         User updateUserData (final User user);
80
81         /**
82          * Find user by given user id and returns fetched instance. If the user is
83          * not found, an exception is thrown.
84          * <p>
85          * @param userId User id
86          * <p>
87          * @return User instance
88          *
89          * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the
90          * user is not found
91          */
92         User findUserById (final Long userId) throws UserNotFoundException;
93
94         /**
95          * Returns a list of all users. This is mostly suitable for administrative
96          * interfaces.
97          * <p>
98          * @return A list of all users
99          */
100         List<User> allUsers ();
101
102         /**
103          * Returns a list with all public and member-visible users. Members are
104          * logged-in users. ;-)
105          * <p>
106          * @return A list of public and member-visible users
107          */
108         List<User> allMemberPublicVisibleUsers ();
109
110         /**
111          * Returns a list of all public user profiles
112          * <p>
113          * @return A list of all public user profiles
114          */
115         List<User> allPublicUsers ();
116
117         /**
118          * Fills given user instance with all available data
119          * <p>
120          * @param user Initial User instance
121          * <p>
122          * @return Prepared User instance
123          */
124         User fillUserData (final User user);
125
126         /**
127          * Some "getter" for a full user name list
128          * <p>
129          * @return User name list
130          */
131         List<String> getUserNameList ();
132
133         /**
134          * Some "getter" for a full email address list
135          * <p>
136          * @return User name list
137          */
138         List<String> getEmailAddressList ();
139
140         /**
141          * Checks if given user id exists
142          * <p>
143          * @param userId User id to check
144          * <p>
145          * @return Whether the user id exists
146          */
147         boolean ifUserIdExists (final Long userId);
148
149         /**
150          * Checks if given user name is already used
151          * <p>
152          * @param userName User name to check
153          * <p>
154          * @return Whether given user name is found
155          */
156         boolean ifUserNameExists (final String userName);
157
158         /**
159          * Checks if given user exists
160          * <p>
161          * @param user User to check
162          * <p>
163          * @return Whether the user exists
164          */
165         boolean ifUserExists (final User user);
166
167         /**
168          * Checks if the the given user's name is already registered
169          * <p>
170          * @param user User instance
171          * <p>
172          * @return Whether the user is already registered
173          */
174         boolean isUserNameRegistered (final User user);
175
176         /**
177          * Checks if the the given user's email address is already registered
178          * <p>
179          * @param user User instance
180          * <p>
181          * @return Whether the user is already registered
182          */
183         boolean isEmailAddressRegistered (final User user);
184
185         /**
186          * Updates given user instance in database
187          * <p>
188          * @param user User instance to update
189          * <p>
190          * @return Updated user instance (detached)
191          */
192         User updateUserPersonalData (final User user);
193
194 }