]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Wed, 9 Sep 2015 09:19:59 +0000 (11:19 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 9 Sep 2015 09:19:59 +0000 (11:19 +0200)
- added controller for products and categories (both admin)
- updated jcore-ee-logger.jar + updated jshop-ee-lib.jar
Signed-off-by:Roland Häder <roland@mxchange.org>

lib/jcore-ee-logger.jar
lib/jshop-ee-lib.jar
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/controller/AdminProductWebController.java [deleted file]
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java [new file with mode: 0644]

index 5b54c7d62bdde3ebaa2ee7121b7a5af6f59b349a..6a5ff51e99f32a7569a071da9273c33111266a92 100644 (file)
Binary files a/lib/jcore-ee-logger.jar and b/lib/jcore-ee-logger.jar differ
index 657fb7073717301d8fdc08ac57eb98bd8307e0a2..1697bcc77c63dcbdd0b94e3b806e76bb364a1671 100644 (file)
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
new file mode 100644 (file)
index 0000000..240437b
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.category;
+
+import java.rmi.RemoteException;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.category.Category;
+import org.mxchange.jshopcore.model.category.CategorySessionBeanRemote;
+
+/**
+ * Main application class
+ *
+ * @author Roland Haeder
+ */
+@Named("admin_category")
+@SessionScoped
+public class AdminCategoryWebBean extends BaseFrameworkBean implements AdminCategoryWebController {
+       /**
+        * Serial id
+        */
+       private static final long serialVersionUID = 5_819_375_183_472_871L;
+
+       /**
+        * Remote bean for categories
+        */
+       private final CategorySessionBeanRemote category;
+
+       /**
+        * Default constructor
+        * 
+        * @throws javax.naming.NamingException Something happened here?
+        */
+       public AdminCategoryWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup the bean
+               this.category = (CategorySessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
+       }
+
+       @Override
+       public void doAdminAddCategory (final Category category) throws FaceletException {
+               try {
+                       // Deligate to bean
+                       this.category.doAdminAddCategory(category);
+               } catch (final RemoteException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java
new file mode 100644 (file)
index 0000000..c38dcdb
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.category;
+
+import javax.faces.view.facelets.FaceletException;
+import org.mxchange.jshopcore.model.category.Category;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ *
+ * @author Roland Haeder
+ */
+public interface AdminCategoryWebController {
+
+       /**
+        * Adds given category data from request to database
+        *
+        * @param category Category instance
+        * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
+        */
+       public void doAdminAddCategory (final Category category) throws FaceletException;
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/controller/AdminProductWebController.java b/src/java/org/mxchange/pizzaapplication/beans/controller/AdminProductWebController.java
deleted file mode 100644 (file)
index 6000979..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2015 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.beans.controller;
-
-import java.util.Deque;
-import javax.faces.view.facelets.FaceletException;
-import org.mxchange.jshopcore.model.category.Category;
-import org.mxchange.jshopcore.model.product.Product;
-
-/**
- * An interface for product controllers for "ADMIN" role
- *
- * @author Roland Haeder
- */
-public interface AdminProductWebController {
-
-       /**
-        * Adds given category data from request to database
-        *
-        * @param category Category instance
-        * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
-        */
-       public void doAdminAddCategory (final Category category) throws FaceletException;
-
-       /**
-        * Adds given product data from request to database
-        *
-        * @param product Product instance
-        * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
-        */
-       public void doAdminAddProduct (final Product product) throws FaceletException;
-
-       /**
-        * Some "getter" for a linked list of all products
-        *
-        * @return All products
-        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
-        */
-       public Deque<Product> getAllProducts () throws FaceletException;
-}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebBean.java
new file mode 100644 (file)
index 0000000..0792c6b
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.product;
+
+import java.rmi.RemoteException;
+import java.util.Deque;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreee.beans.BaseFrameworkBean;
+import org.mxchange.jshopcore.model.product.Product;
+import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote;
+
+/**
+ * Main application class
+ *
+ * @author Roland Haeder
+ */
+@Named("admin_product")
+@SessionScoped
+public class AdminProductWebBean extends BaseFrameworkBean implements AdminProductWebController {
+       /**
+        * Serial id
+        */
+       private static final long serialVersionUID = 5_819_375_183_472_871L;
+
+       /**
+        * Remote bean for products
+        */
+       private final ProductSessionBeanRemote product;
+
+       /**
+        * Default constructor
+        * 
+        * @throws javax.naming.NamingException Something happened here?
+        */
+       public AdminProductWebBean () throws NamingException {
+               // Get initial context
+               InitialContext context = new InitialContext();
+
+               // Try to lookup the bean
+               this.product = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N
+       }
+
+       @Override
+       public void doAdminAddProduct (final Product product) throws FaceletException {
+               // Call bean
+               this.product.doAdminAddProduct(product);
+       }
+
+       @Override
+       public Deque<Product> getAllProducts () throws FaceletException {
+               try {
+                       // Call bean
+                       return this.product.getAllProducts();
+               } catch (final RemoteException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java
new file mode 100644 (file)
index 0000000..a77b18d
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.beans.product;
+
+import java.util.Deque;
+import javax.faces.view.facelets.FaceletException;
+import org.mxchange.jshopcore.model.product.Product;
+
+/**
+ * An interface for product controllers for "ADMIN" role
+ *
+ * @author Roland Haeder
+ */
+public interface AdminProductWebController {
+
+       /**
+        * Adds given product data from request to database
+        *
+        * @param product Product instance
+        * @throws javax.faces.view.facelets.FaceletException If something unexpected happened
+        */
+       public void doAdminAddProduct (final Product product) throws FaceletException;
+
+       /**
+        * Some "getter" for a linked list of all products
+        *
+        * @return All products
+        * @throws javax.faces.view.facelets.FaceletException If anything went wrong
+        */
+       public Deque<Product> getAllProducts () throws FaceletException;
+}