]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 23 Jun 2017 18:47:20 +0000 (20:47 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 23 Jun 2017 18:51:38 +0000 (20:51 +0200)
- renamed detachedFoo -> managedFoo
- used new copyAll() methods

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jfinancials/database/BaseFinancialsDatabaseBean.java

index d7da3e28d8f3169961e75adf9b9a926952253812..ecbbe886d1ddcaa145701cef990c337415e505b3 100644 (file)
@@ -25,6 +25,7 @@ import javax.jms.JMSException;
 import javax.jms.ObjectMessage;
 import javax.mail.Address;
 import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.contact.ContactUtils;
 import org.mxchange.jcoreee.database.BaseDatabaseBean;
 import org.mxchange.jmailee.model.delivery.wrapper.EmailDeliveryWrapper;
 import org.mxchange.jmailee.model.delivery.wrapper.WrapableEmailDelivery;
@@ -298,49 +299,49 @@ public abstract class BaseFinancialsDatabaseBean extends BaseDatabaseBean {
        /**
         * Merges given contact's data
         * <p>
-        * @param contact Contact instance to merge
+        * @param detachedContact Contact instance to merge
         * <p>
         * @return Detached contact instance
         */
-       protected Contact mergeContactData (final Contact contact) {
+       protected Contact mergeContactData (final Contact detachedContact) {
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: contact={0} - CALLED!", contact)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: detachedContact={0} - CALLED!", detachedContact)); //NOI18N
 
                // The contact instance must be valid
-               if (null == contact) {
+               if (null == detachedContact) {
                        // Throw NPE again
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
+                       throw new NullPointerException("detachedContact is null"); //NOI18N
+               } else if (detachedContact.getContactId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N //NOI18N
-               } else if (contact.getContactId() < 1) {
+                       throw new NullPointerException("detachedContact.contactId is null"); //NOI18N //NOI18N
+               } else if (detachedContact.getContactId() < 1) {
                        // Not valid
-                       throw new IllegalStateException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
+                       throw new IllegalStateException(MessageFormat.format("detachedContact.contactId={0} is not valid.", detachedContact.getContactId())); //NOI18N
                }
 
                // Set updated timestamp
-               contact.setContactUpdated(new GregorianCalendar());
+               detachedContact.setContactUpdated(new GregorianCalendar());
 
                // Get contact from it and find it
-               Contact foundContact = this.getEntityManager().find(contact.getClass(), contact.getContactId());
+               Contact foundContact = this.getEntityManager().find(detachedContact.getClass(), detachedContact.getContactId());
 
                // Should be found
-               assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", contact.getContactId()); //NOI18N
+               assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", detachedContact.getContactId()); //NOI18N
 
                // Debug message
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: foundContact.contactId={0}", foundContact.getContactId())); //NOI18N
 
                // Merge contact instance
-               Contact detachedContact = this.getEntityManager().merge(foundContact);
+               Contact managedContact = this.getEntityManager().merge(foundContact);
 
                // Copy all
-               detachedContact.copyAll(contact);
+               ContactUtils.copyAll(detachedContact, managedContact);
 
                // Trace message
-               this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: detachedContact={0} - EXIT!", detachedContact)); //NOI18N
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: detachedContact={0} - EXIT!", managedContact)); //NOI18N
 
                // Return detached contact
-               return detachedContact;
+               return managedContact;
        }
 
        /**