]> git.mxchange.org Git - jjobs-ejb.git/commitdiff
used new setter instead of "hard-coded"
authorRoland Häder <roland@mxchange.org>
Mon, 2 May 2016 15:26:37 +0000 (17:26 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 2 May 2016 20:13:59 +0000 (22:13 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java

index 203f60177cf11609d6ce16ebd75fdbe31ca1c095..cb5be793ad8441099bbeb4f99072f694dc4a9b8b 100644 (file)
@@ -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);