2 * Copyright (C) 2016 Roland Haeder
\r
4 * This program is free software: you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation, either version 3 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License
\r
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
\r
17 package org.mxchange.jusercore.model.user;
\r
19 import java.io.Serializable;
\r
20 import java.util.List;
\r
21 import javax.ejb.Remote;
\r
22 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
\r
23 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
\r
24 import org.mxchange.jusercore.exceptions.UserNotFoundException;
\r
27 * An interface for user beans
\r
29 * @author Roland Haeder<roland@mxchange.org>
\r
32 public interface UserSessionBeanRemote extends Serializable {
\r
35 * Creates the user instance and links it with the set contact instance
\r
37 * @param user User instance to
\r
39 * @return Updated user instance
\r
42 * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
\r
43 * the user name is already used
\r
45 * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
\r
46 * When the email address is already used
\r
48 User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
\r
51 * Updates entiity from given user instance and returns updated instance.
\r
53 * @param user User instance to update
\r
55 * @return Updated user instance
\r
57 User updateUserData (final User user);
\r
60 * Find user by given user id and returns fetched instance. If the user is
\r
61 * not found, an exception is thrown.
\r
63 * @param userId User id
\r
65 * @return User instance
\r
67 * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the
\r
70 User findUserById (final Long userId) throws UserNotFoundException;
\r
73 * Adds given user to database, if not found by user name or email address.
\r
75 * @param user User instance to add
\r
77 * @return Updated user instance
\r
80 * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
\r
81 * the user name is already used
\r
83 * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
\r
84 * When the email address is already used
\r
86 User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
\r
89 * Returns a list of all users. This is mostly suitable for administrative
\r
92 * @return A list of all users
\r
94 List<User> allUsers ();
\r
97 * Returns a list with all public and member-visible users. Members are
\r
98 * logged-in users. ;-)
\r
100 * @return A list of public and member-visible users
\r
102 List<User> allMemberPublicVisibleUsers ();
\r
105 * Returns a list of all public user profiles
\r
107 * @return A list of all public user profiles
\r
109 List<User> allPublicUsers ();
\r
112 * Fills given user instance with all available data
\r
114 * @param user Initial User instance
\r
116 * @return Prepared User instance
\r
118 User fillUserData (final User user);
\r
121 * Some "getter" for a full user name list
\r
123 * @return User name list
\r
125 List<String> getUserNameList ();
\r
128 * Some "getter" for a full email address list
\r
130 * @return User name list
\r
132 List<String> getEmailAddressList ();
\r
135 * Checks if given user id exists
\r
137 * @param userId User id to check
\r
139 * @return Whether the user id exists
\r
141 boolean ifUserIdExists (final Long userId);
\r
144 * Checks if given user name is already used
\r
146 * @param userName User name to check
\r
148 * @return Whether given user name is found
\r
150 boolean ifUserNameExists (final String userName);
\r
153 * Checks if given user exists
\r
155 * @param user User to check
\r
157 * @return Whether the user exists
\r
159 boolean ifUserExists (final User user);
\r
162 * Checks if the the given user's name is already registered
\r
164 * @param user User instance
\r
166 * @return Whether the user is already registered
\r
168 boolean isUserNameRegistered (final User user);
\r
171 * Checks if the the given user's email address is already registered
\r
173 * @param user User instance
\r
175 * @return Whether the user is already registered
\r
177 boolean isEmailAddressRegistered (final User user);
\r
180 * Updates given user instance in database
\r
182 * @param user User instance to update
\r
184 * @return Updated user instance (detached)
\r
186 User updateUserPersonalData (final User user);
\r