]> git.mxchange.org Git - jfinancials-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Thu, 2 Nov 2017 21:13:26 +0000 (22:13 +0100)
committerRoland Häder <roland@mxchange.org>
Sat, 4 Nov 2017 16:40:30 +0000 (17:40 +0100)
- items may have own manufacturer, mostly then the product itself is an abstract
  product and does not have a direct manufacturer. Example: Milk can be made by
  many producers ("manufacturer", I known it isn't the same but here
  productProducer sounds a bit strange ...)
- bar code numbers might be very long, resulting an overflow of Long (!), so
  let's take String for now
- brand name of products happens very often in for example supermarkets
- manufacturer is now optional

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
src/org/mxchange/jfinancials/model/receipt_item/BillableReceiptItem.java
src/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItem.java

index af12bc3445ec2a8fd9fd7871815cf015de0a807e..a1eb9455610c636afafd02f7f0a992e33b915f08 100644 (file)
@@ -35,14 +35,14 @@ public interface BillableReceipt extends Serializable {
         * <p>
         * @return Receipt bar-code number
         */
-       Long getReceiptBarCodeNumber ();
+       String getReceiptBarCodeNumber ();
 
        /**
         * Setter for receipt bar-code number
         * <p>
         * @param receiptBarCodeNumber Receipt bar-code number
         */
-       void setReceiptBarCodeNumber (final Long receiptBarCodeNumber);
+       void setReceiptBarCodeNumber (final String receiptBarCodeNumber);
 
        /**
         * Getter for when this receipt has been created in database
index 56dd98e879e104df878215410907f6534c66f18a..2ab24960412574615d3ee71a2da09e8ae2a8fac0 100644 (file)
@@ -71,7 +71,7 @@ public class FinancialReceipt implements BillableReceipt {
         * Receipt bar-code number
         */
        @Column (name = "receipt_barcode_number")
-       private Long receiptBarCodeNumber;
+       private String receiptBarCodeNumber;
 
        /**
         * Seller instance
@@ -251,12 +251,12 @@ public class FinancialReceipt implements BillableReceipt {
        }
 
        @Override
-       public Long getReceiptBarCodeNumber () {
+       public String getReceiptBarCodeNumber () {
                return this.receiptBarCodeNumber;
        }
 
        @Override
-       public void setReceiptBarCodeNumber (final Long receiptBarCodeNumber) {
+       public void setReceiptBarCodeNumber (final String receiptBarCodeNumber) {
                this.receiptBarCodeNumber = receiptBarCodeNumber;
        }
 
index b6dc9c25084fa97978e77eec5550f59844b0bdc5..c2dc8bdda0a15150ef1e5f9d40eb35feb8520f3d 100644 (file)
@@ -18,6 +18,7 @@ package org.mxchange.jfinancials.model.receipt_item;
 
 import java.io.Serializable;
 import java.util.Date;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jfinancials.model.receipt.BillableReceipt;
 import org.mxchange.jproduct.model.category.Category;
 import org.mxchange.jproduct.model.product.Product;
@@ -183,6 +184,34 @@ public interface BillableReceiptItem extends Serializable {
         */
        void setItemGrossPrice (final Float itemGrossPrice);
 
+       /**
+        * Getter for manufacturer/producer of this item
+        * <p>
+        * @return Manufacturer/producer of this item
+        */
+       BasicData getItemManufacturer ();
+
+       /**
+        * Setter for manufacturer/producer of this item
+        * <p>
+        * @param itemManufacturer Manufacturer/producer of this item
+        */
+       void setItemManufacturer (final BasicData itemManufacturer);
+
+       /**
+        * Getter for item brand name
+        * <p>
+        * @return Item brand name
+        */
+       String getItemBrandName ();
+
+       /**
+        * Setter for item brand name
+        * <p>
+        * @param itemBrandName Item brand name
+        */
+       void setItemBrandName (final String itemBrandName);
+
        @Override
        boolean equals (final Object object);
 
index 596c9a0cd2f676a35013247139a2c4313f4c6f4e..bc695ed144e74f4d744d787a9e6ee9ec79ed14d9 100644 (file)
@@ -34,6 +34,8 @@ import javax.persistence.Table;
 import javax.persistence.Temporal;
 import javax.persistence.TemporalType;
 import javax.persistence.Transient;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jfinancials.model.receipt.BillableReceipt;
 import org.mxchange.jfinancials.model.receipt.FinancialReceipt;
 import org.mxchange.jproduct.model.category.Category;
@@ -69,6 +71,12 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        @Transient
        private static final long serialVersionUID = 126_498_698_378_571L;
 
+       /**
+        * Item branding
+        */
+       @Column(name = "item_brand_name")
+       private String itemBrandName;
+
        /**
         * Category being assigned to item's product
         */
@@ -110,6 +118,13 @@ public class FinancialReceiptItem implements BillableReceiptItem {
        @Column (name = "item_id", nullable = false, updatable = false)
        private Long itemId;
 
+       /**
+        * Manufacturer/producer of this item
+        */
+       @JoinColumn (name = "item_manufacturer_id", referencedColumnName = "company_data_id")
+       @OneToOne (targetEntity = BusinessBasicData.class, cascade = CascadeType.REFRESH)
+       private BasicData itemManufacturer;
+
        /**
         * Net price of item
         */
@@ -192,6 +207,16 @@ public class FinancialReceiptItem implements BillableReceiptItem {
                return true;
        }
 
+       @Override
+       public String getItemBrandName () {
+               return this.itemBrandName;
+       }
+
+       @Override
+       public void setItemBrandName (final String itemBrandName) {
+               this.itemBrandName = itemBrandName;
+       }
+
        @Override
        public Category getItemCategory () {
                return this.itemCategory;
@@ -254,6 +279,16 @@ public class FinancialReceiptItem implements BillableReceiptItem {
                this.itemId = itemId;
        }
 
+       @Override
+       public BasicData getItemManufacturer () {
+               return this.itemManufacturer;
+       }
+
+       @Override
+       public void setItemManufacturer (final BasicData itemManufacturer) {
+               this.itemManufacturer = itemManufacturer;
+       }
+
        @Override
        public Float getItemNetPrice () {
                return this.itemNetPrice;