From 39b5d6ec1c794babf7203d88072fe1acb861d7a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 23 Sep 2017 00:04:14 +0200 Subject: [PATCH] Continued: - need to change java.util.Calendar (bye bye) to java.util.Date in favour of PrimeFaces' p:calendar [!] tag MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../email_address/ChangeableEmailAddress.java | 10 +++++----- .../email_address/EmailAddressChange.java | 16 +++++++-------- .../jusercore/model/user/LoginUser.java | 20 +++++++++---------- .../mxchange/jusercore/model/user/User.java | 14 ++++++------- .../jusercore/model/user/UserUtils.java | 12 +++++------ .../password_history/PasswordHistory.java | 6 +++--- .../password_history/UserPasswordHistory.java | 8 ++++---- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java b/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java index c0beccb..6676111 100644 --- a/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java +++ b/src/org/mxchange/jusercore/model/email_address/ChangeableEmailAddress.java @@ -17,7 +17,7 @@ package org.mxchange.jusercore.model.email_address; import java.io.Serializable; -import java.util.Calendar; +import java.util.Date; import org.mxchange.jusercore.model.email_address.status.EmailChangeStatus; import org.mxchange.jusercore.model.user.User; @@ -62,14 +62,14 @@ public interface ChangeableEmailAddress extends Serializable { *

