From 945eae332cb22aee27d11591dec4b0778aca9eb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 2 May 2016 17:26:37 +0200 Subject: [PATCH] used new setter instead of "hard-coded" MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/user/JobsUserSessionBean.java | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java index 203f601..cb5be79 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java @@ -25,6 +25,7 @@ import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.PersistenceException; import javax.persistence.Query; +import org.mxchange.addressbook.database.BaseAddressbookDatabaseBean; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber; @@ -89,28 +90,8 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes user.setUserCreated(new GregorianCalendar()); user.getUserContact().setContactCreated(new GregorianCalendar()); - // 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()); - } + // Update cellphone, land-line and fax instance + this.setAllContactPhoneEntriesCreated(user.getUserContact()); // Persist it this.getEntityManager().persist(user); -- 2.39.5