]> git.mxchange.org Git - jjobs-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 20 May 2020 18:34:41 +0000 (20:34 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 10 Jun 2020 17:26:59 +0000 (19:26 +0200)
- always set EntryUpdated in the managed (and merged) instance, as the
  copyFooData() methods do no longer copy timestamps

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jjobs/enterprise/BaseJobsEnterpriseBean.java

index 74ea8a0947c80f5dd565c29a0335ff1638612d4e..f956c349fee1ef1491803c3b8fdac78e1d190ecf 100644 (file)
@@ -707,25 +707,8 @@ public abstract class BaseJobsEnterpriseBean extends BaseEnterpriseBean {
                        throw new NullPointerException("fetchedNumber.phoneId is null"); //NOI18N
                }
 
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getMobileId())); //NOI18N
-
-               // Init query instance
-               final DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getMobileId());
-
-               // Debug message
-               this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
-
-               // Default is null
-               DialableMobileNumber detachedNumber = null;
-
-               // Is there a difference?
-               if (!MobileNumbers.isSameMobileNumber(mobileNumber, fetchedNumber)) {
-                       // @TODO Copy all to foundNumber, then merge
-
-                       // Merge this entry
-                       detachedNumber = this.getEntityManager().merge(foundNumber);
-               }
+               // Get contact from it and find it
+               final BranchOffice foundBranchOffice = this.getEntityManager().find(detachedBranchOffice.getClass(), detachedBranchOffice.getBranchId());
 
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
@@ -775,6 +758,9 @@ public abstract class BaseJobsEnterpriseBean extends BaseEnterpriseBean {
                        detachedNumber = this.getEntityManager().merge(foundNumber);
                }
 
+               // Set updated timestamp
+               managedBranchOffice.setBranchEntryUpdated(new Date());
+
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("getDetached: detachedNumber={0} - EXIT!", detachedNumber)); //NOI18N
 
@@ -853,9 +839,6 @@ public abstract class BaseJobsEnterpriseBean extends BaseEnterpriseBean {
                        throw new IllegalStateException(MessageFormat.format("detachedContact.contactId={0} is not valid.", detachedContact.getContactId())); //NOI18N
                }
 
-               // Set updated timestamp
-               detachedContact.setContactEntryUpdated(new Date());
-
                // Get contact from it and find it
                final Contact foundContact = this.createManaged(detachedContact);
 
@@ -868,6 +851,9 @@ public abstract class BaseJobsEnterpriseBean extends BaseEnterpriseBean {
                // Merge contact instance
                final Contact managedContact = this.getEntityManager().merge(foundContact);
 
+               // Set updated timestamp
+               managedContact.setContactEntryUpdated(new Date());
+
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeContactData: managedContact={0} - EXIT!", managedContact)); //NOI18N
 
@@ -1000,9 +986,6 @@ public abstract class BaseJobsEnterpriseBean extends BaseEnterpriseBean {
                        throw new IllegalStateException(MessageFormat.format("detachedDepartment.departmentId ={0} is not valid.", detachedDepartment.getDepartmentId())); //NOI18N
                }
 
-               // Set updated timestamp
-               detachedDepartment.setDepartmentEntryUpdated(new Date());
-
                // Get contact from it and find it
                final Department foundDepartment = this.createManaged(detachedDepartment);
 
@@ -1015,6 +998,9 @@ public abstract class BaseJobsEnterpriseBean extends BaseEnterpriseBean {
                // Merge contact instance
                final Department managedDepartment = this.getEntityManager().merge(foundDepartment);
 
+               // Set updated timestamp
+               managedDepartment.setDepartmentEntryUpdated(new Date());
+
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeDepartmentData: managedDepartment={0} - EXIT!", managedDepartment)); //NOI18N