]> 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 8b4781d9981e2582d18ec102ca43ef0c231e8327..8509e4a81347ca883e39af1faa9e24a130facd79 100644 (file)
@@ -19,6 +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.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
@@ -28,6 +33,71 @@ import javax.ejb.Remote;
 @Remote
 public interface UserSessionBeanRemote extends Serializable {
 
+       /**
+        * 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 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 UserStatusConfirmedException If the user account is confirmed
+        * @throws UserStatusLockedException If the user account is locked
+        */
+       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.
+        * <p>
+        * @param user User instance to update
+        * <p>
+        * @return Updated user instance
+        */
+       User updateUserData (final User user);
+
+       /**
+        * Find user by given user id and returns fetched instance. If the user is
+        * not found, an exception is thrown.
+        * <p>
+        * @param userId User id
+        * <p>
+        * @return User instance
+        *
+        * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the
+        * user is not found
+        */
+       User findUserById (final Long userId) throws UserNotFoundException;
+
+       /**
+        * Returns a list of all users. This is mostly suitable for administrative
+        * interfaces.
+        * <p>
+        * @return A list of all users
+        */
+       List<User> allUsers ();
+
        /**
         * Returns a list with all public and member-visible users. Members are
         * logged-in users. ;-)
@@ -75,6 +145,24 @@ public interface UserSessionBeanRemote extends Serializable {
         */
        boolean ifUserIdExists (final Long userId);
 
+       /**
+        * Checks if given user name is already used
+        * <p>
+        * @param userName User name to check
+        * <p>
+        * @return Whether given user name is found
+        */
+       boolean ifUserNameExists (final String userName);
+
+       /**
+        * Checks if given user exists
+        * <p>
+        * @param user User to check
+        * <p>
+        * @return Whether the user exists
+        */
+       boolean ifUserExists (final User user);
+
        /**
         * Checks if the the given user's name is already registered
         * <p>
@@ -82,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
@@ -91,5 +179,15 @@ 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
+        * <p>
+        * @param user User instance to update
+        * <p>
+        * @return Updated user instance (detached)
+        */
+       User updateUserPersonalData (final User user);
+
 }