]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Tue, 3 May 2016 13:13:35 +0000 (15:13 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 7 May 2016 13:43:39 +0000 (15:43 +0200)
- implemented linkUser()
- use interface for class name

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java

index f86f5a247bbb5bb38d990c1c9316e6657c5328fe..c27e1bb53fe6515cb02e1cf9b7240412e89d4dd3 100644 (file)
@@ -519,35 +519,26 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                        throw new IllegalStateException("User does already exist."); //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());
-
-               // Try to find the contact instance
+               // Try to find the contact
                Contact foundContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
 
-               // Try to merge it
+               // Merge the contact to get a detached object back
                Contact detachedContact = this.getEntityManager().merge(foundContact);
 
-               // Set it in user
+               // Set detached object in rexcruiter instance
                user.setUserContact(detachedContact);
 
-               // Persist user
+               // Set timestamp
+               user.setUserCreated(new GregorianCalendar());
+
+               // Perist it
                this.getEntityManager().persist(user);
 
-               // Flush it to get id
+               // Flush it to get updated instance back
                this.getEntityManager().flush();
 
-               // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("linkUser: user.userId={0} - EXIT!", user.getUserId())); //NOI18N
+               // Log trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("linkUser: user={0} - EXIT!", user)); //NOI18N
 
                // Return updated instanc
                return user;