From ec6971a448eb608957596618e7861d9df8b76e04 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 27 Oct 2017 23:05:00 +0200 Subject: [PATCH] Continued: - added entity property for currency code like EUR or USD which is suitable for java.util.Currency - that instance then may be stored anywhere where it is needed to be customized like in JSF - also entities like "branch_office" and "headquarters" may store the same value as they are maybe country-dependent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../model/product/GenericProduct.java | 19 ++++++++++++++++++- .../jproduct/model/product/Product.java | 14 ++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/org/mxchange/jproduct/model/product/GenericProduct.java b/src/org/mxchange/jproduct/model/product/GenericProduct.java index e9829b9..bac7e4c 100644 --- a/src/org/mxchange/jproduct/model/product/GenericProduct.java +++ b/src/org/mxchange/jproduct/model/product/GenericProduct.java @@ -115,6 +115,11 @@ public class GenericProduct implements Product { @Column (name = "product_title", length = 100, nullable = false, unique = true) private String productTitle; + /** + * Currency code for both prices + */ + private String productCurrencyCode; + /** * Default constructor */ @@ -126,13 +131,15 @@ public class GenericProduct implements Product { *

* @param productTitle Name of product * @param productGrossPrice Product's gross price + * @param productCurrencyCode code for both prices * @param productCategory Category instance * @param productAvailability Availability (selectable by customer) */ - public GenericProduct (final String productTitle, final Float productGrossPrice, final Category productCategory, final Boolean productAvailability) { + public GenericProduct (final String productTitle, final Float productGrossPrice, final String productCurrencyCode, final Category productCategory, final Boolean productAvailability) { // Set all here this.productTitle = productTitle; this.productGrossPrice = productGrossPrice; + this.productCurrencyCode = productCurrencyCode; this.productCategory = productCategory; this.productAvailability = productAvailability; } @@ -190,6 +197,16 @@ public class GenericProduct implements Product { this.productCreated = productCreated; } + @Override + public String getProductCurrencyCode () { + return this.productCurrencyCode; + } + + @Override + public void setProductCurrencyCode (final String productCurrencyCode) { + this.productCurrencyCode = productCurrencyCode; + } + @Override public Float getProductGrossPrice () { return this.productGrossPrice; diff --git a/src/org/mxchange/jproduct/model/product/Product.java b/src/org/mxchange/jproduct/model/product/Product.java index 50b9443..083cb6a 100644 --- a/src/org/mxchange/jproduct/model/product/Product.java +++ b/src/org/mxchange/jproduct/model/product/Product.java @@ -125,6 +125,20 @@ public interface Product extends Serializable { */ void setProductGrossPrice (final Float productGrossPrice); + /** + * Getter for currency code like EUR or USD + *

+ * @return Currency code like EUR or USD + */ + String getProductCurrencyCode (); + + /** + * Setter for currency code like EUR or USD + *

+ * @param productCurrencyCode Currency code like EUR or USD + */ + void setProductCurrencyCode (final String productCurrencyCode); + /** * Getter for title. *

-- 2.39.5