From: Roland Häder Date: Tue, 20 Mar 2018 23:34:47 +0000 (+0100) Subject: Only product: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8cc287b5149fb56e0747c7992dd0758e01a30b32;p=jfinancials-war.git Only product: - web controller expanded with age group ("new" enumeration), product size and number - also changed Float to BigDecimal for precision reasons - always filter/sort agains entity, not an entity's property - used more MessageFormat.format() - added converter for agegroup enumeration - changed/updated copyright year to Freesoftware Foundation Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestBean.java index 6082653e..47eb6591 100644 --- a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -16,6 +16,7 @@ */ package org.mxchange.jfinancials.beans.generic_product; +import java.math.BigDecimal; import javax.ejb.EJB; import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; @@ -32,6 +33,7 @@ import org.mxchange.jproduct.model.category.Category; import org.mxchange.jproduct.model.product.AdminProductSessionBeanRemote; import org.mxchange.jproduct.model.product.GenericProduct; import org.mxchange.jproduct.model.product.Product; +import org.mxchange.jproduct.model.product.agegroup.AgeGroup; /** * Main application class @@ -54,6 +56,17 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl @Any private Event addedProductEvent; + /** + * Remote bean for products + */ + @EJB (lookup = "java:global/jfinancials-ejb/adminProduct!org.mxchange.jproduct.model.product.AdminProductSessionBeanRemote") + private AdminProductSessionBeanRemote adminProductBean; + + /** + * Product's age group + */ + private AgeGroup productAgeGroup; + /** * Available */ @@ -64,6 +77,12 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl */ private Category productCategory; + /** + * General product controller + */ + @Inject + private FinancialProductWebRequestController productController; + /** * Product's price currency code like EUR or USD */ @@ -72,7 +91,12 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl /** * Product's gross price */ - private Float productGrossPrice; + private BigDecimal productGrossPrice; + + /** + * I18n key of product + */ + private String productI18nKey; /** * Product's manufacturing/producing company @@ -82,34 +106,27 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl /** * Product's net price */ - private Float productNetPrice; + private BigDecimal productNetPrice; /** - * Remote bean for products + * Product number */ - @EJB (lookup = "java:global/jfinancials-ejb/adminProduct!org.mxchange.jproduct.model.product.AdminProductSessionBeanRemote") - private AdminProductSessionBeanRemote adminProductBean; + private Long productNumber; /** - * General product controller + * Product size (for shoes, clothings) */ - @Inject - private FinancialProductWebRequestController productController; + private String productSize; /** * Product's tax rate */ - private Float productTaxRate; - - /** - * I18n key of product - */ - private String productI18nKey; + private BigDecimal productTaxRate; /** * Product's unit amount */ - private Float productUnitAmount; + private BigDecimal productUnitAmount; /** * Product's i18n key @@ -157,6 +174,24 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl this.clear(); } + /** + * Getter for product's age group + *

+ * @return Product's age group + */ + public AgeGroup getProductAgeGroup () { + return this.productAgeGroup; + } + + /** + * Setter for product's age group + *

+ * @param productAgeGroup Product's age group + */ + public void setProductAgeGroup (final AgeGroup productAgeGroup) { + this.productAgeGroup = productAgeGroup; + } + /** * Getter for product's available *

@@ -216,7 +251,7 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl *

* @return Product's gross price */ - public Float getProductGrossPrice () { + public BigDecimal getProductGrossPrice () { return this.productGrossPrice; } @@ -225,10 +260,28 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl *

* @param productGrossPrice Product's gross price */ - public void setProductGrossPrice (final Float productGrossPrice) { + public void setProductGrossPrice (final BigDecimal productGrossPrice) { this.productGrossPrice = productGrossPrice; } + /** + * Getter for product unit's i18n key + *

+ * @return Product's i18n key + */ + public String getProductI18nKey () { + return this.productI18nKey; + } + + /** + * Setter for product unit's i18n key + *

+ * @param productI18nKey Product's i18n key + */ + public void setProductI18nKey (final String productI18nKey) { + this.productI18nKey = productI18nKey; + } + /** * Getter for product's manufacturing/producing company *

@@ -252,7 +305,7 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl *

* @return Product's net price */ - public Float getProductNetPrice () { + public BigDecimal getProductNetPrice () { return this.productNetPrice; } @@ -261,44 +314,62 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl *

* @param productNetPrice Product's net price */ - public void setProductNetPrice (final Float productNetPrice) { + public void setProductNetPrice (final BigDecimal productNetPrice) { this.productNetPrice = productNetPrice; } /** - * Getter for product's tax rate + * Getter for product's number *

- * @return Product's tax rate + * @return Product's number */ - public Float getProductTaxRate () { - return this.productTaxRate; + public Long getProductNumber () { + return this.productNumber; } /** - * Setter for product's tax rate + * Setter for product's number *

- * @param productTaxRate Product's tax rate + * @param productNumber Product's number */ - public void setProductTaxRate (final Float productTaxRate) { - this.productTaxRate = productTaxRate; + public void setProductNumber (final Long productNumber) { + this.productNumber = productNumber; } /** - * Getter for product unit's i18n key + * Getter for product's size *

- * @return Product's i18n key + * @return Product's size */ - public String getProductI18nKey () { - return this.productI18nKey; + public String getProductSize () { + return this.productSize; } /** - * Setter for product unit's i18n key + * Setter for product's size *

- * @param productI18nKey Product's i18n key + * @param productSize Product's size */ - public void setProductI18nKey (final String productI18nKey) { - this.productI18nKey = productI18nKey; + public void setProductSize (final String productSize) { + this.productSize = productSize; + } + + /** + * Getter for product's tax rate + *

+ * @return Product's tax rate + */ + public BigDecimal getProductTaxRate () { + return this.productTaxRate; + } + + /** + * Setter for product's tax rate + *

+ * @param productTaxRate Product's tax rate + */ + public void setProductTaxRate (final BigDecimal productTaxRate) { + this.productTaxRate = productTaxRate; } /** @@ -306,7 +377,7 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl *

* @return Product's unit amount */ - public Float getProductUnitAmount () { + public BigDecimal getProductUnitAmount () { return this.productUnitAmount; } @@ -315,7 +386,7 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl *

* @param productUnitAmount Product's unit amount */ - public void setProductUnitAmount (final Float productUnitAmount) { + public void setProductUnitAmount (final BigDecimal productUnitAmount) { this.productUnitAmount = productUnitAmount; } @@ -331,7 +402,7 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl /** * Setter for product unit's i18n key *

- * @param productI18nKey Product's i18n key + * @param productUnitI18nKey Product unit's i18n key */ public void setProductUnitI18nKey (final String productUnitI18nKey) { this.productUnitI18nKey = productUnitI18nKey; @@ -341,12 +412,15 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl * Clears this bean (example: product has been added) */ private void clear () { + this.setProductAgeGroup(null); this.setProductAvailability(Boolean.FALSE); this.setProductCategory(null); this.setProductGrossPrice(null); this.setProductI18nKey(null); - this.setProductNetPrice(null); this.setProductManufacturer(null); + this.setProductNetPrice(null); + this.setProductNumber(null); + this.setProductSize(null); this.setProductTaxRate(null); this.setProductUnitAmount(null); this.setProductUnitI18nKey(null); @@ -362,8 +436,11 @@ public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean impl final Product product = new GenericProduct(this.getProductI18nKey(), this.getProductGrossPrice(), this.getProductCurrencyCode(), this.getProductCategory(), this.getProductAvailability(), this.getProductUnitAmount(), this.getProductUnitI18nKey()); // Set all optional fields - product.setProductNetPrice(this.getProductNetPrice()); + product.setProductAgeGroup(this.getProductAgeGroup()); product.setProductManufacturer(this.getProductManufacturer()); + product.setProductNumber(this.getProductNumber()); + product.setProductNetPrice(this.getProductNetPrice()); + product.setProductSize(this.getProductSize()); product.setProductTaxRate(this.getProductTaxRate()); // Return it diff --git a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestController.java index c419bae0..2a9006c9 100644 --- a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialAdminProductWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestBean.java index ba765fdd..f4506088 100644 --- a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -128,7 +128,7 @@ public class FinancialProductWebRequestBean extends BaseFinancialsBean implement throw new NullPointerException("productId is null"); //NOI18N } else if (productId < 1) { // Throw IAE - throw new IllegalArgumentException("productId=" + productId + " is invalid"); //NOI18N //NOI18N + throw new IllegalArgumentException(MessageFormat.format("productId={0} is invalid", productId)); //NOI18N //NOI18N } else if (!this.productCache.containsKey(productId)) { // Not found throw new ProductNotFoundException(productId); diff --git a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestController.java index 52490c10..8ef9f6dd 100644 --- a/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/generic_product/FinancialProductWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestBean.java index 4c8a31ae..65f0940c 100644 --- a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestController.java index be189896..937629bd 100644 --- a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialAdminCategoryWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestBean.java index 6fec0526..20d51e3b 100644 --- a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestController.java index b2bfca38..780f02e6 100644 --- a/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/product_category/FinancialCategoryWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/converter/age_group/FinancialAgeGroupConverter.java b/src/java/org/mxchange/jfinancials/converter/age_group/FinancialAgeGroupConverter.java new file mode 100644 index 00000000..871848bd --- /dev/null +++ b/src/java/org/mxchange/jfinancials/converter/age_group/FinancialAgeGroupConverter.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2017, 2018 Free Software Foundation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.converter.age_group; + +import javax.faces.convert.EnumConverter; +import javax.faces.convert.FacesConverter; +import org.mxchange.jproduct.model.product.agegroup.AgeGroup; + +/** + * A converter for age groups + *

+ * @author Roland Häder + */ +@FacesConverter ("AgeGroupConverter") +public class FinancialAgeGroupConverter extends EnumConverter { + + /** + * Default constructor which calls the super constructor with the proper + * enumeration as class type. + */ + public FinancialAgeGroupConverter () { + // Call other constructor with class type + super(AgeGroup.class); + } + +} diff --git a/src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java b/src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java index 68452ea8..ee8024f6 100644 --- a/src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java b/src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java index 025ec3a1..bf167ab7 100644 --- a/src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/validator/generic_product/FinancialsGenericProductValidator.java b/src/java/org/mxchange/jfinancials/validator/generic_product/FinancialsGenericProductValidator.java index dd633d76..8d30c5ed 100644 --- a/src/java/org/mxchange/jfinancials/validator/generic_product/FinancialsGenericProductValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/generic_product/FinancialsGenericProductValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/validator/product_category/FinancialsProductCategoryValidator.java b/src/java/org/mxchange/jfinancials/validator/product_category/FinancialsProductCategoryValidator.java index 4da80994..79477eca 100644 --- a/src/java/org/mxchange/jfinancials/validator/product_category/FinancialsProductCategoryValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/product_category/FinancialsProductCategoryValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/web/WEB-INF/product-links.jsf.taglib.xml b/web/WEB-INF/product-links.jsf.taglib.xml index e7a9fc1c..151b235b 100644 --- a/web/WEB-INF/product-links.jsf.taglib.xml +++ b/web/WEB-INF/product-links.jsf.taglib.xml @@ -1,6 +1,6 @@ - + - + - +