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