]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Fri, 25 Sep 2015 12:34:15 +0000 (14:34 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 25 Sep 2015 12:34:15 +0000 (14:34 +0200)
- 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 <f:selectItem /> 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 <roland@mxchange.org>

lib/jcore.jar
lib/jcoreee.jar
lib/jshop-core.jar
lib/jshop-ee-lib.jar
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java
src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java
web/WEB-INF/templates/admin/admin_category_selection_box.tpl
web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl

index 2223e57f31b8a3d8f755f4d75191b1e49172076b..a59d0c6d95b82ca1a27d0f31a2525956e8ba2819 100644 (file)
Binary files a/lib/jcore.jar and b/lib/jcore.jar differ
index 37a902e7e287344bf9e0d02609a517bc832822dc..648886a7db3c89adffaf81a8a240feabc2ae530a 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
index 539bac1dd5b4261de6f544241490c07f02820210..95145fbb52578c38bb7fb40734674103bf1fd9b4 100644 (file)
Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ
index fd9eff88281d61484ea708bcc35363f55d3fd80b..780a05cc5b021339a9863f60c0bee0a9ba6f471d 100644 (file)
Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ
index 3232a844592b39afff9dbd3a85ca96962aa337a5..ba3a64455f6e0150319f1d02236e6cfc74a6fbf4 100644 (file)
@@ -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);
index b9ccd5cc34f29ecca2b2a0e76be371e96e87f787..eb9469879609214d7551db619525eeff79f17d8b 100644 (file)
@@ -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;
        }
 
index cc6c07eab110efa8cbc6a2560054d74795447401..cdc51756e4f1580399add8bfa194e09c6f6287c7 100644 (file)
@@ -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
index 8c6b654c95add380bf6cfee58152b8699954927f..49392973d5076e4595e04c2c3762532375c4e8f4 100644 (file)
@@ -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<Product> getAllProducts () throws FaceletException {
                // Call bean
-               return this.productBean.getAllProducts();
+               return this.productRemoteBean.getAllProducts();
        }
 
        @Override
index 5ed8e8a3caeaa387d2afcbf3d01897d4ea872e86..1dd2ac5040c1fcc2473b5f05787899134ef48591 100644 (file)
@@ -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<Category> getAllCategoriesParent () throws FaceletException {
                // Get regular list
-               List<Category> 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<Category> list = new LinkedList<>(this.getAllCategories());
 
                // Return it
                return list;
index d91cc209e1bbb275475559fdc752a11e41e43e2e..9235e9524fef8dc8e89c8d05807a57f628ee32dd 100644 (file)
@@ -4,8 +4,8 @@
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
 
-       <h:selectOneMenu class="select" id="parentId" value="#{admin_product.productCategory}" required="true" requiredMessage="#{msg.ADMIN_CATEGORY_MUST_BE_SELECTED}">
-               <f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat.categoryId}" itemLabel="#{cat.categoryTitle}" />
-               <f:validateLongRange for="parentId" minimum="0" maximum="1000" />
+       <h:selectOneMenu class="select" id="productCategory" value="#{admin_product.productCategory}" required="true" requiredMessage="#{msg.ADMIN_CATEGORY_MUST_BE_SELECTED}" converter="category">
+               <f:selectItems value="#{controller.allCategories}" var="cat" itemValue="#{cat}" itemLabel="#{cat.categoryTitle}" />
+               <f:validateLongRange for="productCategory" minimum="0" maximum="1000" />
        </h:selectOneMenu>
 </ui:composition>
index 15ce79e404f5bcf2097b37a594f29f2636eefe44..94fb50b535ace0907c3e1059d71ad280978ad07c 100644 (file)
@@ -4,7 +4,8 @@
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://java.sun.com/jsf/facelets">
 
-       <h:selectOneMenu class="select" id="parentId" value="#{admin_category.parentCategory}" required="true" requiredMessage="#{msg.ADMIN_PARENT_CATEGORY_CANNOT_BE_NULL}">
+       <h:selectOneMenu class="select" id="parentCategory" value="#{admin_category.parentCategory}">
+               <f:selectItem itemValue="" itemLabel="#{msg.ADMIN_CATEGORY_HAS_NO_PARENT}" />
                <f:selectItems value="#{controller.allCategoriesParent}" var="parent_category" itemValue="#{parent_category.categoryId}" itemLabel="#{parent_category.categoryTitle}" />
        </h:selectOneMenu>
 </ui:composition>