/*
- * 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
*/
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;
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
@Any
private Event<AddedProductEvent> 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
*/
*/
private Category productCategory;
+ /**
+ * General product controller
+ */
+ @Inject
+ private FinancialProductWebRequestController productController;
+
/**
* Product's price currency code like EUR or USD
*/
/**
* Product's gross price
*/
- private Float productGrossPrice;
+ private BigDecimal productGrossPrice;
+
+ /**
+ * I18n key of product
+ */
+ private String productI18nKey;
/**
* Product's manufacturing/producing company
/**
* 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
this.clear();
}
+ /**
+ * Getter for product's age group
+ * <p>
+ * @return Product's age group
+ */
+ public AgeGroup getProductAgeGroup () {
+ return this.productAgeGroup;
+ }
+
+ /**
+ * Setter for product's age group
+ * <p>
+ * @param productAgeGroup Product's age group
+ */
+ public void setProductAgeGroup (final AgeGroup productAgeGroup) {
+ this.productAgeGroup = productAgeGroup;
+ }
+
/**
* Getter for product's available
* <p>
* <p>
* @return Product's gross price
*/
- public Float getProductGrossPrice () {
+ public BigDecimal getProductGrossPrice () {
return this.productGrossPrice;
}
* <p>
* @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
+ * <p>
+ * @return Product's i18n key
+ */
+ public String getProductI18nKey () {
+ return this.productI18nKey;
+ }
+
+ /**
+ * Setter for product unit's i18n key
+ * <p>
+ * @param productI18nKey Product's i18n key
+ */
+ public void setProductI18nKey (final String productI18nKey) {
+ this.productI18nKey = productI18nKey;
+ }
+
/**
* Getter for product's manufacturing/producing company
* <p>
* <p>
* @return Product's net price
*/
- public Float getProductNetPrice () {
+ public BigDecimal getProductNetPrice () {
return this.productNetPrice;
}
* <p>
* @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
* <p>
- * @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
* <p>
- * @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
* <p>
- * @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
* <p>
- * @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
+ * <p>
+ * @return Product's tax rate
+ */
+ public BigDecimal getProductTaxRate () {
+ return this.productTaxRate;
+ }
+
+ /**
+ * Setter for product's tax rate
+ * <p>
+ * @param productTaxRate Product's tax rate
+ */
+ public void setProductTaxRate (final BigDecimal productTaxRate) {
+ this.productTaxRate = productTaxRate;
}
/**
* <p>
* @return Product's unit amount
*/
- public Float getProductUnitAmount () {
+ public BigDecimal getProductUnitAmount () {
return this.productUnitAmount;
}
* <p>
* @param productUnitAmount Product's unit amount
*/
- public void setProductUnitAmount (final Float productUnitAmount) {
+ public void setProductUnitAmount (final BigDecimal productUnitAmount) {
this.productUnitAmount = productUnitAmount;
}
/**
* Setter for product unit's i18n key
* <p>
- * @param productI18nKey Product's i18n key
+ * @param productUnitI18nKey Product unit's i18n key
*/
public void setProductUnitI18nKey (final String productUnitI18nKey) {
this.productUnitI18nKey = productUnitI18nKey;
* 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);
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
<f:selectItems value="#{categoryController.allCategories()}" var="category" itemValue="#{category}" itemLabel="#{beanHelper.renderProductCategory(category)}" />
</p:selectOneMenu>
- <p:outputLabel for="productI18nKey" value="#{project.ADMIN_ENTER_PRODUCT_I18N_KEY}" />
+ <p:outputLabel for="productI18nKey" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_I18N_KEY}" />
<p:inputText
id="productI18nKey"
value="#{adminProductController.productI18nKey}"
maxlength="255"
required="true"
requiredMessage="#{project.ADMIN_PRODUCT_I18N_KEY_REQUIRED}"
- title="#{project.ADMIN_ENTER_PRODUCT_I18N_KEY_TITLE}"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_I18N_KEY_TITLE}"
validatorMessage="#{project.ADMIN_ENTERED_PRODUCT_I18N_KEY_ALREADY_ADDED}"
>
<f:validator validatorId="GenericProductValidator" />
</p:inputText>
+ <p:outputLabel for="productNumber" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_NUMBER}" />
+ <p:inputText
+ id="productNumber"
+ value="#{adminProductController.productNumber}"
+ size="10"
+ maxlength="20"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_NUMBER_TITLE}"
+ />
+
+ <p:outputLabel for="productAgeGroup" value="#{project.ADMIN_SELECT_PRODUCT_AGE_GROUP}" />
+ <p:selectOneMenu
+ id="productAgeGroup"
+ value="#{adminProductController.productAgeGroup}"
+ filter="true"
+ filterMatchMode="contains"
+ title="#{project.ADMIN_SELECT_PRODUCT_AGE_GROUP_TITLE}"
+ >
+ <f:converter converterId="AgeGroupConverter" />
+ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
+ <f:selectItems value="#{dataController.ageGroups}" var="ageGroup" itemValue="#{ageGroup}" itemLabel="#{project[ageGroup.i18nKey]}" />
+ </p:selectOneMenu>
+
+ <p:outputLabel for="productSize" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_SIZE}" />
+ <p:inputText
+ id="productSize"
+ value="#{adminProductController.productSize}"
+ size="5"
+ maxlength="10"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_SIZE_TITLE}"
+ />
+
<p:outputLabel for="productManufacturer" value="#{project.ADMIN_ASSIGN_PRODUCT_MANUFACTURER}" />
<p:selectOneMenu
id="productManufacturer"
title="#{project.ADMIN_ENABLE_PRODUCT_AVAILABILITY_TITLE}"
/>
- <p:outputLabel value="#{project.ADMIN_ENTER_PRODUCT_PRICE}" />
+ <p:outputLabel value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_PRICE}" />
<product:inputProductPricePanelGrid targetController="#{adminProductController}" />
- <p:outputLabel for="productCurrencyCode" value="#{project.ADMIN_ENTER_PRODUCT_CURRENCY_CODE}" />
+ <p:outputLabel for="productCurrencyCode" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_CURRENCY_CODE}" />
<p:inputText
id="productCurrencyCode"
value="#{adminProductController.productCurrencyCode}"
size="3"
maxlength="3"
- title="#{project.ADMIN_ENTER_PRODUCT_CURRENCY_CODE_TITLE}"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_CURRENCY_CODE_TITLE}"
required="true"
requiredMessage="#{project.ADMIN_PRODUCT_CURRENCY_CODE_REQUIRED}"
/>
- <p:outputLabel for="productUnitAmount" value="#{project.ADMIN_ENTER_PRODUCT_UNIT_AMOUNT}" />
+ <p:outputLabel for="productUnitAmount" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_AMOUNT}" />
<p:inputNumber
id="productUnitAmount"
value="#{adminProductController.productUnitAmount}"
decimalSeparator=","
thousandSeparator="."
- title="#{project.ADMIN_ENTER_PRODUCT_UNIT_AMOUNT_TITLE}"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_AMOUNT_TITLE}"
required="true"
requiredMessage="#{project.ADMIN_PRODUCT_UNIT_AMOUNT_REQUIRED}"
/>
- <p:outputLabel for="productUnitI18nKey" value="#{project.ADMIN_ENTER_PRODUCT_UNIT_I18N_KEY}" />
+ <p:outputLabel for="productUnitI18nKey" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_I18N_KEY}" />
<p:inputText
id="productUnitI18nKey"
value="#{adminProductController.productUnitI18nKey}"
size="10"
maxlength="255"
- title="#{project.ADMIN_ENTER_PRODUCT_UNIT_I18N_KEY_TITLE}"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_I18N_KEY_TITLE}"
required="true"
requiredMessage="#{project.ADMIN_PRODUCT_UNIT_I18N_KEY_REQUIRED}"
/>