From: Roland Haeder Date: Fri, 25 Sep 2015 12:34:15 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=266c973f81895eae08fdb5f537d5b5bc2894f137;p=pizzaservice-war.git Continued: - added category converter - updated controller properties to latest API changes (e.g. house number can be Short) - renamed some attributes for better reading - handled over updated objects other beans - added to have a "null category" back, thanks to my teacher - removed no longer "null category" stuff from controller - renamed more in templates - updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcore.jar b/lib/jcore.jar index 2223e57f..a59d0c6d 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 37a902e7..648886a7 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/lib/jshop-core.jar b/lib/jshop-core.jar index 539bac1d..95145fbb 100644 Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ diff --git a/lib/jshop-ee-lib.jar b/lib/jshop-ee-lib.jar index fd9eff88..780a05cc 100644 Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java index 3232a844..ba3a6445 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java @@ -54,7 +54,7 @@ public class AdminCategoryWebBean implements AdminCategoryWebController { * Shop bean */ @Inject - private ShopWebController controller; + private ShopWebController shopController; /////////////////////// Properties ///////////////////// /** @@ -93,10 +93,10 @@ public class AdminCategoryWebBean implements AdminCategoryWebController { category.setCategoryTitle(this.getCategoryTitle()); // Deligate to remote bean - this.categoryBean.doAdminAddCategory(category); + Category updatedCategory = this.categoryBean.doAdminAddCategory(category); // Also send it to the controller bean - this.controller.addCategory(category); + this.shopController.addCategory(updatedCategory); } catch (final CategoryTitleAlreadyUsedException | CannotAddCategoryException ex) { // Continue to throw throw new FaceletException(ex); diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java index b9ccd5cc..eb946987 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java @@ -102,7 +102,7 @@ public class CustomerWebBean implements CustomerWebController { /** * House number */ - private Long houseNumber; + private Short houseNumber; /** * Phone number @@ -261,12 +261,12 @@ public class CustomerWebBean implements CustomerWebController { } @Override - public Long getHouseNumber () { + public Short getHouseNumber () { return this.houseNumber; } @Override - public void setHouseNumber (final Long houseNumber) { + public void setHouseNumber (final Short houseNumber) { this.houseNumber = houseNumber; } diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java index cc6c07ea..cdc51756 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java @@ -165,14 +165,14 @@ public interface CustomerWebController extends Serializable { * * @return the houseNumber */ - public Long getHouseNumber (); + public Short getHouseNumber (); /** * House number * * @param houseNumber the houseNumber to set */ - public void setHouseNumber (final Long houseNumber); + public void setHouseNumber (final Short houseNumber); /** * Phone number diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java index 8c6b654c..49392973 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java @@ -49,14 +49,14 @@ public class AdminProductWebBean implements AdminProductWebController { /** * Remote bean for products */ - private final AdminProductSessionBeanRemote productBean; + private final AdminProductSessionBeanRemote productRemoteBean; ////////////////////// Bean injections /////////////////////// /** * Shop bean */ @Inject - private ShopWebController controller; + private ShopWebController shopController; /////////////////////// Properties ///////////////////// /** @@ -89,7 +89,7 @@ public class AdminProductWebBean implements AdminProductWebController { Context context = new InitialContext(); // Try to lookup the bean - this.productBean = (AdminProductSessionBeanRemote) context.lookup("ejb/stateless-admin-product"); //NOI18N + this.productRemoteBean = (AdminProductSessionBeanRemote) context.lookup("ejb/stateless-admin-product"); //NOI18N } catch (final NamingException e) { // Throw it again throw new FaceletException(e); @@ -109,10 +109,10 @@ public class AdminProductWebBean implements AdminProductWebController { product.setProductTitle(this.getProductTitle()); // Call bean - this.productBean.doAdminAddProduct(product); + Product updatedProduct = this.productRemoteBean.doAdminAddProduct(product); // Add to shop controller - this.controller.addProduct(product); + this.shopController.addProduct(updatedProduct); // Set all to null this.setProductAvailability(Boolean.FALSE); @@ -128,7 +128,7 @@ public class AdminProductWebBean implements AdminProductWebController { @Override public List getAllProducts () throws FaceletException { // Call bean - return this.productBean.getAllProducts(); + return this.productRemoteBean.getAllProducts(); } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java index 5ed8e8a3..1dd2ac50 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java @@ -29,7 +29,6 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jshopcore.model.category.Category; import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote; -import org.mxchange.jshopcore.model.category.ProductCategory; import org.mxchange.jshopcore.model.product.Product; import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote; import org.mxchange.pizzaapplication.beans.AbstractWebBean; @@ -83,17 +82,7 @@ public class ShopWebBean extends AbstractWebBean implements ShopWebController { @Override public List getAllCategoriesParent () throws FaceletException { // Get regular list - List list = new LinkedList<>(); - - // Create null category - Category nullCategory = new ProductCategory(); - nullCategory.setCategoryTitle(this.getMessageStringFromKey("ADMIN_CATEGORY_HAS_NO_PARENT")); //NOI18N - - // Add it - list.add(nullCategory); - - // Add all - list.addAll(this.getAllCategories()); + List list = new LinkedList<>(this.getAllCategories()); // Return it return list; diff --git a/web/WEB-INF/templates/admin/admin_category_selection_box.tpl b/web/WEB-INF/templates/admin/admin_category_selection_box.tpl index d91cc209..9235e952 100644 --- a/web/WEB-INF/templates/admin/admin_category_selection_box.tpl +++ b/web/WEB-INF/templates/admin/admin_category_selection_box.tpl @@ -4,8 +4,8 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> - - - + + + diff --git a/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl b/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl index 15ce79e4..94fb50b5 100644 --- a/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl +++ b/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl @@ -4,7 +4,8 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> - + +