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;
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;
}
}
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("isContactFound: isFound={0} - EXIT!", isFound)); //NOI18N
+
// Return status
return isFound;
}
customer.setCustomerContact(null);
}
- // Set created timestamp
+ // Set created timestamp(s)
customer.setCustomerCreated(new GregorianCalendar());
+ this.setAllContactPhoneEntriesCreated(contact);
// Persist the customer
this.getEntityManager().persist(customer);