]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Tue, 26 Apr 2016 10:43:04 +0000 (12:43 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 27 Apr 2016 19:06:08 +0000 (21:06 +0200)
- setting "created" timestamps for cellphone, land-line and fax number
- added object-equality check
- added trace message

src/java/org/mxchange/jcontacts/contact/PizzaContactSessionBean.java
src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java

index 44edd2cb7f5169f0f63fb57b7f1366c63ea48b9d..cd740ec56b317fd18fb41b3da72899bbae02088a 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.jcontacts.contact;
 import java.text.MessageFormat;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
@@ -169,9 +170,15 @@ public class PizzaContactSessionBean extends BasePizzaDatabaseBean implements Co
                        this.getLoggerBeanLocal().logDebug(MessageFormat.format("isContactFound: next={0}", next)); //NOI18N
 
                        // Is same contact?
-                       if (ContactUtils.isSameContact(contact, next)) {
+                       if ((Objects.equals(contact, next)) || (ContactUtils.isSameContact(contact, next))) {
                                // Debug message
-                               this.getLoggerBeanLocal().logDebug("isContactFound: Found same contact."); //NOI18N
+                               this.getLoggerBeanLocal().logDebug(MessageFormat.format("isContactFound: Found same contact, id={0}", next.getContactId())); //NOI18N
+
+                               // Set contact id
+                               contact.setContactId(next.getContactId());
+
+                               // Update also other ids
+                               this.setAllContactPhoneEntries(contact, next);
 
                                // Found it
                                isFound = true;
@@ -179,6 +186,9 @@ public class PizzaContactSessionBean extends BasePizzaDatabaseBean implements Co
                        }
                }
 
+               // Trace message
+               this.getLoggerBeanLocal().logTrace(MessageFormat.format("isContactFound: isFound={0} - EXIT!", isFound)); //NOI18N
+
                // Return status
                return isFound;
        }
index 149e23076699c2d7eada0a688f8ad10b8f6bf16d..76c1b6395d4821f01af3319b8fdc9e05ed9e9c79 100644 (file)
@@ -94,8 +94,9 @@ public class PizzaAdminCustomerSessionBean extends BasePizzaDatabaseBean impleme
                        customer.setCustomerContact(null);
                }
 
-               // Set created timestamp
+               // Set created timestamp(s)
                customer.setCustomerCreated(new GregorianCalendar());
+               this.setAllContactPhoneEntriesCreated(contact);
 
                // Persist the customer
                this.getEntityManager().persist(customer);