2 * Copyright (C) 2015 Roland Haeder
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.pizzaapplication.beans.controller;
19 import java.io.IOException;
20 import java.lang.reflect.InvocationTargetException;
21 import java.rmi.RemoteException;
22 import java.sql.SQLException;
23 import java.util.Deque;
24 import java.util.Iterator;
25 import javax.annotation.PostConstruct;
26 import javax.enterprise.context.SessionScoped;
27 import javax.faces.FacesException;
28 import javax.inject.Named;
29 import org.mxchange.jcoreee.beans.BaseFrameworkBean;
30 import org.mxchange.jshopcore.exceptions.CategoryTitleAlreadyUsedException;
31 import org.mxchange.jshopcore.exceptions.ProductTitleAlreadyUsedException;
32 import org.mxchange.jshopcore.model.category.Category;
33 import org.mxchange.jshopcore.model.product.Product;
36 * Main application class
38 * @author Roland Haeder
42 public class PizzaServiceWebBean extends BaseFrameworkBean implements PizzaWebBean {
46 private static final long serialVersionUID = 58137539530279L;
52 // Get new application instance
53 this.getLogger().debug("INITIALIZER!"); //NOI18N
59 public PizzaServiceWebBean () {
60 this.getLogger().trace("CALLED!"); //NOI18N
65 public void init () throws FacesException {
67 this.getLogger().trace("CALLED!"); //NOI18N
75 } catch (final SQLException | IOException ex) {
77 throw new FacesException(ex);
82 public Iterator<Product> getAvailableProductsIterator () throws RemoteException {
84 return this.app.getAvailableProductsIterator();
85 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
87 throw new RemoteException("getAvailableProductsIterator() failed", ex);
92 public Iterator<Product> getAllProductsIterator () throws RemoteException {
94 return this.app.getAllProductsIterator();
95 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
97 throw new RemoteException("getAllProductsIterator() failed.", ex);
102 public Deque<Product> getAvailableProducts () throws RemoteException {
104 return this.app.getAvailableProducts();
105 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
107 throw new RemoteException("getAvailableProducts() failed.", ex);
112 public Deque<Product> getAllProducts () throws RemoteException {
114 return this.app.getAllProducts();
115 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
117 throw new RemoteException("getAllProducts() failed", ex);
122 public Iterator<Category> getAllCategoriesIterator () throws RemoteException {
124 return this.app.getAllCategoriesIterator();
125 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
127 throw new RemoteException("getAllCategoriesIterator() failed.", ex);
132 public Deque<Category> getAllCategories () throws RemoteException {
134 return this.app.getAllCategories();
135 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
137 throw new RemoteException("getAllCategories() failed.", ex);
142 public void doAdminAddCategory (final Category category) throws RemoteException, CategoryTitleAlreadyUsedException {
144 this.app.doAdminAddCategory(category);
145 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
147 throw new RemoteException("doAdminAddCategory() failed.", ex);
152 public void doAdminAddProduct (final Product product) throws RemoteException, ProductTitleAlreadyUsedException {
154 this.app.doAdminAddProduct(product);
155 } catch (final IOException | SQLException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
157 throw new RemoteException("doAdminAddProduct() failed.", ex);