]> git.mxchange.org Git - juser-activity-lib.git/blobdiff - src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java
updated jar(s)
[juser-activity-lib.git] / src / org / mxchange / jusercore / model / user / UserSessionBeanRemote.java
index 162af9732dc282e11f422e4b97ea816d94ffc500..8509e4a81347ca883e39af1faa9e24a130facd79 100644 (file)
@@ -19,9 +19,11 @@ package org.mxchange.jusercore.model.user;
 import java.io.Serializable;
 import java.util.List;
 import javax.ejb.Remote;
-import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
-import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
+import org.mxchange.jusercore.exceptions.UserStatusLockedException;
+import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
+import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
 
 /**
  * An interface for user beans
@@ -32,20 +34,39 @@ import org.mxchange.jusercore.exceptions.UserNotFoundException;
 public interface UserSessionBeanRemote extends Serializable {
 
        /**
-        * Creates the user instance and links it with the set contact instance
+        * Updates user's password (must be set encrypted before calling this
+        * method) and records the password change in user's password history.
         * <p>
-        * @param user User instance to
+        * @param user User instance with updated password
+        * <p>
+        * @return Password history entry with updated user instance
+        *
+        * @throws UserNotFoundException If the user is not found
+        * @throws UserStatusUnconfirmedException If the user status is unconfirmed
+        * @throws UserStatusLockedException If the user status is locked
+        */
+       PasswordHistory updateUserPassword (final User user) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException;
+
+       /**
+        * Changes the user' account status to CONFIRMED if the status is
+        * UNCONFIRMED, else propper exceptions are thrown.
+        * <p>
+        * @param user Unconfirmed user instance
+        * @param baseUrl Base URL
         * <p>
         * @return Updated user instance
         * <p>
-        * @throws
-        * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
-        * the user name is already used
-        * @throws
-        * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
-        * When the email address is already used
+        * @throws UserStatusConfirmedException If the user account is confirmed
+        * @throws UserStatusLockedException If the user account is locked
         */
-       User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
+       User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException;
+
+       /**
+        * Generates random user name that is available.
+        * <p>
+        * @return Generated user name
+        */
+       String generateRandomUserName ();
 
        /**
         * Updates entiity from given user instance and returns updated instance.
@@ -69,22 +90,6 @@ public interface UserSessionBeanRemote extends Serializable {
         */
        User findUserById (final Long userId) throws UserNotFoundException;
 
-       /**
-        * Adds given user to database, if not found by user name or email address.
-        * <p>
-        * @param user User instance to add
-        * <p>
-        * @return Updated user instance
-        * <p>
-        * @throws
-        * org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException When
-        * the user name is already used
-        * @throws
-        * org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException
-        * When the email address is already used
-        */
-       User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException;
-
        /**
         * Returns a list of all users. This is mostly suitable for administrative
         * interfaces.
@@ -165,7 +170,7 @@ public interface UserSessionBeanRemote extends Serializable {
         * <p>
         * @return Whether the user is already registered
         */
-       boolean isUserNameReqistered (final User user);
+       boolean isUserNameRegistered (final User user);
 
        /**
         * Checks if the the given user's email address is already registered
@@ -174,7 +179,7 @@ public interface UserSessionBeanRemote extends Serializable {
         * <p>
         * @return Whether the user is already registered
         */
-       boolean isEmailAddressReqistered (final User user);
+       boolean isEmailAddressRegistered (final User user);
 
        /**
         * Updates given user instance in database