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