* @return Created "email change" timestamp */ - Calendar getEmailChangeCreated (); + Date getEmailChangeCreated (); /** * Setter for created "email change" timestamp *

* @param emailChangeCreated Created "email change" timestamp */ - void setEmailChangeCreated (final Calendar emailChangeCreated); + void setEmailChangeCreated (final Date emailChangeCreated); /** * Getter for user initiating the email change @@ -90,14 +90,14 @@ public interface ChangeableEmailAddress extends Serializable { *

* @return Email change done/undone */ - Calendar getEmailChangeDone (); + Date getEmailChangeDone (); /** * Setter for email change done/undone *

* @param emailChangeDone Email change done/undone */ - void setEmailChangeDone (final Calendar emailChangeDone); + void setEmailChangeDone (final Date emailChangeDone); /** * Getter for email change status diff --git a/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java b/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java index bbfd485..ca8940c 100644 --- a/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java +++ b/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java @@ -16,7 +16,7 @@ */ package org.mxchange.jusercore.model.email_address; -import java.util.Calendar; +import java.util.Date; import java.util.Objects; import javax.persistence.Basic; import javax.persistence.CascadeType; @@ -75,7 +75,7 @@ public class EmailAddressChange implements ChangeableEmailAddress { @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) @Column (name = "email_change_created", nullable = false, updatable = false) - private Calendar emailChangeCreated; + private Date emailChangeCreated; /** * Timestamp when this change has been done or undone @@ -83,7 +83,7 @@ public class EmailAddressChange implements ChangeableEmailAddress { @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) @Column (name = "email_change_done", nullable = false, updatable = false) - private Calendar emailChangeDone; + private Date emailChangeDone; /** * Email change hash the user has to click @@ -134,7 +134,7 @@ public class EmailAddressChange implements ChangeableEmailAddress { * @param emailChangeDone When this entry has been done * @param emailChangeHash Email change hash */ - public EmailAddressChange (final Long emailChangeId, final User user, final String emailAddress, final Calendar emailChangeCreated, final EmailChangeStatus emailChangeStatus, final Calendar emailChangeDone, final String emailChangeHash) { + public EmailAddressChange (final Long emailChangeId, final User user, final String emailAddress, final Date emailChangeCreated, final EmailChangeStatus emailChangeStatus, final Date emailChangeDone, final String emailChangeHash) { // Call other constructor this(user, emailAddress); @@ -196,25 +196,25 @@ public class EmailAddressChange implements ChangeableEmailAddress { @Override @SuppressWarnings ("ReturnOfDateField") - public Calendar getEmailChangeCreated () { + public Date getEmailChangeCreated () { return this.emailChangeCreated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEmailChangeCreated (final Calendar emailChangeCreated) { + public void setEmailChangeCreated (final Date emailChangeCreated) { this.emailChangeCreated = emailChangeCreated; } @Override @SuppressWarnings ("ReturnOfDateField") - public Calendar getEmailChangeDone () { + public Date getEmailChangeDone () { return this.emailChangeDone; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setEmailChangeDone (final Calendar emailChangeDone) { + public void setEmailChangeDone (final Date emailChangeDone) { this.emailChangeDone = emailChangeDone; } diff --git a/src/org/mxchange/jusercore/model/user/LoginUser.java b/src/org/mxchange/jusercore/model/user/LoginUser.java index 0bfc4a8..886df76 100644 --- a/src/org/mxchange/jusercore/model/user/LoginUser.java +++ b/src/org/mxchange/jusercore/model/user/LoginUser.java @@ -16,7 +16,7 @@ */ package org.mxchange.jusercore.model.user; -import java.util.Calendar; +import java.util.Date; import java.util.Locale; import java.util.Objects; import javax.persistence.Basic; @@ -101,7 +101,7 @@ public class LoginUser implements User { @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) @Column (name = "user_created", nullable = false, updatable = false) - private Calendar userCreated; + private Date userCreated; /** * Encrypted password @@ -123,7 +123,7 @@ public class LoginUser implements User { */ @Temporal (TemporalType.TIMESTAMP) @Column (name = "user_last_locked_timestamp") - private Calendar userLastLocked; + private Date userLastLocked; /** * Last locked reason @@ -164,7 +164,7 @@ public class LoginUser implements User { */ @Temporal (TemporalType.TIMESTAMP) @Column (name = "user_updated", insertable = false) - private Calendar userUpdated; + private Date userUpdated; /** * Default constructor @@ -225,13 +225,13 @@ public class LoginUser implements User { @Override @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserCreated () { + public Date getUserCreated () { return this.userCreated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserCreated (final Calendar userCreated) { + public void setUserCreated (final Date userCreated) { this.userCreated = userCreated; } @@ -257,13 +257,13 @@ public class LoginUser implements User { @Override @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserLastLocked () { + public Date getUserLastLocked () { return this.userLastLocked; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserLastLocked (final Calendar userLastLocked) { + public void setUserLastLocked (final Date userLastLocked) { this.userLastLocked = userLastLocked; } @@ -319,13 +319,13 @@ public class LoginUser implements User { @Override @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserUpdated () { + public Date getUserUpdated () { return this.userUpdated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserUpdated (final Calendar userUpdated) { + public void setUserUpdated (final Date userUpdated) { this.userUpdated = userUpdated; } diff --git a/src/org/mxchange/jusercore/model/user/User.java b/src/org/mxchange/jusercore/model/user/User.java index 5560fc6..979ca66 100644 --- a/src/org/mxchange/jusercore/model/user/User.java +++ b/src/org/mxchange/jusercore/model/user/User.java @@ -17,7 +17,7 @@ package org.mxchange.jusercore.model.user; import java.io.Serializable; -import java.util.Calendar; +import java.util.Date; import java.util.Locale; import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; @@ -77,14 +77,14 @@ public interface User extends Serializable { *

* @return "created" timestamp */ - Calendar getUserCreated (); + Date getUserCreated (); /** * Setter for "created" timestamp *

* @param userCreated "created" timestamp */ - void setUserCreated (final Calendar userCreated); + void setUserCreated (final Date userCreated); /** * Getter for encrypted password @@ -119,14 +119,14 @@ public interface User extends Serializable { *

* @return "locked" timestamp */ - Calendar getUserLastLocked (); + Date getUserLastLocked (); /** * Getter for "locked" timestamp *

* @param userLocked "locked" timestamp */ - void setUserLastLocked (final Calendar userLocked); + void setUserLastLocked (final Date userLocked); /** * Getter for reason of last locked @@ -175,14 +175,14 @@ public interface User extends Serializable { *

* @return Updated timestamp */ - Calendar getUserUpdated (); + Date getUserUpdated (); /** * Setter for updated timestamp *

* @param userUpdated Updated timestamp */ - void setUserUpdated (final Calendar userUpdated); + void setUserUpdated (final Date userUpdated); /** * Getter for user's locale diff --git a/src/org/mxchange/jusercore/model/user/UserUtils.java b/src/org/mxchange/jusercore/model/user/UserUtils.java index ba7b3f1..df4464d 100644 --- a/src/org/mxchange/jusercore/model/user/UserUtils.java +++ b/src/org/mxchange/jusercore/model/user/UserUtils.java @@ -20,7 +20,7 @@ import java.io.Serializable; import java.security.SecureRandom; import java.text.DateFormat; import java.text.MessageFormat; -import java.util.Calendar; +import java.util.Date; import java.util.Properties; import java.util.Random; import org.mxchange.jcontacts.model.contact.Contact; @@ -246,19 +246,19 @@ public class UserUtils implements Serializable { } /** - * Returns a formatted string from given user's locale and Calendar instance + * Returns a formatted string from given user's locale and Date instance *

* @param user User instance - * @param calendar Calendar instance + * @param date Date instance *

- * @return A formatted string from Calendar instance + * @return A formatted string from Date instance */ - public static String getFormattedTimestampFromUser (final User user, final Calendar calendar) { + public static String getFormattedTimestampFromUser (final User user, final Date date) { // Get formatter DateFormat format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, user.getUserLocale()); // Now simply format the calendar's Time (not just time) field - String dateTime = format.format(calendar.getTime()); + String dateTime = format.format(date.getTime()); // Return it return dateTime; diff --git a/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java b/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java index 123bfcf..1c7aedd 100644 --- a/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java +++ b/src/org/mxchange/jusercore/model/user/password_history/PasswordHistory.java @@ -17,7 +17,7 @@ package org.mxchange.jusercore.model.user.password_history; import java.io.Serializable; -import java.util.Calendar; +import java.util.Date; import org.mxchange.jusercore.model.user.User; /** @@ -33,7 +33,7 @@ public interface PasswordHistory extends Serializable { *

* @return Timestamp when this history entry has been created */ - Calendar getUserPasswordHistoryCreated (); + Date getUserPasswordHistoryCreated (); /** * Setter for timestamp this history entry has been created (usually in @@ -42,7 +42,7 @@ public interface PasswordHistory extends Serializable { * @param userPasswordHistoryCreated Timestamp when this history entry has * been created */ - void setUserPasswordHistoryCreated (final Calendar userPasswordHistoryCreated); + void setUserPasswordHistoryCreated (final Date userPasswordHistoryCreated); /** * Getter for history entry id (primary key) diff --git a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java b/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java index 06b3a6b..3da56ca 100644 --- a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java +++ b/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java @@ -16,7 +16,7 @@ */ package org.mxchange.jusercore.model.user.password_history; -import java.util.Calendar; +import java.util.Date; import java.util.Objects; import javax.persistence.Basic; import javax.persistence.CascadeType; @@ -65,7 +65,7 @@ public class UserPasswordHistory implements PasswordHistory { @Basic (optional = false) @Column (name = "history_created", nullable = false, updatable = false) @Temporal (TemporalType.TIMESTAMP) - private Calendar userPasswordHistoryCreated; + private Date userPasswordHistoryCreated; /** * Id number (primary key) @@ -132,13 +132,13 @@ public class UserPasswordHistory implements PasswordHistory { @Override @SuppressWarnings ("ReturnOfDateField") - public Calendar getUserPasswordHistoryCreated () { + public Date getUserPasswordHistoryCreated () { return this.userPasswordHistoryCreated; } @Override @SuppressWarnings ("AssignmentToDateFieldFromParameter") - public void setUserPasswordHistoryCreated (final Calendar userPasswordHistoryCreated) { + public void setUserPasswordHistoryCreated (final Date userPasswordHistoryCreated) { this.userPasswordHistoryCreated = userPasswordHistoryCreated; } -- 2.39.5