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;
26 * An interface for user beans
28 * @author Roland Haeder<roland@mxchange.org>
31 public interface UserSessionBeanRemote extends Serializable {
34 * Adds given user to database, if not found by user name or email address.
36 * @param user User instance to add
38 * @return Updated user instance
39 * @throws org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When the user name is already used
40 * @throws org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException When the email address is already used
42 User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
45 * Returns a list of all users. This is mostly suitable for administrative
48 * @return A list of all users
50 List<User> allUsers ();
53 * Returns a list with all public and member-visible users. Members are
54 * logged-in users. ;-)
56 * @return A list of public and member-visible users
58 List<User> allMemberPublicVisibleUsers ();
61 * Returns a list of all public user profiles
63 * @return A list of all public user profiles
65 List<User> allPublicUsers ();
68 * Fills given user instance with all available data
70 * @param user Initial User instance
72 * @return Prepared User instance
74 User fillUserData (final User user);
77 * Some "getter" for a full user name list
79 * @return User name list
81 List<String> getUserNameList ();
84 * Some "getter" for a full email address list
86 * @return User name list
88 List<String> getEmailAddressList ();
91 * Checks if given user id exists
93 * @param userId User id to check
95 * @return Whether the user id exists
97 boolean ifUserIdExists (final Long userId);
100 * Checks if given user exists
102 * @param user User to check
104 * @return Whether the user exists
106 boolean ifUserExists (final User user);
109 * Checks if the the given user's name is already registered
111 * @param user User instance
113 * @return Whether the user is already registered
115 boolean isUserNameReqistered (final User user);
118 * Checks if the the given user's email address is already registered
120 * @param user User instance
122 * @return Whether the user is already registered
124 boolean isEmailAddressReqistered (final User user);
127 * Updates given user instance in database
129 * @param user User instance to update
131 void updateUserPersonalData (final User user);