]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Product-only:
authorRoland Häder <roland@mxchange.org>
Thu, 23 Apr 2020 01:10:30 +0000 (03:10 +0200)
committerRoland Häder <roland@mxchange.org>
Thu, 23 Apr 2020 01:10:30 +0000 (03:10 +0200)
- moved converter to deeper packages
- some renderFoo() methods have extra parameters, added

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java [deleted file]
src/java/org/mxchange/jfinancials/converter/product/generic_product/FinancialsGenericProductConverter.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/converter/product/product_category/FinancialsProductCategoryConverter.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java [deleted file]
web/WEB-INF/templates/admin/generic_product/admin_form_generic_product_data.tpl
web/admin/generic_product/admin_generic_product_list.xhtml

diff --git a/src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java b/src/java/org/mxchange/jfinancials/converter/generic_product/FinancialsGenericProductConverter.java
deleted file mode 100644 (file)
index cfb67b0..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.converter.generic_product;
-
-import javax.enterprise.inject.spi.CDI;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.convert.FacesConverter;
-import org.mxchange.jfinancials.beans.generic_product.list.FinancialsProductListWebViewBean;
-import org.mxchange.jfinancials.beans.generic_product.list.FinancialsProductListWebViewController;
-import org.mxchange.jproduct.exceptions.product.ProductNotFoundException;
-import org.mxchange.jproduct.model.product.Product;
-
-/**
- * Converter for product id <-> valid product instance
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesConverter ("GenericProductConverter")
-public class FinancialsGenericProductConverter implements Converter<Product> {
-
-       /**
-        * Product backing bean
-        */
-       private static FinancialsProductListWebViewController PRODUCT_LIST_CONTROLLER;
-
-       @Override
-       public Product getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == PRODUCT_LIST_CONTROLLER) {
-                       // Get bean from CDI directly
-                       PRODUCT_LIST_CONTROLLER = CDI.current().select(FinancialsProductListWebViewBean.class).get();
-               }
-
-               // Is the value null or empty?
-               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
-                       // Return null
-                       return null;
-               }
-
-               // Init instance
-               Product product = null;
-
-               try {
-                       // Try to parse the value as long
-                       final Long productId = Long.valueOf(submittedValue);
-
-                       // Try to get user instance from it
-                       product = PRODUCT_LIST_CONTROLLER.findProductById(productId);
-               } catch (final NumberFormatException ex) {
-                       // Throw again
-                       throw new ConverterException(ex);
-               } catch (final ProductNotFoundException ex) {
-                       // Debug message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex)); //NOI18N
-               }
-
-               // Return it
-               return product;
-       }
-
-       @Override
-       public String getAsString (final FacesContext context, final UIComponent component, final Product value) {
-               // Is the object null?
-               if ((null == value) || (String.valueOf(value).isEmpty())) {
-                       // Is null
-                       return ""; //NOI18N
-               }
-
-               // Return id number
-               return String.valueOf(value.getProductId());
-       }
-
-}
diff --git a/src/java/org/mxchange/jfinancials/converter/product/generic_product/FinancialsGenericProductConverter.java b/src/java/org/mxchange/jfinancials/converter/product/generic_product/FinancialsGenericProductConverter.java
new file mode 100644 (file)
index 0000000..ba66faf
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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.converter.product.generic_product;
+
+import javax.enterprise.inject.spi.CDI;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import org.mxchange.jfinancials.beans.generic_product.list.FinancialsProductListWebViewBean;
+import org.mxchange.jfinancials.beans.generic_product.list.FinancialsProductListWebViewController;
+import org.mxchange.jproduct.exceptions.product.ProductNotFoundException;
+import org.mxchange.jproduct.model.product.Product;
+
+/**
+ * Converter for product id <-> valid product instance
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter ("GenericProductConverter")
+public class FinancialsGenericProductConverter implements Converter<Product> {
+
+       /**
+        * Product backing bean
+        */
+       private static FinancialsProductListWebViewController PRODUCT_LIST_CONTROLLER;
+
+       @Override
+       public Product getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Warning message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init instance
+               Product product = null;
+
+               // Is the instance there?
+               if (null == PRODUCT_LIST_CONTROLLER) {
+                       // Get bean from CDI directly
+                       PRODUCT_LIST_CONTROLLER = CDI.current().select(FinancialsProductListWebViewBean.class).get();
+               }
+
+               try {
+                       // Try to parse the value as long
+                       final Long productId = Long.valueOf(submittedValue);
+
+                       // Try to get user instance from it
+                       product = PRODUCT_LIST_CONTROLLER.findProductById(productId);
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final ProductNotFoundException ex) {
+                       // Debug message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex)); //NOI18N
+               }
+
+               // Return it
+               return product;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Product value) {
+               // Is the object null?
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               }
+
+               // Return id number
+               return String.valueOf(value.getProductId());
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/converter/product/product_category/FinancialsProductCategoryConverter.java b/src/java/org/mxchange/jfinancials/converter/product/product_category/FinancialsProductCategoryConverter.java
new file mode 100644 (file)
index 0000000..e6484e3
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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.converter.product.product_category;
+
+import javax.enterprise.inject.spi.CDI;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import org.mxchange.jfinancials.beans.product_category.list.FinancialsCategoryListWebViewBean;
+import org.mxchange.jfinancials.beans.product_category.list.FinancialsCategoryListWebViewController;
+import org.mxchange.jproduct.exceptions.category.CategoryNotFoundException;
+import org.mxchange.jproduct.model.category.Category;
+
+/**
+ * Converter for category id <-> valid category instance
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@FacesConverter ("ProductCategoryConverter")
+public class FinancialsProductCategoryConverter implements Converter<Category> {
+
+       /**
+        * Category backing bean
+        */
+       private static FinancialsCategoryListWebViewController CATEGORY_LIST_CONTROLLER;
+
+       @Override
+       public Category getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Warning message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init instance
+               Category category = null;
+
+               // Is the instance there?
+               if (null == CATEGORY_LIST_CONTROLLER) {
+                       // Get bean from CDI directly
+                       CATEGORY_LIST_CONTROLLER = CDI.current().select(FinancialsCategoryListWebViewBean.class).get();
+               }
+
+               try {
+                       // Try to parse the value as long
+                       final Long categoryId = Long.valueOf(submittedValue);
+
+                       // Try to get user instance from it
+                       category = CATEGORY_LIST_CONTROLLER.findCategoryById(categoryId);
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final CategoryNotFoundException ex) {
+                       // Debug message
+                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex)); //NOI18N
+               }
+
+               // Return it
+               return category;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Category value) {
+               // Is the object null?
+               if ((null == value) || (String.valueOf(value).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               }
+
+               // Return id number
+               return String.valueOf(value.getCategoryId());
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java b/src/java/org/mxchange/jfinancials/converter/product_category/FinancialsProductCategoryConverter.java
deleted file mode 100644 (file)
index 8d4cb67..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.converter.product_category;
-
-import javax.enterprise.inject.spi.CDI;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.convert.FacesConverter;
-import org.mxchange.jfinancials.beans.product_category.list.FinancialsCategoryListWebViewBean;
-import org.mxchange.jfinancials.beans.product_category.list.FinancialsCategoryListWebViewController;
-import org.mxchange.jproduct.exceptions.category.CategoryNotFoundException;
-import org.mxchange.jproduct.model.category.Category;
-
-/**
- * Converter for category id <-> valid category instance
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@FacesConverter ("ProductCategoryConverter")
-public class FinancialsProductCategoryConverter implements Converter<Category> {
-
-       /**
-        * Category backing bean
-        */
-       private static FinancialsCategoryListWebViewController CATEGORY_LIST_CONTROLLER;
-
-       @Override
-       public Category getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == CATEGORY_LIST_CONTROLLER) {
-                       // Get bean from CDI directly
-                       CATEGORY_LIST_CONTROLLER = CDI.current().select(FinancialsCategoryListWebViewBean.class).get();
-               }
-
-               // Is the value null or empty?
-               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
-                       // Return null
-                       return null;
-               }
-
-               // Init instance
-               Category category = null;
-
-               try {
-                       // Try to parse the value as long
-                       final Long categoryId = Long.valueOf(submittedValue);
-
-                       // Try to get user instance from it
-                       category = CATEGORY_LIST_CONTROLLER.findCategoryById(categoryId);
-               } catch (final NumberFormatException ex) {
-                       // Throw again
-                       throw new ConverterException(ex);
-               } catch (final CategoryNotFoundException ex) {
-                       // Debug message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex)); //NOI18N
-               }
-
-               // Return it
-               return category;
-       }
-
-       @Override
-       public String getAsString (final FacesContext context, final UIComponent component, final Category value) {
-               // Is the object null?
-               if ((null == value) || (String.valueOf(value).isEmpty())) {
-                       // Is null
-                       return ""; //NOI18N
-               }
-
-               // Return id number
-               return String.valueOf(value.getCategoryId());
-       }
-
-}
index 1c4903cf655929bc687e03747d8c23bc3d8e63ec..c016be80170b9b74a64a67c157a55aa4a68833e2 100644 (file)
                                        value="#{basicDataListController.allBasicData}"
                                        var="basicData"
                                        itemValue="#{basicData}"
-                                       itemLabel="#{beanHelper.renderBasicData(basicData, true)}"
+                                       itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}"
                                        />
                        </p:selectOneMenu>
 
index 79e12d4fa7de7e10c1b601b2e61f9350812cd956..8343e6f8ed79d1f57a31f2f0bd1e4c931b3f73b4 100644 (file)
                                                                value="#{basicDataListController.allBasicData}"
                                                                var="basicData"
                                                                itemValue="#{basicData}"
-                                                               itemLabel="#{beanHelper.renderBasicData(basicData, true)}"
+                                                               itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}"
                                                                />
                                                </p:selectCheckboxMenu>
                                        </f:facet>
 
                                        <p:link
                                                outcome="admin_show_basic_data"
-                                               value="#{beanHelper.renderBasicData(genericProduct.productManufacturer, true)}"
+                                               value="#{beanHelper.renderBasicData(genericProduct.productManufacturer, true, false)}"
                                                title="#{msg.ADMIN_LINK_SHOW_BASIC_DATA_TITLE}"
                                                rendered="#{not empty genericProduct.productManufacturer}"
                                                >