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
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.
*/
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.
* <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
* <p>
* @return Whether the user is already registered
*/
- boolean isEmailAddressReqistered (final User user);
+ boolean isEmailAddressRegistered (final User user);
/**
* Updates given user instance in database