From: Roland Häder Date: Wed, 7 Jun 2017 22:13:30 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=28e0ed336b353fceab0613d3e097c30a4ca279a6;p=jbonuscard-core.git Continued a bit: - added issue timestamp (Calendar) which is different to creation timestamp - created is when the entry has been created in database - issued is the written date on the receipt Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java index a7b49c4..6bb4429 100644 --- a/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java @@ -43,6 +43,20 @@ public interface BillableReceipt extends Serializable { */ void setReceiptCreated (final Calendar receiptCreated); + /** + * Getter for when this receipt has been issued (as written on it) + *

+ * @return Receipt issue timestamp + */ + Calendar getReceiptIssued (); + + /** + * Setter for when this receipt has been issued (as written on it) + *

+ * @param receiptIssued Receipt issue timestamp + */ + void setReceiptIssued (final Calendar receiptIssued); + /** * Getter for primary key *

diff --git a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java index 6d58ffa..320eb3f 100644 --- a/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java +++ b/src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java @@ -57,7 +57,7 @@ public class FinancialReceipt implements BillableReceipt { private static final long serialVersionUID = 185_867_217_461L; /** - * When this receipt has been created + * When this receipt entry has been created */ @Basic (optional = false) @Temporal (TemporalType.TIMESTAMP) @@ -72,6 +72,14 @@ public class FinancialReceipt implements BillableReceipt { @Column (name = "receipt_id", nullable = false, updatable = false) private Long receiptId; + /** + * When this receipt has been issued + */ + @Basic (optional = false) + @Temporal (TemporalType.DATE) + @Column (name = "receipt_issued", nullable = false) + private Calendar receiptIssued; + /** * Payment type (cash, credit card, EC card ...) */ @@ -106,8 +114,9 @@ public class FinancialReceipt implements BillableReceipt { * @param receiptPaymentType Payment type * @param receiptSeller Seller instance * @param receiptUser User instance + * @param receiptIssued When this receipt has been issued */ - public FinancialReceipt (final PaymentType receiptPaymentType, final BusinessContact receiptSeller, final User receiptUser) { + public FinancialReceipt (final PaymentType receiptPaymentType, final BusinessContact receiptSeller, final User receiptUser, final Calendar receiptIssued) { // Call other constructor first this(); @@ -115,6 +124,7 @@ public class FinancialReceipt implements BillableReceipt { this.receiptPaymentType = receiptPaymentType; this.receiptSeller = receiptSeller; this.receiptUser = receiptUser; + this.receiptIssued = receiptIssued; } @Override @@ -138,6 +148,8 @@ public class FinancialReceipt implements BillableReceipt { return false; } else if (!Objects.equals(this.getReceiptUser(), receipt.getReceiptUser())) { return false; + } else if (!Objects.equals(this.getReceiptIssued(), receipt.getReceiptIssued())) { + return false; } return true; @@ -165,6 +177,18 @@ public class FinancialReceipt implements BillableReceipt { this.receiptId = receiptId; } + @Override + @SuppressWarnings ("ReturnOfDateField") + public Calendar getReceiptIssued () { + return this.receiptIssued; + } + + @Override + @SuppressWarnings ("AssignmentToDateFieldFromParameter") + public void setReceiptIssued (final Calendar receiptIssued) { + this.receiptIssued = receiptIssued; + } + @Override public PaymentType getReceiptPaymentType () { return this.receiptPaymentType;