]> git.mxchange.org Git - juser-login-lib.git/blob - src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java
added business method linkUser()
[juser-login-lib.git] / src / org / mxchange / jusercore / model / user / UserSessionBeanRemote.java
1 /*
2  * Copyright (C) 2016 Roland Haeder
3  *
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.
8  *
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.
13  *
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/>.
16  */
17 package org.mxchange.jusercore.model.user;
18
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;
25
26 /**
27  * An interface for user beans
28  * <p>
29  * @author Roland Haeder<roland@mxchange.org>
30  */
31 @Remote
32 public interface UserSessionBeanRemote extends Serializable {
33
34         /**
35          * Creates the user instance and links it with the set contact instance
36          * <p>
37          * @param user User instance to
38          * <p>
39          * @return Updated user instance
40          * <p>
41          * @throws
42          * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
43          * the user name is already used
44          * @throws
45          * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
46          * When the email address is already used
47          */
48         User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
49
50         /**
51          * Updates entiity from given user instance and returns updated instance.
52          * <p>
53          * @param user User instance to update
54          * <p>
55          * @return Updated user instance
56          */
57         User updateUserData (final User user);
58
59         /**
60          * Find user by given user id and returns fetched instance. If the user is
61          * not found, an exception is thrown.
62          * <p>
63          * @param userId User id
64          * <p>
65          * @return User instance
66          *
67          * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the
68          * user is not found
69          */
70         User findUserById (final Long userId) throws UserNotFoundException;
71
72         /**
73          * Adds given user to database, if not found by user name or email address.
74          * <p>
75          * @param user User instance to add
76          * <p>
77          * @return Updated user instance
78          * <p>
79          * @throws
80          * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
81          * the user name is already used
82          * @throws
83          * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
84          * When the email address is already used
85          */
86         User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
87
88         /**
89          * Returns a list of all users. This is mostly suitable for administrative
90          * interfaces.
91          * <p>
92          * @return A list of all users
93          */
94         List<User> allUsers ();
95
96         /**
97          * Returns a list with all public and member-visible users. Members are
98          * logged-in users. ;-)
99          * <p>
100          * @return A list of public and member-visible users
101          */
102         List<User> allMemberPublicVisibleUsers ();
103
104         /**
105          * Returns a list of all public user profiles
106          * <p>
107          * @return A list of all public user profiles
108          */
109         List<User> allPublicUsers ();
110
111         /**
112          * Fills given user instance with all available data
113          * <p>
114          * @param user Initial User instance
115          * <p>
116          * @return Prepared User instance
117          */
118         User fillUserData (final User user);
119
120         /**
121          * Some "getter" for a full user name list
122          * <p>
123          * @return User name list
124          */
125         List<String> getUserNameList ();
126
127         /**
128          * Some "getter" for a full email address list
129          * <p>
130          * @return User name list
131          */
132         List<String> getEmailAddressList ();
133
134         /**
135          * Checks if given user id exists
136          * <p>
137          * @param userId User id to check
138          * <p>
139          * @return Whether the user id exists
140          */
141         boolean ifUserIdExists (final Long userId);
142
143         /**
144          * Checks if given user name is already used
145          * <p>
146          * @param userName User name to check
147          * <p>
148          * @return Whether given user name is found
149          */
150         boolean ifUserNameExists (final String userName);
151
152         /**
153          * Checks if given user exists
154          * <p>
155          * @param user User to check
156          * <p>
157          * @return Whether the user exists
158          */
159         boolean ifUserExists (final User user);
160
161         /**
162          * Checks if the the given user's name is already registered
163          * <p>
164          * @param user User instance
165          * <p>
166          * @return Whether the user is already registered
167          */
168         boolean isUserNameReqistered (final User user);
169
170         /**
171          * Checks if the the given user's email address is already registered
172          * <p>
173          * @param user User instance
174          * <p>
175          * @return Whether the user is already registered
176          */
177         boolean isEmailAddressReqistered (final User user);
178
179         /**
180          * Updates given user instance in database
181          * <p>
182          * @param user User instance to update
183          * <p>
184          * @return Updated user instance (detached)
185          */
186         User updateUserPersonalData (final User user);
187
188 }