]> git.mxchange.org Git - jfinancials-ejb.git/commitdiff
also set created entries in all phone numbers, if set
authorRoland Haeder <roland@mxchange.org>
Wed, 13 Apr 2016 21:17:11 +0000 (23:17 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 13 Apr 2016 21:17:25 +0000 (23:17 +0200)
src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java

index 1a926f39cfc07d8d4d25e342740a5aae551ac374..173e749682fd997257c30afa6342c477c143347d 100644 (file)
@@ -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