From: Roland Häder Date: Tue, 26 Jun 2018 19:30:22 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c01fd789ea59e8021d4e3c908917a6618406dc98;p=jproduct-core.git Continued: - added bar-code number property Signed-off-by: Roland Häder --- diff --git a/src/org/mxchange/jproduct/model/product/GenericProduct.java b/src/org/mxchange/jproduct/model/product/GenericProduct.java index 1c04f3b..6adba80 100644 --- a/src/org/mxchange/jproduct/model/product/GenericProduct.java +++ b/src/org/mxchange/jproduct/model/product/GenericProduct.java @@ -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; } diff --git a/src/org/mxchange/jproduct/model/product/Product.java b/src/org/mxchange/jproduct/model/product/Product.java index ed65cd9..2a2508d 100644 --- a/src/org/mxchange/jproduct/model/product/Product.java +++ b/src/org/mxchange/jproduct/model/product/Product.java @@ -30,6 +30,20 @@ import org.mxchange.jproduct.model.product.agegroup.AgeGroup; */ public interface Product extends Comparable, Serializable { + /** + * Getter for bar-code number + *

+ * @return Bar-code number + */ + String getProductBarCodeNumber (); + + /** + * Setter for bar-code number + *

+ * @param productBarCodeNumber Bar-code number + */ + void setProductBarCodeNumber (final String productBarCodeNumber); + /** * Getter for created timestamp *

diff --git a/src/org/mxchange/jproduct/model/product/Products.java b/src/org/mxchange/jproduct/model/product/Products.java index 92b3702..7fed204 100644 --- a/src/org/mxchange/jproduct/model/product/Products.java +++ b/src/org/mxchange/jproduct/model/product/Products.java @@ -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());