From 42c6b57e4ad3cd5be251d0a8e20856dd5815a64b Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Wed, 13 Apr 2016 23:17:11 +0200 Subject: [PATCH] also set created entries in all phone numbers, if set --- .../model/user/JobsUserSessionBean.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java index 3dbe54f..ef3f043 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java @@ -85,7 +85,30 @@ public class JobsUserSessionBean extends BaseDatabaseBean implements UserSession 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 -- 2.39.5