2 * Copyright (C) 2016 Roland Haeder
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.EmailAddressAlreadyRegisteredException;
23 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
24 import org.mxchange.jusercore.exceptions.UserNotFoundException;
27 * An interface for user beans
29 * @author Roland Haeder<roland@mxchange.org>
32 public interface UserSessionBeanRemote extends Serializable {
35 * Updates entiity from given user instance and returns updated instance.
37 * @param user User instance to update
39 * @return Updated user instance
41 User updateUserData (final User user);
44 * Find user by given user id and returns fetched instance. If the user is
45 * not found, an exception is thrown.
47 * @param userId User id
49 * @return User instance
51 * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the
55 User findUserById (final Long userId) throws UserNotFoundException;
58 * Adds given user to database, if not found by user name or email address.
60 * @param user User instance to add
62 * @return Updated user instance
65 * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
73 * * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException When
81 User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
84 * Returns a list of all users. This is mostly suitable for administrative
87 * @return A list of all users
89 List<User> allUsers ();
92 * Returns a list with all public and member-visible users. Members are
93 * logged-in users. ;-)
95 * @return A list of public and member-visible users
97 List<User> allMemberPublicVisibleUsers ();
100 * Returns a list of all public user profiles
102 * @return A list of all public user profiles
104 List<User> allPublicUsers ();
107 * Fills given user instance with all available data
109 * @param user Initial User instance
111 * @return Prepared User instance
113 User fillUserData (final User user);
116 * Some "getter" for a full user name list
118 * @return User name list
120 List<String> getUserNameList ();
123 * Some "getter" for a full email address list
125 * @return User name list
127 List<String> getEmailAddressList ();
130 * Checks if given user id exists
132 * @param userId User id to check
134 * @return Whether the user id exists
136 boolean ifUserIdExists (final Long userId);
139 * Checks if given user name is already used
141 * @param userName User name to check
143 * @return Whether given user name is found
145 boolean ifUserNameExists (final String userName);
148 * Checks if given user exists
150 * @param user User to check
152 * @return Whether the user exists
154 boolean ifUserExists (final User user);
157 * Checks if the the given user's name is already registered
159 * @param user User instance
161 * @return Whether the user is already registered
163 boolean isUserNameReqistered (final User user);
166 * Checks if the the given user's email address is already registered
168 * @param user User instance
170 * @return Whether the user is already registered
172 boolean isEmailAddressReqistered (final User user);
175 * Updates given user instance in database
177 * @param user User instance to update
179 * @return Updated user instance (detached)
181 User updateUserPersonalData (final User user);