* Initialization of this bean
*/
@PostConstruct
- public void init () {
+ public void initializeList () {
// Is cache there?
if (!this.productCache.iterator().hasNext()) {
// "Walk" through all entries and add to cache
- for (final Product product : this.productBean.fetchAllProducts()) {
+ for (final Product product : this.productBean.fetchAllGenericProducts()) {
// Add it by primary key
this.productCache.put(product.getProductId(), product);
}
public int compare (final Product product1, final Product product2) {
return product1.getProductId() > product2.getProductId() ? 1 : product1.getProductId() < product2.getProductId() ? -1 : 0;
}
- }
- );
+ });
// Set whole list
this.setFilteredProducts(this.getAllProducts());
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2020 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.product_category;
-
-import javax.ejb.EJB;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Any;
-import javax.faces.FacesException;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Inject;
-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.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 org.mxchange.jproduct.model.category.ProductCategory;
-
-/**
- * Main application class
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("adminCategoryController")
-@RequestScoped
-public class FinancialAdminCategoryWebRequestBean extends BaseFinancialsBean implements FinancialAdminCategoryWebRequestController {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 5_819_375_183_472_871L;
-
- /**
- * Event for added shop categories
- */
- @Inject
- @Any
- private Event<AddedCategoryEvent> categoryAddedEvent;
-
- /**
- * Remote bean for categories
- */
- @EJB (lookup = "java:global/jfinancials-ejb/adminCategory!org.mxchange.jproduct.model.category.AdminCategorySessionBeanRemote")
- private AdminCategorySessionBeanRemote categoryBean;
-
- /**
- * Category categoryI18nKey
- */
- private String categoryI18nKey;
-
- /**
- * General category controller
- */
- @Inject
- private FinancialsCategoryListWebViewController categoryListController;
-
- /**
- * Whether this category is shown in statistics
- */
- private Boolean categoryShownInStatistics;
-
- /**
- * Parent category
- */
- private Category parentCategory;
-
- /**
- * Default constructor
- */
- public FinancialAdminCategoryWebRequestBean () {
- // Call super constructor
- super();
- }
-
- /**
- * Adds given category data from request to database
- * <p>
- * @throws FaceletException If something unexpected happened
- */
- public void addCategory () throws FaceletException {
- // Is i18n key already used?
- if (this.categoryListController.isCategoryI18nKeyAdded(this.getCategoryI18nKey())) {
- // Throw exception
- throw new FacesException("Category i18n key " + this.getCategoryI18nKey() + " is already used.");
- }
-
- // Create category
- final Category category = this.createCategoryInstance();
-
- // Declare updated category instance
- final Category updatedCategory;
-
- try {
- // Deligate to remote bean
- updatedCategory = this.categoryBean.addProductCategory(category);
- } catch (final CategoryAlreadyAddedException ex) {
- // Continue to throw
- throw new FacesException(ex);
- }
-
- // Fire event
- this.categoryAddedEvent.fire(new CategoryAddedEvent(updatedCategory));
- }
-
- /**
- * Getter for category i18n key
- * <p>
- * @return Category i18n key
- */
- public String getCategoryI18nKey () {
- return this.categoryI18nKey;
- }
-
- /**
- * Setter for category i18n key
- * <p>
- * @param categoryI18nKey Category i18n key
- */
- public void setCategoryI18nKey (final String categoryI18nKey) {
- this.categoryI18nKey = categoryI18nKey;
- }
-
- /**
- * Getter for whether category is shown in statistics
- * <p>
- * @return Whether category is shown in statistics
- */
- public Boolean getCategoryShownInStatistics () {
- return this.categoryShownInStatistics;
- }
-
- /**
- * Setter for whether category is shown in statistics
- * <p>
- * @param categoryShownInStatistics Whether category is shown in statistics
- */
- public void setCategoryShownInStatistics (final Boolean categoryShownInStatistics) {
- this.categoryShownInStatistics = categoryShownInStatistics;
- }
-
- /**
- * Getter for parent id
- * <p>
- * @return Parent id
- */
- public Category getParentCategory () {
- return this.parentCategory;
- }
-
- /**
- * Setter for parent category
- * <p>
- * @param parentCategory Parent category to set
- */
- public void setParentCategory (final Category parentCategory) {
- this.parentCategory = parentCategory;
- }
-
- /**
- * Creates a category instance with all fields (except primary key)
- * <p>
- * @return Category instance
- */
- private Category createCategoryInstance () {
- // Create category
- final Category category = new ProductCategory(
- this.getCategoryI18nKey(),
- this.getCategoryShownInStatistics()
- );
-
- // Set all optional fields
- category.setParentCategory(this.getParentCategory());
-
- // Return it
- return category;
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2020 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.product_category;
-
-import java.io.Serializable;
-
-/**
- * An interface for product controllers for "ADMIN" role
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialAdminCategoryWebRequestController extends Serializable {
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 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.product_category;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+
+/**
+ * Administrative backing bean for product categories application class
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminProductCategoryController")
+@RequestScoped
+public class FinancialAdminProductCategoryWebRequestBean extends BaseFinancialsBean implements FinancialAdminProductCategoryWebRequestController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 5_819_375_183_472_871L;
+
+ /**
+ * Default constructor
+ */
+ public FinancialAdminProductCategoryWebRequestBean () {
+ // Call super constructor
+ super();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 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.product_category;
+
+import java.io.Serializable;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialAdminProductCategoryWebRequestController extends Serializable {
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2020 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.product_category;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Named;
-import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-
-/**
- * General (product) category controller
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@Named ("categoryController")
-@RequestScoped
-public class FinancialCategoryWebRequestBean extends BaseFinancialsBean implements FinancialCategoryWebRequestController {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 58_137_539_530_279L;
-
- /**
- * Default constructor
- */
- public FinancialCategoryWebRequestBean () {
- // Call super constructor
- super();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2016 - 2020 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.product_category;
-
-import java.io.Serializable;
-
-/**
- * An interface for (product) categories
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public interface FinancialCategoryWebRequestController extends Serializable {
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 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.product_category;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+
+/**
+ * General (product) category controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("categoryController")
+@RequestScoped
+public class FinancialProductCategoryWebRequestBean extends BaseFinancialsBean implements FinancialProductCategoryWebRequestController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 58_137_539_530_279L;
+
+ /**
+ * Default constructor
+ */
+ public FinancialProductCategoryWebRequestBean () {
+ // Call super constructor
+ super();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 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.product_category;
+
+import java.io.Serializable;
+
+/**
+ * An interface for (product) categories
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialProductCategoryWebRequestController extends Serializable {
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 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.product_category.action;
+
+import java.text.MessageFormat;
+import java.util.Objects;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.FacesException;
+import javax.faces.application.FacesMessage;
+import javax.inject.Inject;
+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.added.AdminAddedCategoryEvent;
+import org.mxchange.jproduct.events.category.added.ObservableAdminAddedCategoryEvent;
+import org.mxchange.jproduct.events.category.updated.AdminUpdatedCategoryEvent;
+import org.mxchange.jproduct.events.category.updated.ObservableAdminUpdatedCategoryEvent;
+import org.mxchange.jproduct.exceptions.category.CategoryAlreadyAddedException;
+import org.mxchange.jproduct.exceptions.category.CategoryNotFoundException;
+import org.mxchange.jproduct.model.category.AdminCategorySessionBeanRemote;
+import org.mxchange.jproduct.model.category.Categories;
+import org.mxchange.jproduct.model.category.Category;
+import org.mxchange.jproduct.model.category.ProductCategory;
+
+/**
+ * Administrative action backing bean for product categories
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminProductCategoryActionController")
+@RequestScoped
+public class FinancialAdminProductCategoryActionWebRequestBean extends BaseFinancialsBean implements FinancialAdminProductCategoryActionWebRequestController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 5_819_375_183_472_873L;
+
+ /**
+ * Event for added shop categories
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminAddedCategoryEvent> adminAddedCategoryEvent;
+
+ /**
+ * Remote bean for categories
+ */
+ @EJB (lookup = "java:global/jfinancials-ejb/adminCategory!org.mxchange.jproduct.model.category.AdminCategorySessionBeanRemote")
+ private AdminCategorySessionBeanRemote adminCategoryBean;
+
+ /**
+ * Event for added shop categories
+ */
+ @Inject
+ @Any
+ private Event<ObservableAdminUpdatedCategoryEvent> adminUpdatedCategoryEvent;
+
+ /**
+ * Category categoryI18nKey
+ */
+ private String categoryI18nKey;
+
+ /**
+ * Category's primary key
+ */
+ private Long categoryId;
+
+ /**
+ * Whether this category is shown in statistics
+ */
+ private Boolean categoryShownInStatistics;
+
+ /**
+ * Currently worked on category
+ */
+ private Category currentCategory;
+
+ /**
+ * Parent category
+ */
+ private Category parentCategory;
+
+ /**
+ * General category controller
+ */
+ @Inject
+ private FinancialsCategoryListWebViewController productCategoryListController;
+
+ /**
+ * Default constructor
+ */
+ public FinancialAdminProductCategoryActionWebRequestBean () {
+ // Call super constructor
+ super();
+ }
+
+ /**
+ * Adds given category data from request to database
+ */
+ public void addCategory () {
+ // Is i18n key already used?
+ if (this.productCategoryListController.isCategoryI18nKeyAdded(this.getCategoryI18nKey())) {
+ // Throw exception
+ throw new FacesException(MessageFormat.format("Category i18n key {0} is already used.", this.getCategoryI18nKey())); //NOI18N
+ }
+
+ // Create category
+ final Category category = this.createCategoryInstance();
+
+ // Declare updated category instance
+ final Category updatedCategory;
+
+ try {
+ // Deligate to remote bean
+ updatedCategory = this.adminCategoryBean.addProductCategory(category);
+ } catch (final CategoryAlreadyAddedException ex) {
+ // Continue to throw
+ throw new FacesException(ex);
+ }
+
+ // Fire event
+ this.adminAddedCategoryEvent.fire(new AdminAddedCategoryEvent(updatedCategory));
+ }
+
+ /**
+ * Copies all properties from current category instance to backing bean
+ * properties.
+ */
+ public void copyAllCategoryProperties () {
+ // Check if current category is set
+ if (this.getCurrentCategory() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.currentCategory is null"); //NOI18N
+ } else if (this.getCurrentCategory().getCategoryId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.currentCategory.categoryId is null"); //NOI18N
+ } else if (this.getCurrentCategory().getCategoryId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("this.currentCategory.categoryId={0} is invalid", this.getCurrentCategory().getCategoryId())); //NOI18N
+ }
+
+ // Copy all fields, except timestamps
+ this.setCategoryI18nKey(this.getCurrentCategory().getCategoryI18nKey());
+ this.setCategoryId(this.getCurrentCategory().getCategoryId());
+ this.setCategoryShownInStatistics(this.getCurrentCategory().getCategoryShownInStatistics());
+ this.setParentCategory(this.getCurrentCategory().getParentCategory());
+ }
+
+ /**
+ * Getter for category i18n key
+ * <p>
+ * @return Category i18n key
+ */
+ public String getCategoryI18nKey () {
+ return this.categoryI18nKey;
+ }
+
+ /**
+ * Setter for category i18n key
+ * <p>
+ * @param categoryI18nKey Category i18n key
+ */
+ public void setCategoryI18nKey (final String categoryI18nKey) {
+ this.categoryI18nKey = categoryI18nKey;
+ }
+
+ /**
+ * Getter for category's primary key
+ * <p>
+ * @return Category's primary key
+ */
+ public Long getCategoryId () {
+ return this.categoryId;
+ }
+
+ /**
+ * Setter for category's primary key
+ * <p>
+ * @param categoryId Current category
+ */
+ public void setCategoryId (final Long categoryId) {
+ this.categoryId = categoryId;
+ }
+
+ /**
+ * Getter for whether category is shown in statistics
+ * <p>
+ * @return Whether category is shown in statistics
+ */
+ public Boolean getCategoryShownInStatistics () {
+ return this.categoryShownInStatistics;
+ }
+
+ /**
+ * Setter for whether category is shown in statistics
+ * <p>
+ * @param categoryShownInStatistics Whether category is shown in statistics
+ */
+ public void setCategoryShownInStatistics (final Boolean categoryShownInStatistics) {
+ this.categoryShownInStatistics = categoryShownInStatistics;
+ }
+
+ /**
+ * Getter for current category
+ * <p>
+ * @return Current category
+ */
+ public Category getCurrentCategory () {
+ return this.currentCategory;
+ }
+
+ /**
+ * Setter for current category
+ * <p>
+ * @param currentCategory Current category
+ */
+ public void setCurrentCategory (final Category currentCategory) {
+ this.currentCategory = currentCategory;
+ }
+
+ /**
+ * Getter for parent id
+ * <p>
+ * @return Parent id
+ */
+ public Category getParentCategory () {
+ return this.parentCategory;
+ }
+
+ /**
+ * Setter for parent category
+ * <p>
+ * @param parentCategory Parent category to set
+ */
+ public void setParentCategory (final Category parentCategory) {
+ this.parentCategory = parentCategory;
+ }
+
+ /**
+ * Updates given category data from request to database
+ * <p>
+ * @return Redirection outcome
+ */
+ public String updateCategory () {
+ // Check if current category is set
+ if (this.getCurrentCategory() == null) {
+ // Throw NPE
+ throw new NullPointerException("this.currentCategory is null"); //NOI18N
+ } else if (this.getCurrentCategory().getCategoryId() == null) {
+ // Throw NPE again
+ throw new NullPointerException("this.currentCategory.categoryId is null"); //NOI18N
+ } else if (this.getCurrentCategory().getCategoryId() < 1) {
+ // Throw IAE
+ throw new IllegalArgumentException(MessageFormat.format("this.currentCategory.categoryId={0} is invalid.", this.getCurrentCategory().getCategoryId())); //NOI18N
+ }
+
+ // Create category
+ final Category category = this.createCategoryInstance();
+
+ // Has the product changed?
+ if (Objects.equals(category, this.getCurrentCategory())) {
+ // Is the same product data, output message
+ this.showFacesMessage("admin-form-edit-product-category:categoryI18nKey", "ADMIN_PRODUCT_CATEGORY_NOT_UPDATED", FacesMessage.SEVERITY_WARN); //NOI18N
+ return ""; //NOI18N
+ }
+
+ // Copy all fields from it to current
+ Categories.copyCategoryData(category, this.getCurrentCategory());
+
+ // Declare updated category instance
+ final Category updatedCategory;
+
+ try {
+ // Deligate to remote bean
+ updatedCategory = this.adminCategoryBean.updateProductCategory(this.getCurrentCategory());
+ } catch (final CategoryNotFoundException ex) {
+ // Continue to throw
+ throw new FacesException(ex);
+ }
+
+ // Fire event
+ this.adminUpdatedCategoryEvent.fire(new AdminUpdatedCategoryEvent(updatedCategory));
+
+ // Return outcome to admin-list
+ return "admin_list_product_categories"; //NOI18N
+ }
+
+ /**
+ * Creates a category instance with all fields (except primary key)
+ * <p>
+ * @return Category instance
+ */
+ private Category createCategoryInstance () {
+ // Create category
+ final Category category = new ProductCategory(
+ this.getCategoryI18nKey(),
+ this.getCategoryShownInStatistics()
+ );
+
+ // Set all optional fields
+ category.setCategoryId(this.getCategoryId());
+ category.setParentCategory(this.getParentCategory());
+
+ // Return it
+ return category;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2016 - 2020 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.product_category.action;
+
+import java.io.Serializable;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialAdminProductCategoryActionWebRequestController extends Serializable {
+
+}
import fish.payara.cdi.jsr107.impl.NamedCache;
import java.text.MessageFormat;
import java.util.Comparator;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import javax.inject.Inject;
import javax.inject.Named;
import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jproduct.events.category.added.AddedCategoryEvent;
+import org.mxchange.jproduct.events.category.added.ObservableAdminAddedCategoryEvent;
+import org.mxchange.jproduct.events.category.updated.ObservableAdminUpdatedCategoryEvent;
import org.mxchange.jproduct.exceptions.category.CategoryNotFoundException;
import org.mxchange.jproduct.model.category.Category;
import org.mxchange.jproduct.model.category.CategorySessionBeanRemote;
* <p>
* @author Roland Haeder<roland@mxchange.org>
*/
-@Named ("categoryListController")
+@Named ("productCategoryListController")
@ViewScoped
public class FinancialsCategoryListWebViewBean extends BaseFinancialsBean implements FinancialsCategoryListWebViewController {
/**
* List of all categories
*/
- private final List<Category> allCategories;
+ private final List<Category> allProductCategories;
/**
* EJB for general category stuff
/**
* A list of filtered categories
*/
- private List<Category> filteredCategories;
+ private List<Category> filteredProductCategories;
/**
* Selected category
super();
// Init list
- this.allCategories = new LinkedList<>();
+ this.allProductCategories = new LinkedList<>();
}
/**
* <p>
* @param event Event to be observed
*/
- public void afterCategoryAddedEvent (@Observes final AddedCategoryEvent event) {
+ public void afterAdminAddedCategoryEvent (@Observes final ObservableAdminAddedCategoryEvent event) {
// Is all valid?
if (null == event) {
// Throw NPE
// Add the category
this.categoryCache.put(event.getAddedCategory().getCategoryId(), event.getAddedCategory());
- this.getAllCategories().add(event.getAddedCategory());
+ this.uniqueAddProductCategory(event.getAddedCategory());
+ }
+
+ /**
+ * Observes events fired after a new product category has been updated
+ * <p>
+ * @param event Event to be observed
+ */
+ public void afterAdminUpdatedCategoryEvent (@Observes final ObservableAdminUpdatedCategoryEvent event) {
+ // Is all valid?
+ if (null == event) {
+ // Throw NPE
+ throw new NullPointerException("event is null"); //NOI18N
+ } else if (event.getUpdatedCategory() == null) {
+ // Throw again ...
+ throw new NullPointerException("event.updatedCategory is null"); //NOI18N
+ } else if (event.getUpdatedCategory().getCategoryId() == null) {
+ // And again ...
+ throw new NullPointerException("event.updatedCategory.categoryId is null"); //NOI18N
+ } else if (event.getUpdatedCategory().getCategoryId() < 1) {
+ // Id is invalid
+ throw new IllegalArgumentException(MessageFormat.format("event.updatedCategory.categoryId={0} is not valid.", event.getUpdatedCategory().getCategoryId())); //NOI18N
+ }
+
+ // Add the category
+ this.categoryCache.put(event.getUpdatedCategory().getCategoryId(), event.getUpdatedCategory());
+ this.uniqueAddProductCategory(event.getUpdatedCategory());
}
@Override
* @return All categories
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<Category> getAllCategories () {
+ public List<Category> getAllProductCategories () {
// Return it
- return this.allCategories;
+ return this.allProductCategories;
}
/**
* @return Filtered category list
*/
@SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<Category> getFilteredCategories () {
- return this.filteredCategories;
+ public List<Category> getFilteredProductCategories () {
+ return this.filteredProductCategories;
}
/**
* Setter for filtered category list
* <p>
- * @param filteredCategories Filtered category list
+ * @param filteredProductCategories Filtered category list
*/
@SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
- public void setFilteredCategories (final List<Category> filteredCategories) {
- this.filteredCategories = filteredCategories;
+ public void setFilteredProductCategories (final List<Category> filteredProductCategories) {
+ this.filteredProductCategories = filteredProductCategories;
}
/**
* Initialization of this bean
*/
@PostConstruct
- public void init () {
+ public void initializeList () {
// Is cache there?
if (!this.categoryCache.iterator().hasNext()) {
// "Walk" through all entries and add to cache
- for (final Category category : this.categoryBean.fetchAllCategories()) {
+ for (final Category category : this.categoryBean.fetchAllProductCategories()) {
// Add it by primary key
this.categoryCache.put(category.getCategoryId(), category);
}
}
// Is the list empty, but filled cache?
- if (this.allCategories.isEmpty() && this.categoryCache.iterator().hasNext()) {
+ if (this.getAllProductCategories().isEmpty() && this.categoryCache.iterator().hasNext()) {
// Build up list
for (final Cache.Entry<Long, Category> currentEntry : this.categoryCache) {
// Add to list
- this.allCategories.add(currentEntry.getValue());
+ this.getAllProductCategories().add(currentEntry.getValue());
}
// Sort list
- this.allCategories.sort(new Comparator<Category>() {
+ this.getAllProductCategories().sort(new Comparator<Category>() {
@Override
public int compare (final Category category1, final Category category2) {
return category1.getCategoryId() > category2.getCategoryId() ? 1 : category1.getCategoryId() < category2.getCategoryId() ? -1 : 0;
);
// Set whole list
- this.setFilteredCategories(this.getAllCategories());
+ this.setFilteredProductCategories(this.getAllProductCategories());
}
}
boolean isFound = false;
// Check all added,products
- for (final Category category : this.getAllCategories()) {
+ for (final Category category : this.getAllProductCategories()) {
// Is i18n key the same?
if (Objects.equals(category.getCategoryI18nKey(), categoryI18nKey)) {
// Found it
return isFound;
}
+ /**
+ * Uniquely adds given category to "all" list
+ * <p>
+ * @param category Category instance
+ */
+ private void uniqueAddProductCategory (final Category category) {
+ // Get iterator from
+ final Iterator<Category> iterator = this.getAllProductCategories().iterator();
+
+ // Loop through all
+ while (iterator.hasNext()) {
+ // Get current element
+ final Category currentCategory = iterator.next();
+
+ // Does primary key match?
+ if (Objects.equals(category.getCategoryId(), currentCategory.getCategoryId())) {
+ // Remove it and stop iterating
+ iterator.remove();
+ break;
+ }
+ }
+
+ // Re-add it
+ this.getAllProductCategories().add(category);
+ }
+
}
ADMIN_GENERIC_PRODUCT_NOT_UPDATED=Sie haben keine Aenderungen am dem Produkt vorgenommen.
ADMIN_PRODUCT_FSC_NUMBER_HEADER=FSC-Nummer:
PRODUCT_FSC_NUMBER_TITLE=The FSC-Nummer des Produktes.
+ERROR_PARAMETER_CATEGORY_ID_NOT_SET=Fehler: Parameter "categoryId" ist nicht gesetzt.
+PARAMETER_CATEGORY_ID_INVALID=Produkt mit Parameter "categoryId" nicht gefunden.
+PAGE_TITLE_ADMIN_PRODUCT_CATEGORY_EDIT=Produktkategorien editieren
+CONTENT_TITLE_ADMIN_PRODUCT_CATEGORY_EDIT=Produktkategorien editieren:
+#@TODO Please fix German umlauts!
+ADMIN_EDIT_PRODUCT_CATEGORY_MINIMUM_DATA=Geben Sie mindestens den I18n-Schluessel ein, um diese Produktkategorie zu editieren.
+#@TODO Please fix German umlauts!
+BUTTON_ADMIN_EDIT_PRODUCT_CATEGORY=Produktkategorie aendern
+ADMIN_EDIT_PRODUCT_CATEGORY_TITLE=Produktkategorie mit Id {0} editieren:
+#@TODO Please fix German umlauts!
+ADMIN_PRODUCT_CATEGORY_NOT_UPDATED=Sie haben die Produktkategorie nicht gaendert.
ADMIN_GENERIC_PRODUCT_NOT_UPDATED=You have not changed any product data.
ADMIN_PRODUCT_FSC_NUMBER_HEADER=FSC number:
PRODUCT_FSC_NUMBER_TITLE=The FSC number of the product.
+ERROR_PARAMETER_CATEGORY_ID_NOT_SET=Error: Parameter "categoryId" is not set.
+PARAMETER_CATEGORY_ID_INVALID=Product category with given "categoryId" not found.
+PAGE_TITLE_ADMIN_PRODUCT_CATEGORY_EDIT=Edit product category
+CONTENT_TITLE_ADMIN_PRODUCT_CATEGORY_EDIT=Edit product category:
+ADMIN_EDIT_PRODUCT_CATEGORY_MINIMUM_DATA=Please enter at least the i18n key to edit this product category.
+BUTTON_ADMIN_EDIT_PRODUCT_CATEGORY=Change product category
+ADMIN_EDIT_PRODUCT_CATEGORY_TITLE=Edit product category Id {0}:
+ADMIN_PRODUCT_CATEGORY_NOT_UPDATED=You have not changed the product category.
<to-view-id>/admin/product_category/admin_product_category_assign_parent.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
+ <navigation-rule>
+ <from-view-id>/admin/product_category/admin_product_category_edit.xhtml</from-view-id>
+ <navigation-case>
+ <from-outcome>admin_list_product_categories</from-outcome>
+ <to-view-id>/admin/product_category/admin_product_category_list.xhtml</to-view-id>
+ <redirect></redirect>
+ </navigation-case>
+ </navigation-rule>
<navigation-rule>
<from-view-id>/admin/generic_product/admin_generic_product_list.xhtml</from-view-id>
<navigation-case>
/>
<f:selectItems
- value="#{categoryListController.allCategories}"
+ value="#{productCategoryListController.allProductCategories}"
var="category"
itemValue="#{category}"
itemLabel="#{productBeanHelper.renderProductCategory(category)}"
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ 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="#{product.ADMIN_PRODUCT_CATEGORY_DATA_LEGEND}">
+ <p:panelGrid
+ layout="grid"
+ columns="2"
+ columnClasses="ui-grid-col-4,ui-grid-col-8"
+ styleClass="ui-noborder"
+ >
+ <p:outputLabel for="parentCategory" value="#{product.ADMIN_ASSIGN_PARENT_PRODUCT_CATEGORY}" />
+ <p:selectOneMenu
+ id="parentCategory"
+ value="#{adminProductCategoryActionController.parentCategory}"
+ filter="true"
+ filterMatchMode="contains"
+ title="#{product.ADMIN_ASSIGN_PARENT_PRODUCT_CATEGORY_TITLE}"
+ >
+
+ <f:converter converterId="ProductCategoryConverter" />
+
+ <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
+
+ <f:selectItems
+ value="#{productCategoryListController.allProductCategories}"
+ var="category"
+ itemValue="#{category}"
+ itemLabel="#{productBeanHelper.renderProductCategory(category)}"
+ />
+ </p:selectOneMenu>
+
+ <p:outputLabel for="categoryI18nKey" value="#{product.ADMIN_ENTER_CATEGORY_I18N_KEY}" />
+ <p:inputText
+ id="categoryI18nKey"
+ value="#{adminProductCategoryActionController.categoryI18nKey}"
+ maxlength="255"
+ required="true"
+ requiredMessage="#{product.ADMIN_CATEGORY_I18N_KEY_REQUIRED}"
+ title="#{product.ADMIN_ENTER_CATEGORY_I18N_KEY_TITLE}"
+ validatorMessage="#{product.ADMIN_ENTERED_CATEGORY_I18N_KEY_ALREADY_ADDED}"
+ >
+ <f:validator validatorId="ProductCategoryValidator" />
+ </p:inputText>
+
+ <p:outputLabel for="categoryShownInStatistics" value="#{product.ADMIN_ENABLE_CATEGORY_IN_STATISTICS}" />
+ <p:selectBooleanCheckbox
+ id="categoryShownInStatistics"
+ value="#{adminProductCategoryActionController.categoryShownInStatistics}"
+ required="true"
+ requiredMessage="#{product.ADMIN_ENABLE_CATEGORY_IN_STATISTICS_REQUIRED}"
+ title="#{product.ADMIN_ENABLE_CATEGORY_IN_STATISTICS_TITLE}"
+ />
+ </p:panelGrid>
+ </p:fieldset>
+</ui:composition>
<f:converter converterId="ProductCategoryConverter" />
<f:selectItems
- value="#{categoryListController.allCategories}"
+ value="#{productCategoryListController.allProductCategories}"
var="category"
itemValue="#{category}"
itemLabel="#{productBeanHelper.renderProductCategory(category)}"
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<ui:composition
+ template="/WEB-INF/templates/admin/admin_base.tpl"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ xmlns:p="http://primefaces.org/ui"
+ >
+
+ <ui:define name="metadata">
+ <f:metadata>
+ <f:viewParam
+ name="categoryId"
+ value="#{adminProductCategoryActionController.currentCategory}"
+ converter="ProductCategoryConverter"
+ required="true"
+ requiredMessage="#{product.ERROR_PARAMETER_CATEGORY_ID_NOT_SET}"
+ converterMessage="#{product.PARAMETER_CATEGORY_ID_INVALID}"
+ />
+
+ <f:viewAction
+ action="#{adminProductCategoryActionController.copyAllCategoryProperties()}"
+ />
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="document_admin_title">
+ <h:outputText value="#{product.PAGE_TITLE_ADMIN_PRODUCT_CATEGORY_EDIT}" />
+ </ui:define>
+
+ <ui:define name="content_header">
+ <h:outputText value="#{product.CONTENT_TITLE_ADMIN_PRODUCT_CATEGORY_EDIT}" />
+ </ui:define>
+
+ <ui:define name="content">
+ <h:form
+ id="admin-form-edit-generic-product"
+ rendered="#{not empty adminProductCategoryActionController.currentCategory}"
+ >
+ <h:inputHidden value="#{adminProductCategoryActionController.categoryId}" />
+
+ <p:panelGrid
+ columns="1"
+ layout="grid"
+ >
+ <f:facet name="header">
+ <h:outputFormat
+ value="#{product.ADMIN_EDIT_PRODUCT_CATEGORY_TITLE}"
+ title="#{local[adminProductCategoryActionController.categoryI18nKey]}"
+ >
+ <f:param value="#{adminProductCategoryActionController.categoryId}" />
+ </h:outputFormat>
+ </f:facet>
+
+ <h:panelGroup styleClass="para" layout="block">
+ <h:outputText value="#{product.ADMIN_EDIT_PRODUCT_CATEGORY_MINIMUM_DATA}" />
+ </h:panelGroup>
+
+ <ui:include src="/WEB-INF/templates/admin/product_category/admin_form_generic_product_data.tpl" />
+
+ <f:facet name="footer">
+ <p:panelGrid columns="2" layout="grid">
+ <p:commandButton
+ type="reset"
+ value="#{msg.BUTTON_RESET_FORM}"
+ />
+
+ <p:commandButton
+ type="submit"
+ value="#{product.BUTTON_ADMIN_EDIT_PRODUCT_CATEGORY}"
+ action="#{adminProductCategoryActionController.updateCategory()}"
+ />
+ </p:panelGrid>
+ </f:facet>
+ </p:panelGrid>
+ </h:form>
+ </ui:define>
+</ui:composition>
<p:dataTable
id="categoryList"
var="category"
- value="#{categoryListController.allCategories}"
+ value="#{productCategoryListController.allProductCategories}"
paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
- filteredValue="#{categoryListController.filteredCategories}"
+ filteredValue="#{productCategoryListController.filteredProductCategories}"
rows="10"
rowKey="#{category.categoryId}"
reflow="true"
emptyMessage="#{product.ADMIN_EMPTY_LIST_PRODUCT_CATEGORIES}"
widgetVar="categoryList"
selectionMode="single"
- selection="#{categoryListController.selectedCategory}"
+ selection="#{productCategoryListController.selectedCategory}"
skipChildren="true"
>
<f:converter converterId="ProductCategoryConverter" />
<f:selectItems
- value="#{categoryListController.allCategories}"
+ value="#{productCategoryListController.allProductCategories}"
var="category"
itemValue="#{category}"
itemLabel="#{productBeanHelper.renderProductCategory(category)}"
responsive="true"
>
<p:outputPanel id="category-details">
- <p:panelGrid columns="2" rendered="#{not empty categoryListController.selectedCategory}">
+ <p:panelGrid columns="2" rendered="#{not empty productCategoryListController.selectedCategory}">
<f:facet name="header">
<h:outputFormat value="#{product.ADMIN_CATEGORY_DETAILS_HEADER}">
- <f:param value="#{local[categoryListController.selectedCategory.categoryI18nKey]}" />
- <f:param value="#{categoryListController.selectedCategory.categoryId}" />
+ <f:param value="#{local[productCategoryListController.selectedCategory.categoryI18nKey]}" />
+ <f:param value="#{productCategoryListController.selectedCategory.categoryId}" />
</h:outputFormat>
</f:facet>
<p:outputLabel value="#{msg.ID_HEADER}" title="#{product.CATEGORY_ID_NUMBER_TITLE}" />
- <h:outputText value="#{categoryListController.selectedCategory.categoryId}" />
+ <h:outputText value="#{productCategoryListController.selectedCategory.categoryId}" />
<p:outputLabel value="#{msg.ADMIN_I18N_KEY_HEADER}" title="#{product.CATEGORY_I18N_KEY_TITLE}" />
- <h:outputText value="#{categoryListController.selectedCategory.categoryI18nKey}" title="#{local[categoryListController.selectedCategory.categoryI18nKey]}" />
+ <h:outputText value="#{productCategoryListController.selectedCategory.categoryI18nKey}" title="#{local[productCategoryListController.selectedCategory.categoryI18nKey]}" />
<p:outputLabel value="#{product.CATEGORY_IN_STATISTICS_HEADER}" title="#{product.CATEGORY_SHOW_IN_STATISTICS_TITLE}" />
- <h:outputText value="#{categoryListController.selectedCategory.categoryShownInStatistics ? msg.CHOICE_YES : msg.CHOICE_NO}" />
+ <h:outputText value="#{productCategoryListController.selectedCategory.categoryShownInStatistics ? msg.CHOICE_YES : msg.CHOICE_NO}" />
<p:outputLabel value="#{product.CATEGORY_PARENT_HEADER}" title="#{product.CATEGORY_PARENT_TITLE}" />
<p:link
outcome="admin_show_product_category"
- value="#{local[categoryListController.selectedCategory.parentCategory.categoryI18nKey]}"
+ value="#{local[productCategoryListController.selectedCategory.parentCategory.categoryI18nKey]}"
title="#{product.ADMIN_LINK_SHOW_PRODUCT_CATEGORY_TITLE}"
- rendered="#{not empty categoryListController.selectedCategory.parentCategory}"
+ rendered="#{not empty productCategoryListController.selectedCategory.parentCategory}"
>
- <f:param name="categoryId" value="#{categoryListController.selectedCategory.parentCategory.categoryId}" />
+ <f:param name="categoryId" value="#{productCategoryListController.selectedCategory.parentCategory.categoryId}" />
</p:link>
- <h:outputText value="#{product.CATEGORY_HAS_NO_PARENT}" rendered="#{empty categoryListController.selectedCategory.parentCategory}" />
+ <h:outputText value="#{product.CATEGORY_HAS_NO_PARENT}" rendered="#{empty productCategoryListController.selectedCategory.parentCategory}" />
<p:outputLabel value="#{msg.ENTRY_CREATED_HEADER}" title="#{product.ADMIN_CATEGORY_ENTRY_CREATED_TITLE}" />
- <h:outputText value="#{categoryListController.selectedCategory.categoryEntryCreated}">
+ <h:outputText value="#{productCategoryListController.selectedCategory.categoryEntryCreated}">
<f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
</h:outputText>
<p:outputLabel value="#{msg.ENTRY_UPDATED_HEADER}" title="#{product.ADMIN_CATEGORY_ENTRY_UPDATED_TITLE}" />
- <h:outputText value="#{categoryListController.selectedCategory.categoryEntryUpdated}">
+ <h:outputText value="#{productCategoryListController.selectedCategory.categoryEntryUpdated}">
<f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
</h:outputText>
</p:panelGrid>
<h:outputText value="#{product.ADMIN_ADD_PRODUCT_CATEGORY_MINIMUM_DATA}" />
</h:panelGroup>
- <p:fieldset legend="#{product.ADMIN_PRODUCT_CATEGORY_DATA_LEGEND}">
- <p:panelGrid
- layout="grid"
- columns="2"
- columnClasses="ui-grid-col-4,ui-grid-col-8"
- styleClass="ui-noborder"
- >
- <p:outputLabel for="parentCategory" value="#{product.ADMIN_ASSIGN_PARENT_PRODUCT_CATEGORY}" />
- <p:selectOneMenu
- id="parentCategory"
- value="#{adminCategoryController.parentCategory}"
- filter="true"
- filterMatchMode="contains"
- title="#{product.ADMIN_ASSIGN_PARENT_PRODUCT_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)}"
- />
- </p:selectOneMenu>
-
- <p:outputLabel for="categoryI18nKey" value="#{product.ADMIN_ENTER_CATEGORY_I18N_KEY}" />
- <p:inputText
- id="categoryI18nKey"
- value="#{adminCategoryController.categoryI18nKey}"
- maxlength="255"
- required="true"
- requiredMessage="#{product.ADMIN_CATEGORY_I18N_KEY_REQUIRED}"
- title="#{product.ADMIN_ENTER_CATEGORY_I18N_KEY_TITLE}"
- validatorMessage="#{product.ADMIN_ENTERED_CATEGORY_I18N_KEY_ALREADY_ADDED}"
- >
- <f:validator validatorId="ProductCategoryValidator" />
- </p:inputText>
-
- <p:outputLabel for="categoryShownInStatistics" value="#{product.ADMIN_ENABLE_CATEGORY_IN_STATISTICS}" />
- <p:selectBooleanCheckbox
- id="categoryShownInStatistics"
- value="#{adminCategoryController.categoryShownInStatistics}"
- required="true"
- requiredMessage="#{product.ADMIN_ENABLE_CATEGORY_IN_STATISTICS_REQUIRED}"
- title="#{product.ADMIN_ENABLE_CATEGORY_IN_STATISTICS_TITLE}"
- />
- </p:panelGrid>
- </p:fieldset>
+ <ui:include src="/WEB-INF/templates/admin/product_category/admin_form_generic_product_data.tpl" />
<f:facet name="footer">
<p:panelGrid columns="2" layout="grid">