]> git.mxchange.org Git - juser-lib.git/blob - src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java
Continued:
[juser-lib.git] / src / org / mxchange / jusercore / model / user / UserSessionBeanRemote.java
1 /*
2  * Copyright (C) 2016 - 2020 Free Software Foundation
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          * Updates entity from given user instance and returns updated instance.
67          * <p>
68          * @param user User instance to update
69          * <p>
70          * @return Updated user instance
71          */
72         User updateUserData (final User user);
73
74         /**
75          * Returns a list of all users. This is mostly suitable for administrative
76          * interfaces.
77          * <p>
78          * @return A list of all users
79          */
80         List<User> fetchAllUsers ();
81
82         /**
83          * Updates given user instance in database
84          * <p>
85          * @param user User instance to update
86          * <p>
87          * @return Updated user instance (detached)
88          */
89         User updateUserPersonalData (final User user);
90
91 }