From: Roland Häder <roland@mxchange.org>
Date: Thu, 23 Apr 2020 08:18:17 +0000 (+0200)
Subject: Continued:
X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cc2bb12318863d6d22d5fb3ad1b898feb763ea16;p=jbonuscard-core.git

Continued:
- renamed bonusCardCreated to bonusCardEntryCreated
- added bonusCardEntryUpdated
- primary key should not go into comparison???

Signed-off-by: Roland Häder <roland@mxchange.org>
---

diff --git a/src/org/mxchange/jbonuscard/model/bonus_card/BonusCard.java b/src/org/mxchange/jbonuscard/model/bonus_card/BonusCard.java
index 9a0cfee..5aeee6d 100644
--- a/src/org/mxchange/jbonuscard/model/bonus_card/BonusCard.java
+++ b/src/org/mxchange/jbonuscard/model/bonus_card/BonusCard.java
@@ -61,14 +61,28 @@ public interface BonusCard extends Comparable<BonusCard>, Serializable {
 	 * <p>
 	 * @return Bonus card's creation timestamp
 	 */
-	Date getBonusCardCreated ();
+	Date getBonusCardEntryCreated ();
 
 	/**
 	 * Setter for bonus card's creation timestamp
 	 * <p>
 	 * @param bonusCardCreated Bonus card's creation timestamp
 	 */
-	void setBonusCardCreated (final Date bonusCardCreated);
+	void setBonusCardEntryCreated (final Date bonusCardCreated);
+
+	/**
+	 * Getter for bonus card's updated timestamp
+	 * <p>
+	 * @return Bonus card's updated timestamp
+	 */
+	Date getBonusCardEntryUpdated ();
+
+	/**
+	 * Setter for bonus card's updated timestamp
+	 * <p>
+	 * @param bonusCardUpdated Bonus card's updated timestamp
+	 */
+	void setBonusCardEntryUpdated (final Date bonusCardUpdated);
 
 	/**
 	 * Getter for bonus card's customer data
@@ -87,56 +101,56 @@ public interface BonusCard extends Comparable<BonusCard>, Serializable {
 	/**
 	 * Getter for bonus card's primary key
 	 * <p>
- 	 * @return Bonus card's primary key
+	 * @return Bonus card's primary key
 	 */
 	Long getBonusCardId ();
 
 	/**
 	 * Setter for bonus card's primary key
 	 * <p>
- 	 * @param bonusCardId Bonus card's primary key
+	 * @param bonusCardId Bonus card's primary key
 	 */
 	void setBonusCardId (final Long bonusCardId);
 
 	/**
 	 * Getter for bonus card's issuing company
 	 * <p>
- 	 * @return Bonus card's issuing company
+	 * @return Bonus card's issuing company
 	 */
 	BasicData getBonusCardIssuer ();
 
 	/**
 	 * Setter for bonus card's issuing company
 	 * <p>
- 	 * @param bonusCardIssuer Bonus card's issuing company
+	 * @param bonusCardIssuer Bonus card's issuing company
 	 */
 	void setBonusCardIssuer (final BasicData bonusCardIssuer);
 
 	/**
 	 * Getter for bonus card's number (other than customer/bar code)
 	 * <p>
- 	 * @return Bonus card's number
+	 * @return Bonus card's number
 	 */
 	String getBonusCardNumber ();
 
 	/**
 	 * Setter for bonus card's number (other than customer/bar code)
 	 * <p>
- 	 * @param bonusCardNumber Bonus card's number
+	 * @param bonusCardNumber Bonus card's number
 	 */
 	void setBonusCardNumber (final String bonusCardNumber);
 
 	/**
 	 * Getter for bonus card's partnering/branding company
 	 * <p>
- 	 * @return Bonus card's partnering/branding company
+	 * @return Bonus card's partnering/branding company
 	 */
 	BasicData getBonusCardPartner ();
 
 	/**
 	 * Setter for bonus card's partnering/branding company
 	 * <p>
- 	 * @param bonusCardPartner Bonus card's partnering/branding company
+	 * @param bonusCardPartner Bonus card's partnering/branding company
 	 */
 	void setBonusCardPartner (final BasicData bonusCardPartner);
 
diff --git a/src/org/mxchange/jbonuscard/model/bonus_card/RoyalityCard.java b/src/org/mxchange/jbonuscard/model/bonus_card/RoyalityCard.java
index ea9e6e0..c3a6e06 100644
--- a/src/org/mxchange/jbonuscard/model/bonus_card/RoyalityCard.java
+++ b/src/org/mxchange/jbonuscard/model/bonus_card/RoyalityCard.java
@@ -65,7 +65,7 @@ public class RoyalityCard implements BonusCard {
 	/**
 	 * Bar code on bonus card
 	 */
-	@Column (name = "bonus_card_bar_code")
+	@Column (name = "bonus_card_bar_code", unique = true)
 	private String bonusCardBarCode;
 
 	/**
@@ -79,9 +79,16 @@ public class RoyalityCard implements BonusCard {
 	 * When this entry has been created
 	 */
 	@Basic (optional = false)
-	@Column (name = "bonus_card_created", nullable = false)
+	@Column (name = "bonus_card_entry_created", updatable = false, nullable = false)
 	@Temporal (TemporalType.TIMESTAMP)
-	private Date bonusCardCreated;
+	private Date bonusCardEntryCreated;
+
+	/**
+	 * When this entry has been updated
+	 */
+	@Column (name = "bonus_card_entry_updated", insertable = false)
+	@Temporal (TemporalType.TIMESTAMP)
+	private Date bonusCardEntryUpdated;
 
 	/**
 	 * Bonus card customer id
@@ -213,8 +220,6 @@ public class RoyalityCard implements BonusCard {
 			return false;
 		} else if (!Objects.equals(this.getBonusCardCustomer(), other.getBonusCardCustomer())) {
 			return false;
-		} else if (!Objects.equals(this.getBonusCardId(), other.getBonusCardId())) {
-			return false;
 		} else if (!Objects.equals(this.getBonusCardIssuer(), other.getBonusCardIssuer())) {
 			return false;
 		} else if (!Objects.equals(this.getBonusCardNumber(), other.getBonusCardNumber())) {
@@ -248,14 +253,14 @@ public class RoyalityCard implements BonusCard {
 
 	@Override
 	@SuppressWarnings ("ReturnOfDateField")
-	public Date getBonusCardCreated () {
-		return this.bonusCardCreated;
+	public Date getBonusCardEntryCreated () {
+		return this.bonusCardEntryCreated;
 	}
 
 	@Override
 	@SuppressWarnings ("AssignmentToDateFieldFromParameter")
-	public void setBonusCardCreated (final Date bonusCardCreated) {
-		this.bonusCardCreated = bonusCardCreated;
+	public void setBonusCardEntryCreated (final Date bonusCardEntryCreated) {
+		this.bonusCardEntryCreated = bonusCardEntryCreated;
 	}
 
 	@Override
@@ -268,6 +273,18 @@ public class RoyalityCard implements BonusCard {
 		this.bonusCardCustomer = bonusCardCustomer;
 	}
 
+	@Override
+	@SuppressWarnings ("ReturnOfDateField")
+	public Date getBonusCardEntryUpdated () {
+		return this.bonusCardEntryUpdated;
+	}
+
+	@Override
+	@SuppressWarnings ("AssignmentToDateFieldFromParameter")
+	public void setBonusCardEntryUpdated (final Date bonusCardEntryUpdated) {
+		this.bonusCardEntryUpdated = bonusCardEntryUpdated;
+	}
+
 	@Override
 	public Long getBonusCardId () {
 		return this.bonusCardId;
@@ -315,7 +332,6 @@ public class RoyalityCard implements BonusCard {
 		hash = 13 * hash + Objects.hashCode(this.getBonusCardBarCode());
 		hash = 13 * hash + Objects.hashCode(this.getBonusCardContact());
 		hash = 13 * hash + Objects.hashCode(this.getBonusCardCustomer());
-		hash = 13 * hash + Objects.hashCode(this.getBonusCardId());
 		hash = 13 * hash + Objects.hashCode(this.getBonusCardIssuer());
 		hash = 13 * hash + Objects.hashCode(this.getBonusCardNumber());
 		hash = 13 * hash + Objects.hashCode(this.getBonusCardPartner());