]> git.mxchange.org Git - jproduct-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Tue, 26 Jun 2018 19:30:22 +0000 (21:30 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 26 Jun 2018 19:32:39 +0000 (21:32 +0200)
- added bar-code number property

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jproduct/model/product/GenericProduct.java
src/org/mxchange/jproduct/model/product/Product.java
src/org/mxchange/jproduct/model/product/Products.java

index 1c04f3b20a5a17956016e673d48742fe1bf14774..6adba800f95cae0dc65028694b2ca271460399e4 100644 (file)
@@ -94,6 +94,12 @@ public class GenericProduct implements Product {
        @Column (name = "product_availability", nullable = false)
        private Boolean productAvailability;
 
+       /**
+        * Bar-code number
+        */
+       @Column (name = "product_barcode_number")
+       private String productBarCodeNumber;
+
        /**
         * Product productCategory
         */
@@ -278,6 +284,8 @@ public class GenericProduct implements Product {
                final int comparators[] = {
                        // First check product number
                        SafeNumberUtils.compare(this.getProductNumber(), product.getProductNumber()),
+                       // ... bar-code number
+                       StringUtils.compare(this.getProductBarCodeNumber(), product.getProductBarCodeNumber()),
                        // ... size
                        StringUtils.compare(this.getProductSize(), product.getProductSize()),
                        // ... then i18n key
@@ -327,6 +335,8 @@ public class GenericProduct implements Product {
                        return false;
                } else if (!Objects.equals(this.getProductSize(), product.getProductSize())) {
                        return false;
+               } else if (!Objects.equals(this.getProductBarCodeNumber(), product.getProductBarCodeNumber())) {
+                       return false;
                }
 
                return true;
@@ -352,6 +362,16 @@ public class GenericProduct implements Product {
                this.productAvailability = productAvailability;
        }
 
+       @Override
+       public String getProductBarCodeNumber () {
+               return this.productBarCodeNumber;
+       }
+
+       @Override
+       public void setProductBarCodeNumber (final String productBarCodeNumber) {
+               this.productBarCodeNumber = productBarCodeNumber;
+       }
+
        @Override
        public Category getProductCategory () {
                return this.productCategory;
@@ -493,6 +513,7 @@ public class GenericProduct implements Product {
                hash = 23 * hash + Objects.hashCode(this.getProductI18nKey());
                hash = 23 * hash + Objects.hashCode(this.getProductAgeGroup());
                hash = 23 * hash + Objects.hashCode(this.getProductSize());
+               hash = 23 * hash + Objects.hashCode(this.getProductBarCodeNumber());
 
                return hash;
        }
index ed65cd9c069f7d87ef2498ac65408c6fe377251d..2a2508dbe4cf876377b9c61ecdb456efae5705e6 100644 (file)
@@ -30,6 +30,20 @@ import org.mxchange.jproduct.model.product.agegroup.AgeGroup;
  */
 public interface Product extends Comparable<Product>, Serializable {
 
+       /**
+        * Getter for bar-code number
+        * <p>
+        * @return Bar-code number
+        */
+       String getProductBarCodeNumber ();
+
+       /**
+        * Setter for bar-code number
+        * <p>
+        * @param productBarCodeNumber Bar-code number
+        */
+       void setProductBarCodeNumber (final String productBarCodeNumber);
+
        /**
         * Getter for created timestamp
         * <p>
index 92b370285d5745814089f5cad7d01585e4fc6fea..7fed20403ce377ceceb8c6d014b0eef2b3b68c3d 100644 (file)
@@ -78,6 +78,7 @@ public class Products implements Serializable {
                // Copy all:
                targetProduct.setProductAgeGroup(sourceProduct.getProductAgeGroup());
                targetProduct.setProductAvailability(sourceProduct.getProductAvailability());
+               targetProduct.setProductBarCodeNumber(sourceProduct.getProductBarCodeNumber());
                targetProduct.setProductCategory(sourceProduct.getProductCategory());
                targetProduct.setProductCurrencyCode(sourceProduct.getProductCurrencyCode());
                targetProduct.setProductGrossPrice(sourceProduct.getProductGrossPrice());