2 * Copyright (C) 2016 - 2020 Free Software Foundation
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.
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.
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/>.
17 package org.mxchange.jusercore.model.user;
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;
29 * An interface for user beans
31 * @author Roland Häder<roland@mxchange.org>
34 public interface UserSessionBeanRemote extends Serializable {
37 * Updates user's password (must be set encrypted before calling this
38 * method) and records the password change in user's password history.
40 * @param user User instance with updated password
41 * @param baseUrl Base URL for all links
43 * @return Password history entry with updated user instance
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
49 PasswordHistory updateUserPassword (final User user, final String baseUrl) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException;
52 * Changes the user' account status to CONFIRMED if the status is
53 * UNCONFIRMED, else proper exceptions are thrown.
55 * @param user Unconfirmed user instance
56 * @param baseUrl Base URL
58 * @return Updated user instance
60 * @throws UserStatusConfirmedException If the user account is confirmed
61 * @throws UserStatusLockedException If the user account is locked
63 User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException;
66 * Updates entity from given user instance and returns updated instance.
68 * @param user User instance to update
70 * @return Updated user instance
72 User updateUserData (final User user);
75 * Returns a list of all users. This is mostly suitable for administrative
78 * @return A list of all users
80 List<User> fetchAllUsers ();
83 * Updates given user instance in database
85 * @param user User instance to update
87 * @return Updated user instance (detached)
89 User updateUserPersonalData (final User user);