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