From: Roland Häder Date: Fri, 22 Sep 2017 22:20:50 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4b902d430c8c54780d1e4a60cf8496d90934ef0e;p=jjobs-ejb.git Please cherry-pick: - need to change java.util.Calendar (bye bye) to java.util.Date in favour of PrimeFaces' p:calendar [!] tag Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jcontacts/model/contact/JobsAdminContactSessionBean.java b/src/java/org/mxchange/jcontacts/model/contact/JobsAdminContactSessionBean.java index 190c84b..8c279ba 100644 --- a/src/java/org/mxchange/jcontacts/model/contact/JobsAdminContactSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/contact/JobsAdminContactSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jcontacts.model.contact; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import javax.ejb.Stateless; import javax.persistence.NoResultException; import javax.persistence.Query; @@ -64,7 +64,7 @@ public class JobsAdminContactSessionBean extends BaseJobsDatabaseBean implements } // Set created timestamp - contact.setContactCreated(new GregorianCalendar()); + contact.setContactCreated(new Date()); // Set all created timestamps, if instance is there this.setAllContactPhoneEntriesCreated(contact); diff --git a/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java b/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java index 0555707..c215fc7 100644 --- a/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java +++ b/src/java/org/mxchange/jcontacts/model/phone/JobsAdminContactPhoneSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jcontacts.model.phone; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.Objects; import javax.ejb.EJB; import javax.ejb.Stateless; @@ -260,7 +260,7 @@ public class JobsAdminContactPhoneSessionBean extends BaseJobsDatabaseBean imple } // Set created instance - faxNumber.setPhoneEntryCreated(new GregorianCalendar()); + faxNumber.setPhoneEntryCreated(new Date()); // Set fax number in contact contact.setContactFaxNumber(faxNumber); @@ -317,7 +317,7 @@ public class JobsAdminContactPhoneSessionBean extends BaseJobsDatabaseBean imple } // Set created instance - landLineNumber.setPhoneEntryCreated(new GregorianCalendar()); + landLineNumber.setPhoneEntryCreated(new Date()); // Set landLine number in contact contact.setContactLandLineNumber(landLineNumber); @@ -368,7 +368,7 @@ public class JobsAdminContactPhoneSessionBean extends BaseJobsDatabaseBean imple } // Set created instance - mobileNumber.setPhoneEntryCreated(new GregorianCalendar()); + mobileNumber.setPhoneEntryCreated(new Date()); // Set mobile number in contact contact.setContactMobileNumber(mobileNumber); diff --git a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/JobsAdminBusinessDataSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/JobsAdminBusinessDataSessionBean.java index 7e45d79..61818b5 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/basicdata/JobsAdminBusinessDataSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/basicdata/JobsAdminBusinessDataSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.model.basicdata; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.List; import java.util.Objects; import javax.ejb.EJB; @@ -72,7 +72,7 @@ public class JobsAdminBusinessDataSessionBean extends BaseJobsDatabaseBean imple } // Now add current date - basicData.setCompanyCreated(new GregorianCalendar()); + basicData.setCompanyCreated(new Date()); // Is there a owner set? if (basicData.getCompanyUserOwner() instanceof User) { diff --git a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/JobsAdminBranchOfficeSessionBean.java b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/JobsAdminBranchOfficeSessionBean.java index c3f8803..dfcddb3 100644 --- a/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/JobsAdminBranchOfficeSessionBean.java +++ b/src/java/org/mxchange/jcontactsbusiness/model/branchoffice/JobsAdminBranchOfficeSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jcontactsbusiness.model.branchoffice; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.List; import javax.ejb.EJB; import javax.ejb.Stateless; @@ -70,7 +70,7 @@ public class JobsAdminBranchOfficeSessionBean extends BaseJobsDatabaseBean imple } // Add created timestamp - branchOffice.setBranchCreated(new GregorianCalendar()); + branchOffice.setBranchCreated(new Date()); // Is user instance set? if (branchOffice.getBranchCompany() instanceof org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData) { diff --git a/src/java/org/mxchange/jcountry/model/data/JobsCountrySingletonBean.java b/src/java/org/mxchange/jcountry/model/data/JobsCountrySingletonBean.java index 8629f05..26c3b6d 100644 --- a/src/java/org/mxchange/jcountry/model/data/JobsCountrySingletonBean.java +++ b/src/java/org/mxchange/jcountry/model/data/JobsCountrySingletonBean.java @@ -17,7 +17,7 @@ package org.mxchange.jcountry.model.data; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.List; import javax.ejb.Singleton; import javax.ejb.Startup; @@ -72,7 +72,7 @@ public class JobsCountrySingletonBean extends BaseJobsDatabaseBean implements Co } // Add timestamp - country.setCountryEntryCreated(new GregorianCalendar()); + country.setCountryEntryCreated(new Date()); // It is not added, so persist it this.getEntityManager().persist(country); diff --git a/src/java/org/mxchange/jjobs/database/BaseJobsDatabaseBean.java b/src/java/org/mxchange/jjobs/database/BaseJobsDatabaseBean.java index 5187f12..1b21d2d 100644 --- a/src/java/org/mxchange/jjobs/database/BaseJobsDatabaseBean.java +++ b/src/java/org/mxchange/jjobs/database/BaseJobsDatabaseBean.java @@ -17,7 +17,7 @@ package org.mxchange.jjobs.database; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.Objects; import java.util.Properties; import javax.ejb.EJBException; @@ -109,7 +109,7 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N // Set updated timestamp - landLineNumber.setPhoneEntryCreated(new GregorianCalendar()); + landLineNumber.setPhoneEntryCreated(new Date()); } // Is a fax number instance set? @@ -118,7 +118,7 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N // Set updated timestamp - faxNumber.setPhoneEntryCreated(new GregorianCalendar()); + faxNumber.setPhoneEntryCreated(new Date()); } // Is a mobile number instance set? @@ -127,7 +127,7 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesCreated: Setting created timestamp for mobile number ...", this.getClass().getSimpleName())); //NOI18N // Set updated timestamp - mobileNumber.setPhoneEntryCreated(new GregorianCalendar()); + mobileNumber.setPhoneEntryCreated(new Date()); } // Trace message @@ -499,6 +499,9 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { throw new IllegalStateException(MessageFormat.format("{0}.detachedContact.contactId={1} is not valid.", this.getClass().getSimpleName(), detachedContact.getContactId())); //NOI18N } + // Set updated timestamp + detachedContact.setContactUpdated(new Date()); + // Get contact from it and find it final Contact foundContact = this.getEntityManager().find(detachedContact.getClass(), detachedContact.getContactId()); @@ -881,7 +884,7 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for land-line number ...", this.getClass().getSimpleName())); //NOI18N // Set updated timestamp - landLineNumber.setPhoneEntryUpdated(new GregorianCalendar()); + landLineNumber.setPhoneEntryUpdated(new Date()); } // Is a fax number instance set? @@ -890,7 +893,7 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for fax number ...", this.getClass().getSimpleName())); //NOI18N // Set updated timestamp - faxNumber.setPhoneEntryUpdated(new GregorianCalendar()); + faxNumber.setPhoneEntryUpdated(new Date()); } // Is a mobile number instance set? @@ -899,7 +902,7 @@ public abstract class BaseJobsDatabaseBean extends BaseDatabaseBean { this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.setAllContactPhoneEntriesUpdated: Setting updated timestamp for mobile number ...", this.getClass().getSimpleName())); //NOI18N // Set updated timestamp - mobileNumber.setPhoneEntryUpdated(new GregorianCalendar()); + mobileNumber.setPhoneEntryUpdated(new Date()); } // Trace message diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/JobsAdminMobileProviderSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/JobsAdminMobileProviderSessionBean.java index 22e4489..603f14a 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/JobsAdminMobileProviderSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/mobileprovider/JobsAdminMobileProviderSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.model.phonenumbers.mobileprovider; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import javax.ejb.Stateless; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; import org.mxchange.jphone.exceptions.MobileProviderAlreadyAddedException; @@ -79,7 +79,7 @@ public class JobsAdminMobileProviderSessionBean extends BaseJobsDatabaseBean imp } // Set creation timestamp - mobileProvider.setProviderEntryCreated(new GregorianCalendar()); + mobileProvider.setProviderEntryCreated(new Date()); // Persist it this.getEntityManager().persist(mobileProvider); diff --git a/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java b/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java index 9b387f6..8607fbb 100644 --- a/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java +++ b/src/java/org/mxchange/jphone/model/phonenumbers/phone/JobsAdminPhoneSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jphone.model.phonenumbers.phone; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import javax.ejb.Stateless; import org.mxchange.jjobs.database.BaseJobsDatabaseBean; import org.mxchange.jphone.model.phonenumbers.phone.AdminPhoneSessionBeanRemote; @@ -229,8 +229,8 @@ public class JobsAdminPhoneSessionBean extends BaseJobsDatabaseBean implements A this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateFaxData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getPhoneId())); //NOI18N // Set updated timestamp - org.mxchange.jphone.model.phonenumbers.fax.FaxNumbers.copyAll(faxNumber, managedNumber); - managedNumber.setPhoneEntryUpdated(new GregorianCalendar()); + FaxNumbers.copyAll(faxNumber, managedNumber); + managedNumber.setPhoneEntryUpdated(new Date()); // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateFaxData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N @@ -287,8 +287,8 @@ public class JobsAdminPhoneSessionBean extends BaseJobsDatabaseBean implements A this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateLandLineData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getPhoneId())); //NOI18N // Set updated timestamp - org.mxchange.jphone.model.phonenumbers.landline.LandLineNumbers.copyAll(landLineNumber, managedNumber); - managedNumber.setPhoneEntryUpdated(new GregorianCalendar()); + LandLineNumbers.copyAll(landLineNumber, managedNumber); + managedNumber.setPhoneEntryUpdated(new Date()); // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateLandLineData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N @@ -339,8 +339,8 @@ public class JobsAdminPhoneSessionBean extends BaseJobsDatabaseBean implements A this.getLoggerBeanLocal().logDebug(MessageFormat.format("{0}.updateMobileData: managedNumber.phoneId={1}", this.getClass().getSimpleName(), managedNumber.getPhoneId())); //NOI18N // Set updated timestamp - org.mxchange.jphone.model.phonenumbers.mobile.MobileNumbers.copyAll(mobileNumber, managedNumber); - managedNumber.setPhoneEntryUpdated(new GregorianCalendar()); + MobileNumbers.copyAll(mobileNumber, managedNumber); + managedNumber.setPhoneEntryUpdated(new Date()); // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateMobileData: managedNumber={1} - EXIT!", this.getClass().getSimpleName(), managedNumber)); //NOI18N diff --git a/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java index fac2bbd..c0fb24e 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsAdminUserSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jusercore.model.user; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import javax.ejb.EJB; import javax.ejb.Stateless; import org.mxchange.jcontacts.model.contact.Contact; @@ -88,8 +88,8 @@ public class JobsAdminUserSessionBean extends BaseJobsDatabaseBean implements Ad } // Set created timestamp - user.setUserCreated(new GregorianCalendar()); - user.getUserContact().setContactCreated(new GregorianCalendar()); + user.setUserCreated(new Date()); + user.getUserContact().setContactCreated(new Date()); // Update mobile, land-line and fax instance this.setAllContactPhoneEntriesCreated(user.getUserContact()); @@ -185,7 +185,7 @@ public class JobsAdminUserSessionBean extends BaseJobsDatabaseBean implements Ad user.setUserContact(foundContact); // Set timestamp - user.setUserCreated(new GregorianCalendar()); + user.setUserCreated(new Date()); // Perist it this.getEntityManager().persist(user); @@ -246,7 +246,7 @@ public class JobsAdminUserSessionBean extends BaseJobsDatabaseBean implements Ad // Set as locked, set timestamp and lock reason user.setUserAccountStatus(UserAccountStatus.LOCKED); - user.setUserLastLocked(new GregorianCalendar()); + user.setUserLastLocked(new Date()); user.setUserLastLockedReason(userLockReason); // Update user diff --git a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java index e4a65fa..9d29a40 100644 --- a/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jusercore.model.user; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.List; import javax.ejb.EJB; import javax.ejb.EJBException; @@ -194,7 +194,7 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes // Update user status and remove confirmation key managedUser.setUserAccountStatus(UserAccountStatus.CONFIRMED); managedUser.setUserConfirmKey(null); - managedUser.setUserUpdated(new GregorianCalendar()); + managedUser.setUserUpdated(new Date()); // Send out email this.sendEmail("User account confirmed", "user_account_confirmed", managedUser, baseUrl, null); //NOI18N @@ -598,7 +598,7 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes UserUtils.copyAll(user, managedUser); // Set as updated - managedUser.setUserUpdated(new GregorianCalendar()); + managedUser.setUserUpdated(new Date()); // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateUserData: managedUser={1} - EXIT!", this.getClass().getSimpleName(), managedUser)); //NOI18N @@ -658,13 +658,13 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes final User managedUser = this.updateUserData(user); // Update user account - managedUser.setUserUpdated(new GregorianCalendar()); + managedUser.setUserUpdated(new Date()); // Create history entry PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), managedUser); // Set created timestamp - entry.setUserPasswordHistoryCreated(new GregorianCalendar()); + entry.setUserPasswordHistoryCreated(new Date()); // Merge user to make sure it is not re-persisted final User mergedUser = this.getEntityManager().merge(managedUser); @@ -716,8 +716,8 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes UserUtils.copyAll(user, managedUser); // Set as updated - managedUser.setUserUpdated(new GregorianCalendar()); - managedUser.getUserContact().setContactUpdated(new GregorianCalendar()); + managedUser.setUserUpdated(new Date()); + managedUser.getUserContact().setContactUpdated(new Date()); // Get contact from it and find it final Contact foundContact = this.getEntityManager().find(managedUser.getUserContact().getClass(), managedUser.getUserContact().getContactId()); diff --git a/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java b/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java index 3f7b677..9fc05f6 100644 --- a/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java +++ b/src/java/org/mxchange/jusercore/model/user/email_address/JobsUserEmailChangeSessionBean.java @@ -17,7 +17,7 @@ package org.mxchange.jusercore.model.user.email_address; import java.text.MessageFormat; -import java.util.GregorianCalendar; +import java.util.Date; import java.util.List; import javax.ejb.EJB; import javax.ejb.EJBException; @@ -106,7 +106,7 @@ public class JobsUserEmailChangeSessionBean extends BaseJobsDatabaseBean impleme } // The email change is not (yet) there, add secure hash and "created" timestamp - emailChange.setEmailChangeCreated(new GregorianCalendar()); + emailChange.setEmailChangeCreated(new Date()); this.generateSecureHash(emailChange); // Make user managed