From: Roland Häder Date: Thu, 12 May 2016 11:52:38 +0000 (+0200) Subject: Added business method for generating pseudo-random user names that are available... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5d9de3805863dce4cecde935dd811e047149f8b4;p=juser-login-lib.git Added business method for generating pseudo-random user names that are available. This may be useful for applications that don't work with user names, still one is required (see juser-core) to persist the user instance. --- diff --git a/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java b/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java index 7e3ba03..e2a65ab 100644 --- a/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java +++ b/src/org/mxchange/jusercore/model/user/UserSessionBeanRemote.java @@ -1,188 +1,195 @@ -/* - * Copyright (C) 2016 Roland Haeder - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -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; - -/** - * An interface for user beans - *

- * @author Roland Haeder - */ -@Remote -public interface UserSessionBeanRemote extends Serializable { - - /** - * Creates the user instance and links it with the set contact instance - *

- * @param user User instance to - *

- * @return Updated user instance - *

- * @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 linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException; - - /** - * Updates entiity from given user instance and returns updated instance. - *

- * @param user User instance to update - *

- * @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. - *

- * @param userId User id - *

- * @return User instance - * - * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the - * user is not found - */ - User findUserById (final Long userId) throws UserNotFoundException; - - /** - * Adds given user to database, if not found by user name or email address. - *

- * @param user User instance to add - *

- * @return Updated user instance - *

- * @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. - *

- * @return A list of all users - */ - List allUsers (); - - /** - * Returns a list with all public and member-visible users. Members are - * logged-in users. ;-) - *

- * @return A list of public and member-visible users - */ - List allMemberPublicVisibleUsers (); - - /** - * Returns a list of all public user profiles - *

- * @return A list of all public user profiles - */ - List allPublicUsers (); - - /** - * Fills given user instance with all available data - *

- * @param user Initial User instance - *

- * @return Prepared User instance - */ - User fillUserData (final User user); - - /** - * Some "getter" for a full user name list - *

- * @return User name list - */ - List getUserNameList (); - - /** - * Some "getter" for a full email address list - *

- * @return User name list - */ - List getEmailAddressList (); - - /** - * Checks if given user id exists - *

- * @param userId User id to check - *

- * @return Whether the user id exists - */ - boolean ifUserIdExists (final Long userId); - - /** - * Checks if given user name is already used - *

- * @param userName User name to check - *

- * @return Whether given user name is found - */ - boolean ifUserNameExists (final String userName); - - /** - * Checks if given user exists - *

- * @param user User to check - *

- * @return Whether the user exists - */ - boolean ifUserExists (final User user); - - /** - * Checks if the the given user's name is already registered - *

- * @param user User instance - *

- * @return Whether the user is already registered - */ - boolean isUserNameRegistered (final User user); - - /** - * Checks if the the given user's email address is already registered - *

- * @param user User instance - *

- * @return Whether the user is already registered - */ - boolean isEmailAddressRegistered (final User user); - - /** - * Updates given user instance in database - *

- * @param user User instance to update - *

- * @return Updated user instance (detached) - */ - User updateUserPersonalData (final User user); - -} +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +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; + +/** + * An interface for user beans + *

+ * @author Roland Haeder + */ +@Remote +public interface UserSessionBeanRemote extends Serializable { + + /** + * Generates random user name that is available. + *

+ * @return Generated user name + */ + String generateRandomUserName (); + + /** + * Creates the user instance and links it with the set contact instance + *

+ * @param user User instance to + *

+ * @return Updated user instance + *

+ * @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 linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException; + + /** + * Updates entiity from given user instance and returns updated instance. + *

+ * @param user User instance to update + *

+ * @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. + *

+ * @param userId User id + *

+ * @return User instance + * + * @throws org.mxchange.jusercore.exceptions.UserNotFoundException If the + * user is not found + */ + User findUserById (final Long userId) throws UserNotFoundException; + + /** + * Adds given user to database, if not found by user name or email address. + *

+ * @param user User instance to add + *

+ * @return Updated user instance + *

+ * @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. + *

+ * @return A list of all users + */ + List allUsers (); + + /** + * Returns a list with all public and member-visible users. Members are + * logged-in users. ;-) + *

+ * @return A list of public and member-visible users + */ + List allMemberPublicVisibleUsers (); + + /** + * Returns a list of all public user profiles + *

+ * @return A list of all public user profiles + */ + List allPublicUsers (); + + /** + * Fills given user instance with all available data + *

+ * @param user Initial User instance + *

+ * @return Prepared User instance + */ + User fillUserData (final User user); + + /** + * Some "getter" for a full user name list + *

+ * @return User name list + */ + List getUserNameList (); + + /** + * Some "getter" for a full email address list + *

+ * @return User name list + */ + List getEmailAddressList (); + + /** + * Checks if given user id exists + *

+ * @param userId User id to check + *

+ * @return Whether the user id exists + */ + boolean ifUserIdExists (final Long userId); + + /** + * Checks if given user name is already used + *

+ * @param userName User name to check + *

+ * @return Whether given user name is found + */ + boolean ifUserNameExists (final String userName); + + /** + * Checks if given user exists + *

+ * @param user User to check + *

+ * @return Whether the user exists + */ + boolean ifUserExists (final User user); + + /** + * Checks if the the given user's name is already registered + *

+ * @param user User instance + *

+ * @return Whether the user is already registered + */ + boolean isUserNameRegistered (final User user); + + /** + * Checks if the the given user's email address is already registered + *

+ * @param user User instance + *

+ * @return Whether the user is already registered + */ + boolean isEmailAddressRegistered (final User user); + + /** + * Updates given user instance in database + *

+ * @param user User instance to update + *

+ * @return Updated user instance (detached) + */ + User updateUserPersonalData (final User user); + +}