--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+}
+++ /dev/null
-/*
- * 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;
-}
--- /dev/null
+/*
+ * 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);
+ }
+ }
+}
--- /dev/null
+/*
+ * 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;
+}