From: Roland Haeder Date: Wed, 13 Apr 2016 21:17:11 +0000 (+0200) Subject: also set created entries in all phone numbers, if set X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ce1b09b530bead68b89054db2d7175d20541cec7;p=jfinancials-mailer-ejb.git also set created entries in all phone numbers, if set --- diff --git a/src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java index 1a926f3..173e749 100644 --- a/src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java @@ -85,7 +85,30 @@ public class AddressbookUserSessionBean extends BaseDatabaseBean implements User user.setUserCreated(new GregorianCalendar()); user.getUserContact().setContactCreated(new GregorianCalendar()); - // Persist it + // Get all phone instances + DialableLandLineNumber landLineNumber = user.getUserContact().getContactLandLineNumber(); + DialableFaxNumber faxNumber = user.getUserContact().getContactFaxNumber(); + DialableCellphoneNumber cellphoneNumber = user.getUserContact().getContactCellphoneNumber(); + + // Is a phone number instance set? + if (landLineNumber instanceof DialableLandLineNumber) { + // Set created timestamp + landLineNumber.setPhoneEntryCreated(new GregorianCalendar()); + } + + // Is a fax number instance set? + if (faxNumber instanceof DialableFaxNumber) { + // Set created timestamp + faxNumber.setPhoneEntryCreated(new GregorianCalendar()); + } + + // Is a mobile number instance set? + if (cellphoneNumber instanceof DialableCellphoneNumber) { + // Set created timestamp + cellphoneNumber.setPhoneEntryCreated(new GregorianCalendar()); + } + + // Persist it this.getEntityManager().persist(user); // Flush to get id back