]> git.mxchange.org Git - pizzaservice-mailer-ejb.git/blobdiff - src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java
updated own name and resources
[pizzaservice-mailer-ejb.git] / src / java / org / mxchange / jusercore / model / user / AddressbookUserSessionBean.java
index eb3b28dd5780e0ddadb1e71e8b04d2f1bf027e67..06ab9ad5ba29a66b1615aea5d3f3d1f39874d7af 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016 Roland Häder
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as
@@ -30,11 +30,9 @@ import javax.persistence.PersistenceException;
 import javax.persistence.Query;
 import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean;
 import org.mxchange.jcontacts.contact.Contact;
-import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
 import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
-import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
+import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
@@ -48,7 +46,7 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 /**
  * A user EJB
  * <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Häder<roland@mxchange.org>
  */
 @Stateless (name = "user", description = "A bean handling the user data")
 public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean implements UserSessionBeanRemote {
@@ -70,54 +68,11 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        public AddressbookUserSessionBean () {
        }
 
-       @Override
-       public User addUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("addUser: user={0} - CALLED!", user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() != null) {
-                       // Not allowed here
-                       throw new IllegalStateException(MessageFormat.format("user.userId must be null, is: {0}", user.getUserId())); //NOI18N
-               }
-
-               // Check if user is registered
-               if (this.registerBean.isUserNameRegistered(user)) {
-                       // Abort here
-                       throw new UserNameAlreadyRegisteredException(user);
-               } else if (this.registerBean.isEmailAddressRegistered(user)) {
-                       // Abort here
-                       throw new EmailAddressAlreadyRegisteredException(user);
-               }
-
-               // Set created timestamp
-               user.setUserCreated(new GregorianCalendar());
-               user.getUserContact().setContactCreated(new GregorianCalendar());
-
-               // Update cellphone, land-line and fax instance
-               this.setAllContactPhoneEntriesCreated(user.getUserContact());
-
-               // Persist it
-               this.getEntityManager().persist(user);
-
-               // Flush to get id back
-               this.getEntityManager().flush();
-
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("addUser: user={0},user.id={1} - EXIT!", user, user.getUserId())); //NOI18N
-
-               // Return it
-               return user;
-       }
-
        @Override
        @SuppressWarnings ("unchecked")
        public List<User> allMemberPublicVisibleUsers () {
                // Trace message
-               this.getLoggerBeanLocal().logTrace("allMemberPublicVisibleUsers: CALLED!"); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMemberPublicVisibleUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
 
                // Get named query
                Query query = this.getEntityManager().createNamedQuery("AllMemberPublicUsers", LoginUser.class); //NOI18N
@@ -131,7 +86,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                List<User> users = query.getResultList();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allMemberPublicVisibleUsers: users.size()={0} - EXIT!", users.size())); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allMemberPublicVisibleUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
 
                // Return full list
                return users;
@@ -141,7 +96,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @SuppressWarnings ("unchecked")
        public List<User> allPublicUsers () {
                // Trace message
-               this.getLoggerBeanLocal().logTrace("allPublicUsers: CALLED!"); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allPublicUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
 
                // Get named query
                Query query = this.getEntityManager().createNamedQuery("AllPublicUsers", LoginUser.class); //NOI18N
@@ -154,7 +109,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                List<User> users = query.getResultList();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allPublicUsers: users.size()={0} - EXIT!", users.size())); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allPublicUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
 
                // Return full list
                return users;
@@ -164,7 +119,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @SuppressWarnings ("unchecked")
        public List<User> allUsers () {
                // Trace message
-               this.getLoggerBeanLocal().logTrace("allUsers: CALLED!"); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsers: CALLED!", this.getClass().getSimpleName())); //NOI18N
 
                // Get named query
                Query query = this.getEntityManager().createNamedQuery("AllUsers", LoginUser.class); //NOI18N
@@ -173,7 +128,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                List<User> users = query.getResultList();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("allUsers: users.size()={0} - EXIT!", users.size())); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.allUsers: users.size()={1} - EXIT!", this.getClass().getSimpleName(), users.size())); //NOI18N
 
                // Return full list
                return users;
@@ -182,7 +137,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public User confirmAccount (final User user, final String baseUrl) throws UserStatusConfirmedException, UserStatusLockedException {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("confirmAccount: user={0},baseUrl={1} - CALLED!", user, baseUrl)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.confirmAccount: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
 
                // Parameter must be valid
                if (null == user) {
@@ -228,7 +183,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                this.sendEmail("Account confirmed", "account_confirmed", emailAddress, updatedUser, baseUrl); //NOI18N
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("confirmAccount: updatedUser={0} - EXIT!", updatedUser)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.confirmAccount: updatedUser={1} - EXIT!", this.getClass().getSimpleName(), updatedUser)); //NOI18N
 
                // Return updated instance
                return updatedUser;
@@ -237,7 +192,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public User fillUserData (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("fillUserData: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // user should not be null
                if (null == user) {
@@ -264,7 +219,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                }
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("fillUserData: foundUser={0} - EXIT!", foundUser)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.fillUserData: foundUser={1} - EXIT!", this.getClass().getSimpleName(), foundUser)); //NOI18N
 
                // Return prepared instance
                return foundUser;
@@ -273,7 +228,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public User findUserById (final Long userId) throws UserNotFoundException {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("findUserById: userId={0} - CALLED!", userId)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findUserById: userId={1} - CALLED!", this.getClass().getSimpleName(), userId)); //NOI18N
 
                // Is the parameter valid?
                if (null == userId) {
@@ -297,7 +252,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                User user = (User) query.getSingleResult();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("findUserById: user={0} - EXIT!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.findUserById: user={1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // Return found user
                return user;
@@ -306,7 +261,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public String generateRandomUserName () {
                // Trace message
-               this.getLoggerBeanLocal().logTrace("generateRandomUserName - CALLED!"); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateRandomUserName - CALLED!", this.getClass().getSimpleName())); //NOI18N
 
                // Get full list
                List<String> userList = this.getUserNameList();
@@ -321,7 +276,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                }
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("generateRandomUserName: userName={0} - EXIT!", userName)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.generateRandomUserName: userName={1} - EXIT!", this.getClass().getSimpleName(), userName)); //NOI18N
 
                // Found one, so return it
                return userName;
@@ -330,12 +285,18 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        @SuppressWarnings ("unchecked")
        public List<String> getEmailAddressList () {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
                // Get query
                Query query = this.getEntityManager().createNamedQuery("AllEmailAddresses", String.class); //NOI18N
 
                // Get result list
                List<String> emailAddressList = query.getResultList();
 
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getEmailAddressList: emailAddressList.size()={1} - EXIT!", this.getClass().getSimpleName(), emailAddressList.size())); //NOI18N
+
                // Return it
                return emailAddressList;
        }
@@ -343,12 +304,18 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        @SuppressWarnings ("unchecked")
        public List<String> getUserNameList () {
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserNameList: CALLED!", this.getClass().getSimpleName())); //NOI18N
+
                // Get query
                Query query = this.getEntityManager().createNamedQuery("AllUserNames", String.class); //NOI18N
 
                // Get result list
                List<String> userNameList = query.getResultList();
 
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.getUserNameList: userNameList.size()={1} - EXIT!", this.getClass().getSimpleName(), userNameList.size())); //NOI18N
+
                // Return it
                return userNameList;
        }
@@ -356,7 +323,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public boolean ifUserExists (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserExists: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserExists: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // userId should not be null
                if (null == user) {
@@ -397,7 +364,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                }
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserExists: Found user {0} - EXIT!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserExists: Found user {1} - EXIT!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // Found it
                return true;
@@ -406,7 +373,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public boolean ifUserIdExists (final Long userId) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserIdExists: userId={0} - CALLED!", userId)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserIdExists: userId={1} - CALLED!", this.getClass().getSimpleName(), userId)); //NOI18N
 
                // userId should not be null
                if (null == userId) {
@@ -428,10 +395,10 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        User dummy = (User) query.getSingleResult();
 
                        // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserIdExists: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserIdExists: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
                } catch (final NoResultException ex) {
                        // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserIdExists: getSingleResult() returned no result: {0}", ex)); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserIdExists: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
 
                        // User name does not exist
                        return false;
@@ -444,7 +411,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                }
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserIdExists: Found user id {0} - EXIT!", userId)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserIdExists: Found userId={1} - EXIT!", this.getClass().getSimpleName(), userId)); //NOI18N
 
                // Found it
                return true;
@@ -453,7 +420,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public boolean ifUserNameExists (final String userName) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserNameExists: userName={0} - CALLED!", userName)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserNameExists: userName={1} - CALLED!", this.getClass().getSimpleName(), userName)); //NOI18N
 
                // userId should not be null
                if (null == userName) {
@@ -475,17 +442,17 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        User dummy = (User) query.getSingleResult();
 
                        // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserNameExists: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserNameExists: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
                } catch (final NoResultException ex) {
                        // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("ifUserNameExists: getSingleResult() returned no result: {0}", ex)); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.ifUserNameExists: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
 
                        // User name does not exist
                        return false;
                }
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("ifUserNameExists: Found user name {0} - EXIT!", userName)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.ifUserNameExists: Found userName={1} - EXIT!", this.getClass().getSimpleName(), userName)); //NOI18N
 
                // Found it
                return true;
@@ -494,7 +461,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public boolean isEmailAddressRegistered (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isEmailAddressRegistered: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // user should not be null
                if (null == user) {
@@ -513,10 +480,10 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        User dummy = (User) query.getSingleResult();
 
                        // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressRegistered: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
                } catch (final NoResultException ex) {
                        // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isEmailAddressRegistered: getSingleResult() returned no result: {0}", ex)); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isEmailAddressRegistered: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
 
                        // Email address does not exist
                        return false;
@@ -528,6 +495,9 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        throw ex;
                }
 
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isEmailAddressRegistered: Returning true ... - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
                // Found it
                return true;
        }
@@ -535,7 +505,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public boolean isUserNameRegistered (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isUserNameRegistered: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // user should not be null
                if (null == user) {
@@ -554,10 +524,10 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        User dummy = (User) query.getSingleResult();
 
                        // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserNameRegistered: dummy.id={0} found.", dummy.getUserId())); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isUserNameRegistered: dummy.userId={1} found.", this.getClass().getSimpleName(), dummy.getUserId())); //NOI18N
                } catch (final NoResultException ex) {
                        // Log it
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("isUserNameRegistered: getSingleResult() returned no result: {0}", ex)); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.isUserNameRegistered: getSingleResult() returned no result: {1}", this.getClass().getSimpleName(), ex)); //NOI18N
 
                        // User name does not exist
                        return false;
@@ -569,68 +539,17 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        throw ex;
                }
 
-               // Found it
-               return true;
-       }
-
-       @Override
-       public User linkUser (final User user) throws UserNameAlreadyRegisteredException, EmailAddressAlreadyRegisteredException {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("linkUser: user={0} - CALLED!", user)); //NOI18N
-
-               // user should not be null
-               if (null == user) {
-                       // Abort here
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserId() instanceof Long) {
-                       // Id is set
-                       throw new IllegalArgumentException("user.userId is not null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userContact.contactId is null"); //NOI18N
-               } else if (user.getUserContact().getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("user.userContact.contactId={0} is not valid", user.getUserContact().getContactId())); //NOI18N
-               } else if (user.getUserAccountStatus() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("user.userAccountStatus is null"); //NOI18N
-               } else if (this.ifUserNameExists(user.getUserName())) {
-                       // Name already found
-                       throw new UserNameAlreadyRegisteredException(user.getUserName());
-               } else if (this.ifUserExists(user)) {
-                       // User does not exist
-                       throw new IllegalStateException("User does already exist."); //NOI18N
-               }
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.isUserNameRegistered: Returning true ... - EXIT!", this.getClass().getSimpleName())); //NOI18N
 
-               // Try to find the contact
-               Contact foundContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
-
-               // Set detached object in rexcruiter instance
-               user.setUserContact(foundContact);
-
-               // Set timestamp
-               user.setUserCreated(new GregorianCalendar());
-
-               // Perist it
-               this.getEntityManager().persist(user);
-
-               // Flush it to get updated instance back
-               this.getEntityManager().flush();
-
-               // Log trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("linkUser: user={0} - EXIT!", user)); //NOI18N
-
-               // Return updated instanc
-               return user;
+               // Found it
+               return true;
        }
 
        @Override
        public User updateUserData (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserData: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // user should not be null
                if (null == user) {
@@ -671,14 +590,17 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                // Set as updated
                detachedUser.setUserUpdated(new GregorianCalendar());
 
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: detachedUser={1} - CALLED!", this.getClass().getSimpleName(), detachedUser)); //NOI18N
+
                // Return updated instance
                return detachedUser;
        }
 
        @Override
-       public PasswordHistory updateUserPassword (final User user) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException {
+       public PasswordHistory updateUserPassword (final User user, final String baseUrl) throws UserNotFoundException, UserStatusUnconfirmedException, UserStatusLockedException {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPassword: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: user={1},baseUrl={2} - CALLED!", this.getClass().getSimpleName(), user, baseUrl)); //NOI18N
 
                // user should not be null
                if (null == user) {
@@ -696,6 +618,12 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                } else if (!this.ifUserExists(user)) {
                        // User does not exist
                        throw new EJBException(MessageFormat.format("User with id {0} does not exist.", user.getUserId())); //NOI18N
+               } else if (null == baseUrl) {
+                       // Abort here
+                       throw new NullPointerException("password is null"); //NOI18N
+               } else if (baseUrl.isEmpty()) {
+                       // Abort here
+                       throw new IllegalArgumentException("password is empty"); //NOI18N
                }
 
                // Call other method
@@ -714,7 +642,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                this.getEntityManager().flush();
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPassword: entry.userPasswordHistoryId={0} - EXIT!", entry.getUserPasswordHistoryId())); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPassword: entry.userPasswordHistoryId={1} - EXIT!", this.getClass().getSimpleName(), entry.getUserPasswordHistoryId())); //NOI18N
 
                // Return it
                return entry;
@@ -723,7 +651,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
        @Override
        public User updateUserPersonalData (final User user) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("updateUserPersonalData: user={0} - CALLED!", user)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: user={1} - CALLED!", this.getClass().getSimpleName(), user)); //NOI18N
 
                // user should not be null
                if (null == user) {
@@ -783,34 +711,34 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                // Should be found!
                assert (detachedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", user.getUserContact().getContactId()); //NOI18N
 
-               // Get cellphone instance
-               DialableCellphoneNumber cellphone = detachedContact.getContactCellphoneNumber();
+               // Get mobile instance
+               DialableMobileNumber mobileNumber = detachedContact.getContactMobileNumber();
 
-               // Is there a  cellphone instance set?
-               if (cellphone instanceof DialableCellphoneNumber) {
+               // Is there a  mobile instance set?
+               if (mobileNumber instanceof DialableMobileNumber) {
                        // Debug message
-                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); //NOI18N
+                       this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: mobile.phoneId={0} is being updated ...", mobileNumber.getPhoneId())); //NOI18N
 
                        // Then find it, too
-                       DialableCellphoneNumber foundCellphone = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId());
+                       DialableMobileNumber foundMobile = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId());
 
                        // Should be there
-                       assert (foundCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", foundCellphone.getPhoneId()); //NOI18N
+                       assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
 
                        // Then merge it, too
-                       DialableCellphoneNumber detachedCellphone = this.getEntityManager().merge(foundCellphone);
+                       DialableMobileNumber detachedMobile = this.getEntityManager().merge(foundMobile);
 
                        // Should be there
-                       assert (detachedCellphone instanceof DialableCellphoneNumber) : MessageFormat.format("Cellphone number with id {0} not found but should be.", detachedCellphone.getPhoneId()); //NOI18N
+                       assert (detachedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", detachedMobile.getPhoneId()); //NOI18N
 
                        // Copy all
-                       detachedCellphone.copyAll(user.getUserContact().getContactCellphoneNumber());
+                       detachedMobile.copyAll(user.getUserContact().getContactMobileNumber());
 
                        // Set it back
-                       detachedContact.setContactCellphoneNumber(detachedCellphone);
+                       detachedContact.setContactMobileNumber(detachedMobile);
                }
 
-               // Get cellphone instance
+               // Get mobile instance
                DialableFaxNumber fax = detachedContact.getContactFaxNumber();
 
                // Is there a  fax instance set?
@@ -837,7 +765,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        detachedContact.setContactFaxNumber(detachedFax);
                }
 
-               // Get cellphone instance
+               // Get mobile instance
                DialableLandLineNumber landLine = detachedContact.getContactLandLineNumber();
 
                // Is there a  fax instance set?
@@ -864,6 +792,9 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        detachedContact.setContactLandLineNumber(detachedLandLine);
                }
 
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: entry.detachedUser={1} - EXIT!", this.getClass().getSimpleName(), detachedUser)); //NOI18N
+
                // Return updated user instance
                return detachedUser;
        }