package org.mxchange.jfinancials.beans.generic_product;
import java.math.BigDecimal;
-import java.text.MessageFormat;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
import javax.enterprise.inject.Any;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Inject;
import org.mxchange.jfinancials.beans.generic_product.list.FinancialsProductListWebViewController;
import org.mxchange.jproduct.events.product.added.AddedProductEvent;
import org.mxchange.jproduct.events.product.added.ProductAddedEvent;
-import org.mxchange.jproduct.events.product.created.ObservableCreatedProductEvent;
-import org.mxchange.jproduct.events.product.updated.ObservableProductUpdatedEvent;
-import org.mxchange.jproduct.events.product.updated.ProductUpdatedEvent;
import org.mxchange.jproduct.exceptions.product.ProductAlreadyAddedException;
-import org.mxchange.jproduct.exceptions.product.ProductNotFoundException;
import org.mxchange.jproduct.model.category.Category;
import org.mxchange.jproduct.model.product.AdminProductSessionBeanRemote;
import org.mxchange.jproduct.model.product.GenericProduct;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@Named ("adminProductController")
+@Named ("adminGenericProductController")
@RequestScoped
public class FinancialAdminProductWebRequestBean extends BaseFinancialsBean implements FinancialAdminProductWebRequestController {
*/
private String productUnitI18nKey;
- /**
- * Event for updated product
- */
- @Inject
- @Any
- private Event<ObservableProductUpdatedEvent> updatedProductEvent;
-
/**
* Default constructor
*/
// Fire event
this.addedProductEvent.fire(new ProductAddedEvent(updatedProduct));
-
- // Set all to null
- this.clear();
- }
-
- /**
- * Observer for events being fired when a bean helper has successfully
- * created a product instance.
- * <p>
- * @param event Event being fired
- */
- public void afterCreatedProductEvent (@Observes final ObservableCreatedProductEvent event) {
- // The event instance must be valid
- if (null == event) {
- // Throw NPE again
- throw new NullPointerException("event is null"); //NOI18N
- } else if (event.getCreatedProduct() == null) {
- // Throw NPE again
- throw new NullPointerException("event.createdProduct is null"); //NOI18N //NOI18N
- } else if (event.getCreatedProduct().getProductId() == null) {
- // Throw NPE again
- throw new NullPointerException("event.createdProduct.productId is null"); //NOI18N //NOI18N
- } else if (event.getCreatedProduct().getProductId() < 1) {
- // Not valid
- throw new IllegalStateException(MessageFormat.format("event.createdProduct.productId={0} is not valid.", event.getCreatedProduct().getProductId())); //NOI18N
- }
-
- // Get product instance from event
- final Product product = event.getCreatedProduct();
-
- // Set all fields
- this.setProductAgeGroup(product.getProductAgeGroup());
- this.setProductAvailability(product.getProductAvailability());
- this.setProductCategory(product.getProductCategory());
- this.setProductCurrencyCode(product.getProductCurrencyCode());
- this.setProductGrossPrice(product.getProductGrossPrice());
- this.setProductI18nKey(product.getProductI18nKey());
- this.setProductId(product.getProductId());
- this.setProductManufacturer(product.getProductManufacturer());
- this.setProductNetPrice(product.getProductNetPrice());
- this.setProductNumber(product.getProductNumber());
- this.setProductSize(product.getProductSize());
- this.setProductTaxRate(product.getProductTaxRate());
- this.setProductUnitAmount(product.getProductUnitAmount());
- this.setProductUnitI18nKey(product.getProductUnitI18nKey());
}
/**
this.productUnitI18nKey = productUnitI18nKey;
}
- /**
- * Updates given product data from request to database
- * <p>
- * @throws FaceletException If something unexpected happened
- */
- public void updateProduct () throws FaceletException {
- // Get product instance
- final Product product = this.createProductInstance();
- // Check if product instance is in helper and valid
-
- if (null == product) {
- // Throw NPE
- throw new NullPointerException("productBeanHelper.product is null"); //NOI18N
- } else if (product.getProductId() == null) {
- // Throw NPE again
- throw new NullPointerException("productBeanHelper.product.productId is null"); //NOI18N //NOI18N
- } else if (product.getProductId() < 1) {
- // Invalid id
- throw new IllegalStateException(MessageFormat.format("productBeanHelper.product.productId={0} is invalid", product.getProductId())); //NOI18N
- }
-
- // Init productr
- final Product updatedProduct;
-
- try {
- // Call EJB for updating product data
- updatedProduct = this.adminProductBean.updateProductData(product);
- } catch (final ProductNotFoundException ex) {
- // Throw again
- throw new FaceletException(ex);
- }
-
- // Fire event
- this.updatedProductEvent.fire(new ProductUpdatedEvent(updatedProduct));
-
- // Clear bean
- this.clear();
- }
-
- /**
- * Clears this bean (example: product has been added)
- */
- private void clear () {
- // Clear all data
- this.setProductAgeGroup(null);
- this.setProductAvailability(Boolean.FALSE);
- this.setProductBarCodeNumber(null);
- this.setProductCategory(null);
- this.setProductGrossPrice(null);
- this.setProductI18nKey(null);
- this.setProductId(null);
- this.setProductManufacturer(null);
- this.setProductNetPrice(null);
- this.setProductNumber(null);
- this.setProductSize(null);
- this.setProductTaxRate(null);
- this.setProductUnitAmount(null);
- this.setProductUnitI18nKey(null);
- }
-
/**
* Creates a product instance with all fields
* <p>
*/
private Product createProductInstance () {
// Create product instance
- final Product product = new GenericProduct(this.getProductI18nKey(), this.getProductGrossPrice(), this.getProductCurrencyCode(), this.getProductCategory(), this.getProductAvailability(), this.getProductUnitAmount(), this.getProductUnitI18nKey());
+ final Product product = new GenericProduct(
+ this.getProductI18nKey(),
+ this.getProductGrossPrice(),
+ this.getProductCurrencyCode(),
+ this.getProductCategory(),
+ this.getProductAvailability(),
+ this.getProductUnitAmount(),
+ this.getProductUnitI18nKey()
+ );
// Set all optional fields
product.setProductAgeGroup(this.getProductAgeGroup());
--- /dev/null
+/*
+ * 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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.generic_product.action;
+
+import java.math.BigDecimal;
+import java.text.MessageFormat;
+import javax.ejb.EJB;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.view.ViewScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.generic_product.list.FinancialsProductListWebViewController;
+import org.mxchange.jproduct.events.product.updated.ObservableProductUpdatedEvent;
+import org.mxchange.jproduct.events.product.updated.ProductUpdatedEvent;
+import org.mxchange.jproduct.exceptions.product.ProductNotFoundException;
+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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminGenericProductActionController")
+@ViewScoped
+public class FinancialAdminGenericProductActionWebViewBean extends BaseFinancialsBean implements FinancialAdminProductActionWebViewController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 5_819_375_183_472_872L;
+
+ /**
+ * Remote bean for products
+ */
+ @EJB (lookup = "java:global/jfinancials-ejb/adminProduct!org.mxchange.jproduct.model.product.AdminProductSessionBeanRemote")
+ private AdminProductSessionBeanRemote adminProductBean;
+
+ /**
+ * Product instance
+ */
+ private Product product;
+
+ /**
+ * Product's age group
+ */
+ private AgeGroup productAgeGroup;
+
+ /**
+ * Availability
+ */
+ private Boolean productAvailability;
+
+ /**
+ * Barcode number
+ */
+ private String productBarCodeNumber;
+
+ /**
+ * Category instance
+ */
+ private Category productCategory;
+
+ /**
+ * Product's price currency code like EUR or USD
+ */
+ private String productCurrencyCode;
+
+ /**
+ * Product's gross price
+ */
+ private BigDecimal productGrossPrice;
+
+ /**
+ * I18n key of product
+ */
+ private String productI18nKey;
+
+ /**
+ * Product id
+ */
+ private Long productId;
+
+ /**
+ * Product list controller
+ */
+ @Inject
+ private FinancialsProductListWebViewController productListController;
+
+ /**
+ * Product's manufacturing/producing company
+ */
+ private BasicData productManufacturer;
+
+ /**
+ * Product's net price
+ */
+ private BigDecimal productNetPrice;
+
+ /**
+ * Product number
+ */
+ private Long productNumber;
+
+ /**
+ * Product size (for shoes, clothings)
+ */
+ private String productSize;
+
+ /**
+ * Product's tax rate
+ */
+ private BigDecimal productTaxRate;
+
+ /**
+ * Product's unit amount
+ */
+ private BigDecimal productUnitAmount;
+
+ /**
+ * Product's i18n key
+ */
+ private String productUnitI18nKey;
+
+ /**
+ * Event for updated product
+ */
+ @Inject
+ @Any
+ private Event<ObservableProductUpdatedEvent> updatedProductEvent;
+
+ /**
+ * Default constructor
+ */
+ public FinancialAdminGenericProductActionWebViewBean () {
+ // Call super constructor
+ super();
+ }
+
+ /**
+ * Copies all product's properties back to this bean.
+ */
+ public void copyAllProductProperties () {
+ // Validate product instance
+ if (this.getProduct() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.product is null"); //NOI18N
+ } else if (this.getProduct().getProductId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.product.productId is null"); //NOI18N
+ } else if (this.getProduct().getProductId() < 1) {
+ // Not valid
+ throw new IllegalStateException(MessageFormat.format("this.product.productId={0} is not valid.", this.getProduct().getProductId())); //NOI18N
+ }
+
+ // Now copy all fields
+ this.setProductAgeGroup(this.getProduct().getProductAgeGroup());
+ this.setProductAvailability(this.getProduct().getProductAvailability());
+ this.setProductBarCodeNumber(this.getProduct().getProductBarCodeNumber());
+ this.setProductCategory(this.getProduct().getProductCategory());
+ this.setProductCurrencyCode(this.getProduct().getProductCurrencyCode());
+ this.setProductGrossPrice(this.getProduct().getProductGrossPrice());
+ this.setProductI18nKey(this.getProduct().getProductI18nKey());
+ this.setProductId(this.getProduct().getProductId());
+ this.setProductManufacturer(this.getProduct().getProductManufacturer());
+ this.setProductNetPrice(this.getProduct().getProductNetPrice());
+ this.setProductNumber(this.getProduct().getProductNumber());
+ this.setProductSize(this.getProduct().getProductSize());
+ this.setProductTaxRate(this.getProduct().getProductTaxRate());
+ this.setProductUnitAmount(this.getProduct().getProductUnitAmount());
+ this.setProductUnitI18nKey(this.getProduct().getProductUnitI18nKey());
+ }
+
+ /**
+ * Getter for product instance
+ * <p>
+ * @return Product instance
+ */
+ public Product getProduct () {
+ return this.product;
+ }
+
+ /**
+ * Setter for product instance
+ * <p>
+ * @param product Product instance
+ */
+ public void setProduct (final Product product) {
+ this.product = product;
+ }
+
+ /**
+ * 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>
+ * @return Product's available
+ */
+ public Boolean getProductAvailability () {
+ return this.productAvailability;
+ }
+
+ /**
+ * Setter for product's available
+ * <p>
+ * @param productAvailability Product's available
+ */
+ public void setProductAvailability (final Boolean productAvailability) {
+ this.productAvailability = productAvailability;
+ }
+
+ /**
+ * Getter for product's bar-code number
+ * <p>
+ * @return Product's bar-code number
+ */
+ public String getProductBarCodeNumber () {
+ return this.productBarCodeNumber;
+ }
+
+ /**
+ * Setter for product's bar-code number
+ * <p>
+ * @param productBarCodeNumber Product's bar-code number
+ */
+ public void setProductBarCodeNumber (final String productBarCodeNumber) {
+ this.productBarCodeNumber = productBarCodeNumber;
+ }
+
+ /**
+ * Getter for product's category
+ * <p>
+ * @return Product's category
+ */
+ public Category getProductCategory () {
+ return this.productCategory;
+ }
+
+ /**
+ * Setter for product's category instance
+ * <p>
+ * @param productCategory Product's category instance
+ */
+ public void setProductCategory (final Category productCategory) {
+ this.productCategory = productCategory;
+ }
+
+ /**
+ * Getter for product's price currency code
+ * <p>
+ * @return Product's price currency code
+ */
+ public String getProductCurrencyCode () {
+ return this.productCurrencyCode;
+ }
+
+ /**
+ * Setter for product's price currency code
+ * <p>
+ * @param productCurrencyCode Product's price currency code
+ */
+ public void setProductCurrencyCode (final String productCurrencyCode) {
+ this.productCurrencyCode = productCurrencyCode;
+ }
+
+ /**
+ * Getter for product's gross price
+ * <p>
+ * @return Product's gross price
+ */
+ public BigDecimal getProductGrossPrice () {
+ return this.productGrossPrice;
+ }
+
+ /**
+ * Setter for product's gross price
+ * <p>
+ * @param productGrossPrice Product's gross price
+ */
+ 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 id
+ * <p>
+ * @return Product id
+ */
+ public Long getProductId () {
+ return this.productId;
+ }
+
+ /**
+ * Setter for product id
+ * <p>
+ * @param productId Product id
+ */
+ public void setProductId (final Long productId) {
+ this.productId = productId;
+ }
+
+ /**
+ * Getter for product's manufacturing/producing company
+ * <p>
+ * @return Product's manufacturing/producing company
+ */
+ public BasicData getProductManufacturer () {
+ return this.productManufacturer;
+ }
+
+ /**
+ * Setter for product's manufacturing/producing company
+ * <p>
+ * @param productManufacturer Product's manufacturing/producing company
+ */
+ public void setProductManufacturer (final BasicData productManufacturer) {
+ this.productManufacturer = productManufacturer;
+ }
+
+ /**
+ * Getter for product's net price
+ * <p>
+ * @return Product's net price
+ */
+ public BigDecimal getProductNetPrice () {
+ return this.productNetPrice;
+ }
+
+ /**
+ * Setter for product's net price
+ * <p>
+ * @param productNetPrice Product's net price
+ */
+ public void setProductNetPrice (final BigDecimal productNetPrice) {
+ this.productNetPrice = productNetPrice;
+ }
+
+ /**
+ * Getter for product's number
+ * <p>
+ * @return Product's number
+ */
+ public Long getProductNumber () {
+ return this.productNumber;
+ }
+
+ /**
+ * Setter for product's number
+ * <p>
+ * @param productNumber Product's number
+ */
+ public void setProductNumber (final Long productNumber) {
+ this.productNumber = productNumber;
+ }
+
+ /**
+ * Getter for product's size
+ * <p>
+ * @return Product's size
+ */
+ public String getProductSize () {
+ return this.productSize;
+ }
+
+ /**
+ * Setter for product's size
+ * <p>
+ * @param productSize Product's size
+ */
+ 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;
+ }
+
+ /**
+ * Getter for product's unit amount
+ * <p>
+ * @return Product's unit amount
+ */
+ public BigDecimal getProductUnitAmount () {
+ return this.productUnitAmount;
+ }
+
+ /**
+ * Setter for product's unit amount
+ * <p>
+ * @param productUnitAmount Product's unit amount
+ */
+ public void setProductUnitAmount (final BigDecimal productUnitAmount) {
+ this.productUnitAmount = productUnitAmount;
+ }
+
+ /**
+ * Getter for product unit's i18n key
+ * <p>
+ * @return Product's i18n key
+ */
+ public String getProductUnitI18nKey () {
+ return this.productUnitI18nKey;
+ }
+
+ /**
+ * Setter for product unit's i18n key
+ * <p>
+ * @param productUnitI18nKey Product unit's i18n key
+ */
+ public void setProductUnitI18nKey (final String productUnitI18nKey) {
+ this.productUnitI18nKey = productUnitI18nKey;
+ }
+
+ /**
+ * Updates given product data from request to database
+ * <p>
+ * @throws FaceletException If something unexpected happened
+ */
+ public void updateProduct () throws FaceletException {
+ // Get product instance
+ final Product newProduct = this.createProductInstance();
+ // Check if product instance is in helper and valid
+
+ if (null == newProduct) {
+ // Throw NPE
+ throw new NullPointerException("newProduct is null"); //NOI18N
+ } else if (newProduct.getProductId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("newProduct.productId is null"); //NOI18N //NOI18N
+ } else if (newProduct.getProductId() < 1) {
+ // Invalid id
+ throw new IllegalStateException(MessageFormat.format("newProduct.productId={0} is invalid", newProduct.getProductId())); //NOI18N
+ }
+
+ // Init productr
+ final Product updatedProduct;
+
+ try {
+ // Call EJB for updating product data
+ updatedProduct = this.adminProductBean.updateProductData(newProduct);
+ } catch (final ProductNotFoundException ex) {
+ // Throw again
+ throw new FaceletException(ex);
+ }
+
+ // Fire event
+ this.updatedProductEvent.fire(new ProductUpdatedEvent(updatedProduct));
+
+ // Clear bean
+ this.clear();
+ }
+
+ /**
+ * Clears this bean (example: product has been added)
+ */
+ private void clear () {
+ // Clear all data
+ this.setProductAgeGroup(null);
+ this.setProductAvailability(Boolean.FALSE);
+ this.setProductBarCodeNumber(null);
+ this.setProductCategory(null);
+ this.setProductGrossPrice(null);
+ this.setProductI18nKey(null);
+ this.setProductId(null);
+ this.setProductManufacturer(null);
+ this.setProductNetPrice(null);
+ this.setProductNumber(null);
+ this.setProductSize(null);
+ this.setProductTaxRate(null);
+ this.setProductUnitAmount(null);
+ this.setProductUnitI18nKey(null);
+ }
+
+ /**
+ * Creates a product instance with all fields
+ * <p>
+ * @return Product instance
+ */
+ private Product createProductInstance () {
+ // Create product instance
+ final Product newProduct = new GenericProduct(this.getProductI18nKey(), this.getProductGrossPrice(), this.getProductCurrencyCode(), this.getProductCategory(), this.getProductAvailability(), this.getProductUnitAmount(), this.getProductUnitI18nKey());
+
+ // Set all optional fields
+ newProduct.setProductAgeGroup(this.getProductAgeGroup());
+ newProduct.setProductBarCodeNumber(this.getProductBarCodeNumber());
+ newProduct.setProductManufacturer(this.getProductManufacturer());
+ newProduct.setProductNumber(this.getProductNumber());
+ newProduct.setProductNetPrice(this.getProductNetPrice());
+ newProduct.setProductSize(this.getProductSize());
+ newProduct.setProductTaxRate(this.getProductTaxRate());
+
+ // Is product id set?
+ if (this.getProductId() instanceof Long) {
+ // Set it, too
+ newProduct.setProductId(this.getProductId());
+ }
+
+ // Return it
+ return newProduct;
+ }
+
+}
--- /dev/null
+/*
+ * 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
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.generic_product.action;
+
+import org.mxchange.jfinancials.beans.generic_product.*;
+import java.io.Serializable;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialAdminProductActionWebViewController extends Serializable {
+
+}
*/
package org.mxchange.jfinancials.beans.helper.product;
-import java.text.MessageFormat;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Any;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jfinancials.beans.BaseFinancialsBean;
import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController;
-import org.mxchange.jproduct.events.product.created.CreatedProductEvent;
-import org.mxchange.jproduct.events.product.created.ObservableCreatedProductEvent;
import org.mxchange.jproduct.model.category.Category;
import org.mxchange.jproduct.model.product.Product;
@Inject
private FinancialsLocalizationSessionController localizationController;
- /**
- * Product instance
- */
- private Product product;
-
- /**
- * An event fired when a product id has been converted to a product
- * instance.
- */
- @Inject
- @Any
- private Event<ObservableCreatedProductEvent> productCreatedEvent;
-
/**
* Default constructor
*/
super();
}
- /**
- * Getter for product instance
- * <p>
- * @return Product instance
- */
- public Product getProduct () {
- return this.product;
- }
-
- /**
- * Setter for product instance
- * <p>
- * @param product Product instance
- */
- public void setProduct (final Product product) {
- this.product = product;
- }
-
- /**
- * Notifies other controllers (backing beans) if a product id has been
- * successfully converted to a Product instance.
- */
- public void notifyControllerProductConverted () {
- // Validate product instance
- if (this.getProduct() == null) {
- // Throw NPE
- throw new NullPointerException("this.product is null"); //NOI18N
- } else if (this.getProduct().getProductId() == null) {
- // Throw NPE again
- throw new NullPointerException("this.product.productId is null"); //NOI18N
- } else if (this.getProduct().getProductId() < 1) {
- // Not valid
- throw new IllegalStateException(MessageFormat.format("this.product.productId={0} is not valid.", this.getProduct().getProductId())); //NOI18N
- }
-
- // Set all fields: user
- this.productCreatedEvent.fire(new CreatedProductEvent(this.getProduct()));
- }
-
/**
* Returns the product name and price. If null is provided, an empty string
* is returned.
import javax.inject.Named;
import org.mxchange.jfinancials.beans.BaseFinancialsBean;
import org.mxchange.jfinancials.beans.product_category.list.FinancialsCategoryListWebViewController;
-import org.mxchange.jproduct.events.category.AddedCategoryEvent;
-import org.mxchange.jproduct.events.category.CategoryAddedEvent;
+import org.mxchange.jproduct.events.category.added.AddedCategoryEvent;
+import org.mxchange.jproduct.events.category.added.CategoryAddedEvent;
import org.mxchange.jproduct.exceptions.category.CategoryAlreadyAddedException;
import org.mxchange.jproduct.model.category.AdminCategorySessionBeanRemote;
import org.mxchange.jproduct.model.category.Category;
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jproduct.events.category.AddedCategoryEvent;
+import org.mxchange.jproduct.events.category.added.AddedCategoryEvent;
import org.mxchange.jproduct.exceptions.category.CategoryNotFoundException;
import org.mxchange.jproduct.model.category.Category;
import org.mxchange.jproduct.model.category.CategorySessionBeanRemote;
<type>org.mxchange.jcoreee.bean.faces.BaseFacesBean</type>
</attribute>
</tag>
+ <tag>
+ <tag-name>genericProductForm</tag-name>
+ <description>A tag for generic product forms.</description>
+ <source>resources/tags/forms/generic_product/admin_form_generic_product_data.tpl</source>
+ <attribute>
+ <name>targetController</name>
+ <description>A target backing bean (EL code resolving into it) extending at least BaseFacesBean where to set the data in.</description>
+ <required>true</required>
+ <!-- @TODO Find an interface for BaseFacesBean and set it here instead -->
+ <type>org.mxchange.jcoreee.bean.faces.BaseFacesBean</type>
+ </attribute>
+ </tag>
</facelet-taglib>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+@TODO: title="#{project.ADMIN_GENERIC_PRODUCT_DATA_LEGEND_TITLE}"
+-->
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:product="http://mxchange.org/jsf/jproduct/widgets"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+ xmlns:p="http://primefaces.org/ui"
+ >
+
+ <p:fieldset legend="#{project.ADMIN_GENERIC_PRODUCT_DATA_LEGEND}">
+ <p:panelGrid
+ layout="grid"
+ columns="2"
+ columnClasses="ui-grid-col-4,ui-grid-col-8"
+ styleClass="ui-noborder"
+ >
+ <p:outputLabel for="productCategory" value="#{project.ADMIN_ASSIGN_PRODUCT_CATEGORY}" />
+ <p:selectOneMenu
+ id="productCategory"
+ value="#{targetController.productCategory}"
+ filter="true"
+ filterMatchMode="contains"
+ required="true"
+ requiredMessage="#{project.ADMIN_PRODUCT_CATEGORY_REQUIRED}"
+ title="#{project.ADMIN_ASSIGN_PRODUCT_CATEGORY_TITLE}"
+ >
+
+ <f:converter converterId="ProductCategoryConverter" />
+
+ <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
+
+ <f:selectItems
+ value="#{categoryListController.allCategories}"
+ var="category"
+ itemValue="#{category}"
+ itemLabel="#{productBeanHelper.renderProductCategory(category)}"
+ />
+ </p:selectOneMenu>
+
+ <p:outputLabel for="productI18nKey" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_I18N_KEY}" />
+ <p:inputText
+ id="productI18nKey"
+ value="#{targetController.productI18nKey}"
+ maxlength="255"
+ required="true"
+ requiredMessage="#{project.ADMIN_PRODUCT_I18N_KEY_REQUIRED}"
+ 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="#{targetController.productNumber}"
+ size="20"
+ maxlength="20"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_NUMBER_TITLE}"
+ />
+
+ <p:outputLabel for="productBarCodeNumber" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_BARCODE_NUMBER}" />
+ <p:inputText
+ id="productBarCodeNumber"
+ value="#{targetController.productBarCodeNumber}"
+ size="30"
+ maxlength="255"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_BARCODE_NUMBER_TITLE}"
+ />
+
+ <p:outputLabel for="productAgeGroup" value="#{project.ADMIN_SELECT_PRODUCT_AGE_GROUP}" />
+ <p:selectOneMenu
+ id="productAgeGroup"
+ value="#{targetController.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="#{targetController.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"
+ value="#{targetController.productManufacturer}"
+ filter="true"
+ filterMatchMode="contains"
+ title="#{project.ADMIN_ASSIGN_PRODUCT_MANUFACTURER_TITLE}"
+ >
+
+ <f:converter converterId="BasicCompanyDataConverter" />
+
+ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
+
+ <f:selectItems
+ value="#{basicDataListController.allBasicData}"
+ var="basicData"
+ itemValue="#{basicData}"
+ itemLabel="#{beanHelper.renderBasicData(basicData)}"
+ />
+ </p:selectOneMenu>
+
+ <p:outputLabel for="productAvailability" value="#{project.ADMIN_ENABLE_PRODUCT_AVAILABILITY}" />
+ <p:selectBooleanCheckbox
+ id="productAvailability"
+ value="#{targetController.productAvailability}"
+ required="true"
+ requiredMessage="#{project.ADMIN_GENERIC_PRODUCT_AVAILABILITY_REQUIRED}"
+ title="#{project.ADMIN_ENABLE_PRODUCT_AVAILABILITY_TITLE}"
+ />
+
+ <p:outputLabel value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_PRICE}" />
+ <product:inputProductPricePanelGrid targetController="#{targetController}" />
+
+ <p:outputLabel for="productCurrencyCode" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_CURRENCY_CODE}" />
+ <p:inputText
+ id="productCurrencyCode"
+ value="#{targetController.productCurrencyCode}"
+ size="3"
+ maxlength="3"
+ 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_GENERIC_PRODUCT_UNIT_AMOUNT}" />
+ <p:inputNumber
+ id="productUnitAmount"
+ value="#{targetController.productUnitAmount}"
+ size="20"
+ minValue="0.001"
+ maxValue="20000.000"
+ decimalSeparator=","
+ thousandSeparator="."
+ 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_GENERIC_PRODUCT_UNIT_I18N_KEY}" />
+ <p:inputText
+ id="productUnitI18nKey"
+ value="#{targetController.productUnitI18nKey}"
+ size="20"
+ maxlength="255"
+ title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_I18N_KEY_TITLE}"
+ required="true"
+ requiredMessage="#{project.ADMIN_PRODUCT_UNIT_I18N_KEY_REQUIRED}"
+ />
+ </p:panelGrid>
+ </p:fieldset>
+</ui:composition>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" ?>
-<!--
-@TODO: title="#{project.ADMIN_GENERIC_PRODUCT_DATA_LEGEND_TITLE}"
--->
-<ui:composition
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:product="http://mxchange.org/jsf/jproduct/widgets"
- xmlns:f="http://xmlns.jcp.org/jsf/core"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:p="http://primefaces.org/ui"
- >
-
- <p:fieldset legend="#{project.ADMIN_GENERIC_PRODUCT_DATA_LEGEND}">
- <p:panelGrid
- layout="grid"
- columns="2"
- columnClasses="ui-grid-col-4,ui-grid-col-8"
- styleClass="ui-noborder"
- >
- <p:outputLabel for="productCategory" value="#{project.ADMIN_ASSIGN_PRODUCT_CATEGORY}" />
- <p:selectOneMenu
- id="productCategory"
- value="#{adminProductController.productCategory}"
- filter="true"
- filterMatchMode="contains"
- required="true"
- requiredMessage="#{project.ADMIN_PRODUCT_CATEGORY_REQUIRED}"
- title="#{project.ADMIN_ASSIGN_PRODUCT_CATEGORY_TITLE}"
- >
- <f:converter converterId="ProductCategoryConverter" />
- <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{categoryListController.allCategories}" var="category" itemValue="#{category}" itemLabel="#{productBeanHelper.renderProductCategory(category)}" />
- </p:selectOneMenu>
-
- <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_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="20"
- maxlength="20"
- title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_NUMBER_TITLE}"
- />
-
- <p:outputLabel for="productBarCodeNumber" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_BARCODE_NUMBER}" />
- <p:inputText
- id="productBarCodeNumber"
- value="#{adminProductController.productBarCodeNumber}"
- size="30"
- maxlength="255"
- title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_BARCODE_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"
- value="#{adminProductController.productManufacturer}"
- filter="true"
- filterMatchMode="contains"
- title="#{project.ADMIN_ASSIGN_PRODUCT_MANUFACTURER_TITLE}"
- >
- <f:converter converterId="BasicCompanyDataConverter" />
- <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
- </p:selectOneMenu>
-
- <p:outputLabel for="productAvailability" value="#{project.ADMIN_ENABLE_PRODUCT_AVAILABILITY}" />
- <p:selectBooleanCheckbox
- id="productAvailability"
- value="#{adminProductController.productAvailability}"
- required="true"
- requiredMessage="#{project.ADMIN_GENERIC_PRODUCT_AVAILABILITY_REQUIRED}"
- title="#{project.ADMIN_ENABLE_PRODUCT_AVAILABILITY_TITLE}"
- />
-
- <p:outputLabel value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_PRICE}" />
- <product:inputProductPricePanelGrid targetController="#{adminProductController}" />
-
- <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_GENERIC_PRODUCT_CURRENCY_CODE_TITLE}"
- required="true"
- requiredMessage="#{project.ADMIN_PRODUCT_CURRENCY_CODE_REQUIRED}"
- />
-
- <p:outputLabel for="productUnitAmount" value="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_AMOUNT}" />
- <p:inputNumber
- id="productUnitAmount"
- value="#{adminProductController.productUnitAmount}"
- size="20"
- minValue="0.001"
- maxValue="20000.000"
- decimalSeparator=","
- thousandSeparator="."
- 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_GENERIC_PRODUCT_UNIT_I18N_KEY}" />
- <p:inputText
- id="productUnitI18nKey"
- value="#{adminProductController.productUnitI18nKey}"
- size="20"
- maxlength="255"
- title="#{project.ADMIN_ENTER_GENERIC_PRODUCT_UNIT_I18N_KEY_TITLE}"
- required="true"
- requiredMessage="#{project.ADMIN_PRODUCT_UNIT_I18N_KEY_REQUIRED}"
- />
- </p:panelGrid>
- </p:fieldset>
-</ui:composition>
filterMatchMode="contains"
title="#{project.ADMIN_ASSIGN_PARENT_CATEGORY_TITLE}"
>
+
<f:converter converterId="ProductCategoryConverter" />
+
<f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
- <f:selectItems value="#{categoryListController.allCategories}" var="category" itemValue="#{category}" itemLabel="#{productBeanHelper.renderProductCategory(category)}" />
+
+ <f:selectItems
+ value="#{categoryListController.allCategories}"
+ var="category"
+ itemValue="#{category}"
+ itemLabel="#{productBeanHelper.renderProductCategory(category)}"
+ />
</p:selectOneMenu>
<p:outputLabel for="categoryI18nKey" value="#{project.ADMIN_ENTER_CATEGORY_I18N_KEY}" />
<ui:define name="metadata">
<f:metadata>
- <f:viewParam id="productId" name="productId" value="#{productBeanHelper.product}" converter="GenericProductConverter" required="true" requiredMessage="#{project.ERROR_PARAMETER_PRODUCT_ID_NOT_SET}" converterMessage="#{project.PARAMETER_PRODUCT_ID_INVALID}" />
- <f:viewAction action="#{productBeanHelper.notifyControllerProductConverted()}" />
+ <f:viewParam
+ id="productId"
+ name="productId"
+ value="#{adminGenericProductActionController.product}"
+ converter="GenericProductConverter"
+ required="true"
+ requiredMessage="#{project.ERROR_PARAMETER_PRODUCT_ID_NOT_SET}"
+ converterMessage="#{project.PARAMETER_PRODUCT_ID_INVALID}"
+ />
+
+ <f:viewAction
+ action="#{adminGenericProductActionController.copyAllProductProperties()}"
+ />
</f:metadata>
</ui:define>
<ui:composition
template="/WEB-INF/templates/admin/admin_base.tpl"
xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:product="http://mxchange.org/jsf/jproduct/widgets"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
<ui:define name="metadata">
<f:metadata>
- <f:viewParam id="productId" name="productId" value="#{productBeanHelper.product}" converter="GenericProductConverter" required="true" requiredMessage="#{project.ERROR_PARAMETER_PRODUCT_ID_NOT_SET}" converterMessage="#{project.PARAMETER_PRODUCT_ID_INVALID}" />
- <f:viewAction action="#{productBeanHelper.notifyControllerProductConverted()}" />
+ <f:viewParam
+ id="productId"
+ name="productId"
+ value="#{adminGenericProductActionController.product}"
+ converter="GenericProductConverter"
+ required="true"
+ requiredMessage="#{project.ERROR_PARAMETER_PRODUCT_ID_NOT_SET}"
+ converterMessage="#{project.PARAMETER_PRODUCT_ID_INVALID}"
+ />
+
+ <f:viewAction
+ action="#{adminGenericProductActionController.copyAllProductProperties()}"
+ />
</f:metadata>
</ui:define>
</ui:define>
<ui:define name="content">
- <p:message for="productId" showSummary="true" rendered="#{empty productBeanHelper.product}" />
+ <p:message
+ for="productId"
+ showSummary="true"
+ rendered="#{empty adminGenericProductActionController.product}"
+ />
- <h:form id="form-edit-product" rendered="#{not empty productBeanHelper.product}">
- <h:inputHidden value="#{adminProductController.productId}" />
+ <h:form rendered="#{not empty adminGenericProductActionController.product}">
+ <h:inputHidden value="#{adminGenericProductActionController.productId}" />
<p:panelGrid
columns="1"
layout="grid"
>
<f:facet name="header">
- <h:outputFormat value="#{project.ADMIN_EDIT_GENERIC_PRODUCT_TITLE}" title="#{local[productBeanHelper.product.productI18nKey]}">
- <f:param value="#{productBeanHelper.product.productId}" />
+ <h:outputFormat value="#{project.ADMIN_EDIT_GENERIC_PRODUCT_TITLE}" title="#{local[adminGenericProductActionController.product.productI18nKey]}">
+ <f:param value="#{adminGenericProductActionController.product.productId}" />
</h:outputFormat>
</f:facet>
<h:outputText value="#{project.ADMIN_EDIT_GENERIC_PRODUCT_MINIMUM_DATA}" />
</h:panelGroup>
- <ui:include src="/WEB-INF/templates/admin/generic_product/admin_form_product_data.tpl" />
+ <product:genericProductForm
+ targetController="#{adminGenericProductActionController}"
+ />
<f:facet name="footer">
<p:panelGrid columns="2" layout="grid">
/>
<p:commandButton
- process="@form"
type="submit"
value="#{project.BUTTON_ADMIN_EDIT_GENERIC_PRODUCT}"
- action="#{adminProductController.updateProduct()}"
+ action="#{adminGenericProductActionController.updateProduct()}"
/>
</p:panelGrid>
</f:facet>
<ui:composition
template="/WEB-INF/templates/admin/admin_base.tpl"
xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:product="http://mxchange.org/jsf/jproduct/widgets"
xmlns:product-links="http://mxchange.org/jsf/jproduct/links"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
oncomplete="PF('productDialog').show()"
/>
- <p:column headerText="#{msg.ID_NUMBER_HEADER}" sortBy="#{product.productId}" filterable="false">
+ <p:column headerText="#{msg.ID_HEADER}" sortBy="#{product.productId}" filterable="false">
<p:link outcome="admin_show_generic_product" title="#{project.ADMIN_LINK_SHOW_GENERIC_PRODUCT_TITLE}" value="#{product.productId}">
<f:param name="productId" value="#{product.productId}" />
</p:link>
title="#{project.FILTER_BY_MULTIPLE_PRODUCT_CATEGORIES_TITLE}"
>
<f:converter converterId="ProductCategoryConverter" />
- <f:selectItems value="#{categoryListController.allCategories}" var="category" itemValue="#{category}" itemLabel="#{productBeanHelper.renderProductCategory(category)}" />
+
+ <f:selectItems
+ value="#{categoryListController.allCategories}"
+ var="category"
+ itemValue="#{category}"
+ itemLabel="#{productBeanHelper.renderProductCategory(category)}"
+ />
</p:selectCheckboxMenu>
</f:facet>
title="#{msg.FILTER_BY_MULTIPLE_COMPANIES_TITLE}"
>
<f:converter converterId="BasicCompanyDataConverter" />
- <f:selectItems value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+
+ <f:selectItems
+ value="#{basicDataListController.allBasicData}"
+ var="basicData"
+ itemValue="#{basicData}"
+ itemLabel="#{basicData.companyName}"
+ />
</p:selectCheckboxMenu>
</f:facet>
</p:column>
<p:column headerText="#{msg.ENTRY_CREATED_HEADER}" sortBy="#{product.productCreated}" filterable="false">
- <h:outputText id="productCreated" value="#{product.productCreated}">
+ <h:outputText value="#{product.productCreated}">
<f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
</h:outputText>
</p:column>
</h:outputFormat>
</f:facet>
- <p:outputLabel value="#{msg.ID_NUMBER_HEADER}" title="#{project.PRODUCT_ID_NUMBER_TITLE}" />
+ <p:outputLabel value="#{msg.ID_HEADER}" title="#{project.PRODUCT_ID_NUMBER_TITLE}" />
<h:outputText value="#{productListController.selectedProduct.productId}" />
<p:outputLabel value="#{msg.ADMIN_I18N_KEY_HEADER}" title="#{project.PRODUCT_I18N_KEY_TITLE}" />
<h:outputText value="#{project.PRODUCT_HAS_NO_MANUFACTURER_ASSIGNED}" rendered="#{empty productListController.selectedProduct.productManufacturer}" />
<p:outputLabel value="#{msg.ENTRY_CREATED_HEADER}" title="#{project.ADMIN_PRODUCT_ENTRY_CREATED_TITLE}" />
- <h:outputText id="productCreated" value="#{productListController.selectedProduct.productCreated}">
+ <h:outputText value="#{productListController.selectedProduct.productCreated}">
<f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
</h:outputText>
</p:panelGrid>
</p:dialog>
</h:form>
- <h:form id="form-add-product">
+ <h:form>
<p:panelGrid
columns="1"
layout="grid"
<h:outputText value="#{project.ADMIN_ADD_GENERIC_PRODUCT_MINIMUM_DATA}" />
</h:panelGroup>
- <ui:include src="/WEB-INF/templates/admin/generic_product/admin_form_product_data.tpl" />
+ <product:genericProductForm targetController="#{adminGenericProductController}" />
<f:facet name="footer">
<p:panelGrid columns="2" layout="grid">
/>
<p:commandButton
- process="@form"
type="submit"
value="#{project.BUTTON_ADMIN_ADD_GENERIC_PRODUCT}"
- action="#{adminProductController.addProduct()}"
+ action="#{adminGenericProductController.addProduct()}"
update=":master:form-list-products:productList"
/>
</p:panelGrid>
<ui:define name="metadata">
<f:metadata>
- <f:viewParam id="productId" name="productId" value="#{productBeanHelper.product}" converter="GenericProductConverter" required="true" requiredMessage="#{project.ERROR_PARAMETER_PRODUCT_ID_NOT_SET}" converterMessage="#{project.PARAMETER_PRODUCT_ID_INVALID}" />
- <f:viewAction action="#{productBeanHelper.notifyControllerProductConverted()}" />
+ <f:viewParam
+ id="productId"
+ name="productId"
+ value="#{adminGenericProductActionController.product}"
+ converter="GenericProductConverter"
+ required="true"
+ requiredMessage="#{project.ERROR_PARAMETER_PRODUCT_ID_NOT_SET}"
+ converterMessage="#{project.PARAMETER_PRODUCT_ID_INVALID}"
+ />
+
+ <f:viewAction
+ action="#{adminGenericProductActionController.copyAllProductProperties()}"
+ />
</f:metadata>
</ui:define>
oncomplete="PF('categoryDialog').show()"
/>
- <p:column headerText="#{msg.ID_NUMBER_HEADER}" sortBy="#{category.categoryId}" filterable="false">
+ <p:column headerText="#{msg.ID_HEADER}" sortBy="#{category.categoryId}" filterable="false">
<p:link outcome="admin_show_product_category" title="#{project.ADMIN_LINK_SHOW_PRODUCT_CATEGORY_TITLE}" value="#{category.categoryId}">
<f:param name="categoryId" value="#{category.categoryId}" />
</p:link>
title="#{project.FILTER_BY_MULTIPLE_PRODUCT_CATEGORIES_TITLE}"
>
<f:converter converterId="ProductCategoryConverter" />
- <f:selectItems value="#{categoryListController.allCategories}" var="category" itemValue="#{category}" itemLabel="#{productBeanHelper.renderProductCategory(category)}" />
+
+ <f:selectItems
+ value="#{categoryListController.allCategories}"
+ var="category"
+ itemValue="#{category}"
+ itemLabel="#{productBeanHelper.renderProductCategory(category)}"
+ />
</p:selectCheckboxMenu>
</f:facet>
</h:outputFormat>
</f:facet>
- <p:outputLabel value="#{msg.ID_NUMBER_HEADER}" title="#{project.CATEGORY_ID_NUMBER_TITLE}" />
+ <p:outputLabel value="#{msg.ID_HEADER}" title="#{project.CATEGORY_ID_NUMBER_TITLE}" />
<h:outputText value="#{categoryListController.selectedCategory.categoryId}" />
<p:outputLabel value="#{msg.ADMIN_I18N_KEY_HEADER}" title="#{project.CATEGORY_I18N_KEY_TITLE}" />
</p:dialog>
</h:form>
- <h:form id="form-add-category">
+ <h:form>
<p:panelGrid
columns="1"
layout="grid"
/>
<p:commandButton
- process="@form"
type="submit"
value="#{project.BUTTON_ADMIN_ADD_PRODUCT_CATEGORY}"
action="#{adminCategoryController.addCategory()}"