assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
// Merge user
- User detachedUser = this.getEntityManager().merge(foundUser);
+ User managedUser = this.getEntityManager().merge(foundUser);
// Should be found!
- assert (detachedUser instanceof User) : MessageFormat.format("User with id {0} not merged, but should be.", user.getUserId()); //NOI18N
+ assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not merged, but should be.", managedUser.getUserId()); //NOI18N
// Copy all data
- UserUtils.copyAll(user, detachedUser);
+ UserUtils.copyAll(managedUser, managedUser);
// Set as updated
- detachedUser.setUserUpdated(new GregorianCalendar());
+ managedUser.setUserUpdated(new GregorianCalendar());
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: detachedUser={1} - CALLED!", this.getClass().getSimpleName(), detachedUser)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: managedUser={1} - CALLED!", this.getClass().getSimpleName(), managedUser)); //NOI18N
// Return updated instance
- return detachedUser;
+ return managedUser;
}
@Override
assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
// Merge user
- User detachedUser = this.getEntityManager().merge(foundUser);
+ User managedUser = this.getEntityManager().merge(foundUser);
// Should be found!
- assert (detachedUser instanceof User) : MessageFormat.format("User with id {0} not merged, but should be.", user.getUserId()); //NOI18N
+ assert (managedUser instanceof User) : MessageFormat.format("User with id {0} not merged, but should be.", managedUser.getUserId()); //NOI18N
// Copy all data
- UserUtils.copyAll(user, detachedUser);
+ UserUtils.copyAll(managedUser, managedUser);
// Set as updated
- detachedUser.setUserUpdated(new GregorianCalendar());
- detachedUser.getUserContact().setContactUpdated(new GregorianCalendar());
+ managedUser.setUserUpdated(new GregorianCalendar());
+ managedUser.getUserContact().setContactUpdated(new GregorianCalendar());
// Get contact from it and find it
- Contact foundContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
+ Contact foundContact = this.getEntityManager().find(managedUser.getUserContact().getClass(), managedUser.getUserContact().getContactId());
// Should be found
- assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", user.getUserContact().getContactId()); //NOI18N
+ assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", managedUser.getUserContact().getContactId()); //NOI18N
// Debug message
this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: contact.contactId={0}", foundContact.getContactId())); //NOI18N
Contact detachedContact = this.getEntityManager().merge(foundContact);
// Copy all
- ContactUtils.copyAll(user.getUserContact(), detachedContact);
+ ContactUtils.copyAll(managedUser.getUserContact(), detachedContact);
// Set it back in user
- user.setUserContact(detachedContact);
+ managedUser.setUserContact(detachedContact);
// Should be found!
- assert (detachedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", user.getUserContact().getContactId()); //NOI18N
+ assert (detachedContact instanceof Contact) : MessageFormat.format("Contact with id {0} not merged, but should be.", managedUser.getUserContact().getContactId()); //NOI18N
// Get mobile instance
DialableMobileNumber mobileNumber = detachedContact.getContactMobileNumber();
assert (detachedMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", detachedMobile.getPhoneId()); //NOI18N
// Copy all
- detachedMobile.copyAll(user.getUserContact().getContactMobileNumber());
+ detachedMobile.copyAll(managedUser.getUserContact().getContactMobileNumber());
// Set it back
detachedContact.setContactMobileNumber(detachedMobile);
assert (detachedFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", detachedFax.getPhoneId()); //NOI18N
// Copy all
- detachedFax.copyAll(user.getUserContact().getContactFaxNumber());
+ detachedFax.copyAll(managedUser.getUserContact().getContactFaxNumber());
// Set it back
detachedContact.setContactFaxNumber(detachedFax);
assert (detachedLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", detachedLandLine.getPhoneId()); //NOI18N
// Copy all
- detachedLandLine.copyAll(user.getUserContact().getContactLandLineNumber());
+ detachedLandLine.copyAll(managedUser.getUserContact().getContactLandLineNumber());
// Set it back
detachedContact.setContactLandLineNumber(detachedLandLine);
}
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: entry.detachedUser={1} - EXIT!", this.getClass().getSimpleName(), detachedUser)); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserPersonalData: entry.user={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N
// Return updated user instance
- return detachedUser;
+ return managedUser;
}
}