]> git.mxchange.org Git - jbonuscard-core.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Wed, 7 Jun 2017 22:13:30 +0000 (00:13 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 7 Jun 2017 22:14:29 +0000 (00:14 +0200)
- 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 <roland@mxchange.org>
src/org/mxchange/jfinancials/model/receipt/BillableReceipt.java
src/org/mxchange/jfinancials/model/receipt/FinancialReceipt.java

index a7b49c45d367a27a1039071beb415fafc62e00ac..6bb4429b6be3b4e4fea786c533f6a5711b1bdc90 100644 (file)
@@ -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)
+        * <p>
+        * @return Receipt issue timestamp
+        */
+       Calendar getReceiptIssued ();
+
+       /**
+        * Setter for when this receipt has been issued (as written on it)
+        * <p>
+        * @param receiptIssued Receipt issue timestamp
+        */
+       void setReceiptIssued (final Calendar receiptIssued);
+
        /**
         * Getter for primary key
         * <p>
index 6d58ffa1aafe20e079b2221565e29b21408ac13a..320eb3f1d4be01cfb61df09a9e4c664cd8706627 100644 (file)
@@ -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;