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 * Creates the user instance and links it with the set contact instance
37 * @param user User instance to
39 * @return Updated user instance
42 * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
43 * the user name is already used
45 * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
46 * When the email address is already used
48 User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
51 * Updates entiity from given user instance and returns updated instance.
53 * @param user User instance to update
55 * @return Updated user instance
57 User updateUserData (final User user);
60 * Find user by given user id and returns fetched instance. If the user is
61 * not found, an exception is thrown.
63 * @param userId User id
65 * @return User instance
67 * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the
70 User findUserById (final Long userId) throws UserNotFoundException;
73 * Adds given user to database, if not found by user name or email address.
75 * @param user User instance to add
77 * @return Updated user instance
80 * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
81 * the user name is already used
83 * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
84 * When the email address is already used
86 User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
89 * Returns a list of all users. This is mostly suitable for administrative
92 * @return A list of all users
94 List<User> allUsers ();
97 * Returns a list with all public and member-visible users. Members are
98 * logged-in users. ;-)
100 * @return A list of public and member-visible users
102 List<User> allMemberPublicVisibleUsers ();
105 * Returns a list of all public user profiles
107 * @return A list of all public user profiles
109 List<User> allPublicUsers ();
112 * Fills given user instance with all available data
114 * @param user Initial User instance
116 * @return Prepared User instance
118 User fillUserData (final User user);
121 * Some "getter" for a full user name list
123 * @return User name list
125 List<String> getUserNameList ();
128 * Some "getter" for a full email address list
130 * @return User name list
132 List<String> getEmailAddressList ();
135 * Checks if given user id exists
137 * @param userId User id to check
139 * @return Whether the user id exists
141 boolean ifUserIdExists (final Long userId);
144 * Checks if given user name is already used
146 * @param userName User name to check
148 * @return Whether given user name is found
150 boolean ifUserNameExists (final String userName);
153 * Checks if given user exists
155 * @param user User to check
157 * @return Whether the user exists
159 boolean ifUserExists (final User user);
162 * Checks if the the given user's name is already registered
164 * @param user User instance
166 * @return Whether the user is already registered
168 boolean isUserNameReqistered (final User user);
171 * Checks if the the given user's email address is already registered
173 * @param user User instance
175 * @return Whether the user is already registered
177 boolean isEmailAddressReqistered (final User user);
180 * Updates given user instance in database
182 * @param user User instance to update
184 * @return Updated user instance (detached)
186 User updateUserPersonalData (final User user);