<copyfiles files="${libs.MySQLDriver.classpath}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.log4j-web-2.3.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.jsfcore.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.cdi-api.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${file.reference.commons-lang3-3.4.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<copyfiles files="${libs.MySQLDriver.classpath}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.log4j-web-2.3.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.jsfcore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.cdi-api.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${file.reference.commons-lang3-3.4.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
-build.xml.data.CRC32=1c5f2332
+build.xml.data.CRC32=45780b08
build.xml.script.CRC32=a6f5a733
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=1c5f2332
-nbproject/build-impl.xml.script.CRC32=7b6df8a6
+nbproject/build-impl.xml.data.CRC32=45780b08
+nbproject/build-impl.xml.script.CRC32=0bccd313
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
dist.war=${dist.dir}/${war.name}
endorsed.classpath=
excludes=
+file.reference.cdi-api.jar=lib\\cdi-api.jar
file.reference.commons-codec-1.10.jar=lib/commons-codec-1.10.jar
+file.reference.commons-lang3-3.4.jar=lib\\commons-lang3-3.4.jar
file.reference.jsfcore.jar=lib/jsfcore.jar
file.reference.log4j-api-2.3.jar=lib/log4j-api-2.3.jar
file.reference.log4j-core-2.3.jar=lib/log4j-core-2.3.jar
${file.reference.commons-codec-1.10.jar}:\
${libs.MySQLDriver.classpath}:\
${file.reference.log4j-web-2.3.jar}:\
- ${file.reference.jsfcore.jar}
+ ${file.reference.jsfcore.jar}:\
+ ${file.reference.cdi-api.jar}:\
+ ${file.reference.commons-lang3-3.4.jar}
# Space-separated list of extra javac options
-javac.compilerargs=-Xlint:unchecked
+javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.debug=true
javac.deprecation=true
javac.processorpath=\
<file>${file.reference.jsfcore.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
+ <library dirs="200">
+ <file>${file.reference.cdi-api.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
+ <library dirs="200">
+ <file>${file.reference.commons-lang3-3.4.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
BaseContact.gender.male.text=Herr
BaseContact.gender.female.text=Frau
BaseContact.gender.company.text=Firma
+MiniBasketTag.basket_is_empty=Der Warenkorb ist leer.
BaseContact.gender.male.text=Mr.
BaseContact.gender.female.text=Mrs.
BaseContact.gender.company.text=Company
+MiniBasketTag.basket_is_empty=Der Warenkorb ist leer.
* @param product Product instance
* @param session Session instance
* @return Amount as string
+ * @deprecated Old code
*/
+ @Deprecated
public String getAmountFromSession (final Product product, final HttpSession session);
/**
* @param product Product instance
* @param session Session instance
* @return Choose as string
+ * @deprecated Old code
*/
+ @Deprecated
public String getChooseFromSession (final Product product, final HttpSession session);
/**
* @param request Request instance
* @param session Session instance
* @return Amount as string
+ * @deprecated Old code
*/
+ @Deprecated
public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
/**
* @param request Request instance
* @param session Session instance
* @return Amount as string
+ * @deprecated Old code
*/
+ @Deprecated
public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
/**
* @param request Request instance
* @param session Session instance
* @return Whether the product is choosen
+ * @deprecated Old lost code
*/
+ @Deprecated
public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session);
/**
*
* @param product Product to mark as ordered
* @param session Session instance
+ * @deprecated Old code
*/
+ @Deprecated
public void markProductAsOrdered(final Product product, final HttpSession session);
/**
*
* @param product Product to mark as ordered
* @param session Session instance
+ * @deprecated Old code
*/
+ @Deprecated
public void markProductAsChoosen(final Product product, final HttpSession session);
/**
*
* @param product Product to unmark as ordered
* @param session Session instance
+ * @deprecated Old code
*/
+ @Deprecated
public void unmarkProductAsOrdered(final Product product, final HttpSession session);
/**
*
* @param product Product to unmark as choosen
* @param session Session instance
+ * @deprecated Old code
*/
+ @Deprecated
public void unmarkProductAsChoosen(final Product product, final HttpSession session);
/**
* @param request Request instance
* @param session Session instance
* @throws javax.servlet.ServletException If something unexpected happened
+ * @deprecated Old code
*/
+ @Deprecated
public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException;
/**
import java.io.IOException;
import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Iterator;
-import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.mxchange.jcore.contact.Gender;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
import org.mxchange.pizzaapplication.category.Category;
-import org.mxchange.pizzaapplication.customer.Customer;
-import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend;
import org.mxchange.pizzaapplication.database.frontend.category.PizzaCategoryDatabaseFrontend;
* @author Roland Haeder
*/
public class PizzaServiceApplication extends BasePizzaServiceSystem implements PizzaApplication {
- /**
- * Main title
- */
- public static final String MAIN_TITLE = "Pizza-Service";
-
/**
* Frontend for products
*/
*/
private CategoryFrontend categoryFrontend;
- /**
- * Some singleton getter for this instance. If the instance is not set in
- * given application, it will be created.
- *
- * @param context Servlet context
- * @return This instance
- * @throws javax.servlet.ServletException If object is not set correctly
- */
- public static final PizzaApplication getInstance (final ServletContext context) throws ServletException {
- // Check application instance
- if (null == context) {
- // Not set
- throw new NullPointerException("application is null"); //NOI18N
- }
-
- // Init instance
- PizzaApplication instance = null;
-
- // Get instance from servlet application (aka. "application scope")
- Object object = context.getAttribute("app"); //NOI18N
-
- // Is it set?
- if (object instanceof PizzaApplication) {
- // Instance is set, so casting should work
- instance = (PizzaApplication) object;
-
- // Debug message
- instance.getLogger().debug(MessageFormat.format("Using existing instance {0} ...", object)); //NOI18N
- } else if (object instanceof Object) {
- // Not correct instance
- throw new ServletException("app is not set correctly"); //NOI18N
- } else {
- try {
- // "service" is null, so initialize it
- instance = new PizzaServiceApplication();
- instance.init(context);
-
- // Debug message
- instance.getLogger().debug(MessageFormat.format("Created new instance {0} ...", object)); //NOI18N
- } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) {
- throw new ServletException(ex);
- }
-
- // And set it here
- context.setAttribute("app", instance); //NOI18N
- }
-
+ @Override
+ public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
- instance.getLogger().trace(MessageFormat.format("instance={0} - EXIT!", instance)); //NOI18N
+ this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
- // Return it
- return instance;
- }
-
- /**
- * For debugging purpose
- *
- * @param args Arguments
- */
- public static void main (String[] args) {
- // Get instance and start it
- new PizzaServiceApplication().start();
- }
-
- @Override
- public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException {
- // Temporary initialize default bundle
- // @TODO The JSF may have better internatialization support
- this.initBundle();
+ // Is the bundle initialized?
+ if (!this.isBundledInitialized()) {
+ // Temporary initialize default bundle
+ // @TODO The enum Gender uses this
+ this.initBundle();
+ }
- // Initialize properties from config
+ // Initialize properties from context
this.initProperties(context);
// Init database frontends
this.initDatabaseFrontends();
+
+ // Trace message
+ this.getLogger().trace("EXIT!"); //NOI18N
}
/**
* Default constructor
*/
- private PizzaServiceApplication () {
+ public PizzaServiceApplication () {
}
/**
* @return Amount as string
*/
@Override
+ @Deprecated
public String getAmountFromSession (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
* @return Choose as string
*/
@Override
+ @Deprecated
public String getChooseFromSession (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
* @return Amount as string
*/
@Override
+ @Deprecated
public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N
* @return Amount as string
*/
@Override
+ @Deprecated
public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N
* @return Whether the product is choosen
*/
@Override
+ @Deprecated
public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},request={1},session={2} - CALLED!", product, request, session)); //NOI18N
* @param session Session instance
*/
@Override
+ @Deprecated
public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},session={1} - CALLED!", request, session)); //NOI18N
* @param session Session instance
*/
@Override
+ @Deprecated
public void markProductAsChoosen (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
* @param session Session instance
*/
@Override
+ @Deprecated
public void markProductAsOrdered (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
* @param session Session instance
*/
@Override
+ @Deprecated
public void unmarkProductAsChoosen (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
* @param session Session instance
*/
@Override
+ @Deprecated
public void unmarkProductAsOrdered (final Product product, final HttpSession session) {
// Trace message
this.getLogger().trace(MessageFormat.format("product={0},session={1} - CALLED!", product, session)); //NOI18N
* Initializes database frontends.
*/
private void initDatabaseFrontends () throws UnsupportedDatabaseBackendException, SQLException {
+ // Trace message
+ this.getLogger().trace("CALLED!"); //NOI18N
+
// Product frontend
this.productFrontend = new PizzaProductDatabaseFrontend();
// Category frontend
this.categoryFrontend = new PizzaCategoryDatabaseFrontend();
+
+ // Trace message
+ this.getLogger().trace("EXIT!"); //NOI18N
}
/**
// Trace message
this.getLogger().trace("EXIT!"); //NOI18N
}
-
- /**
- * Application starter
- */
- private void start() {
- // Init bundle
- this.initBundle();
-
- try {
- // Init properties
- this.initProperties();
-
- // And frontends
- this.initDatabaseFrontends();
- } catch (final IOException | UnsupportedDatabaseBackendException | SQLException ex) {
- // Abort here
- this.abortProgramWithException(ex);
- }
-
- // Init instance
- Iterator<Product> iterator = null;
-
- try {
- // Get iterator
- iterator = this.getAvailableProducts();
- } catch (final ServletException ex) {
- this.abortProgramWithException(ex);
- }
-
- // "Walk" over all products
- while ((iterator instanceof Iterator) && (iterator.hasNext())) {
- // Get next product
- Product product = iterator.next();
-
- // Output data
- this.getLogger().debug(MessageFormat.format("Product {0}, {1}: {2}", product.getItemId(), product.getTitle(), product.getPrice())); //NOI18N
- }
-
- // Generate fake Customer instance
- Customer customer = new PizzaServiceCustomer();
-
- /*
- * Need a least a gender ... :( See, that is why I don't like default
- * constructors, you can easily miss something important and bam! You
- * get an NPE. The fix here is, to have construtors (or factories) which
- * requires all required instances that needs to be set to get a
- * consitent object back.
- */
-
- // Gender is MALE now
- customer.setGender(Gender.MALE);
-
- // Init iterator
- Iterator<Map.Entry<Field, Object>> it = null;
-
- try {
- // Get iterator on all its fields
- it = customer.iterator();
- } catch (final NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
- this.abortProgramWithException(ex);
- }
-
- // Output it
- while ((it instanceof Iterator) && (it.hasNext())) {
- Map.Entry<Field, Object> entry = it.next();
- this.getLogger().debug(MessageFormat.format("entry {0}={1}", entry.getKey(), entry.getValue())); //NOI18N
- }
- }
/**
* Adds given category data from request to database
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.text.MessageFormat;
-import org.mxchange.jcore.BaseFrameworkSystem;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
+import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
import org.mxchange.pizzaapplication.database.frontend.basket.BasketDatabaseFrontend;
import org.mxchange.pizzaapplication.database.frontend.basket.BasketFrontend;
import org.mxchange.pizzaapplication.item.AddableBasketItem;
* @author Roland Haeder
* @param <T> Any instance that implements AddableBasketItem
*/
-public class BaseBasket<T extends AddableBasketItem> extends BaseFrameworkSystem implements Basket<T>, Serializable {
+public class BaseBasket<T extends AddableBasketItem> extends BasePizzaServiceSystem implements Basket<T>, Serializable {
/**
* Serial number
*/
private static final long serialVersionUID = 784396762230845717L;
- /**
- * Session id assigned with this basket, or any other unique identifier
- */
- private String sessionId;
-
- /**
- * Protected constructor with session instance
- *
- * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend has been configured
- * @throws java.sql.SQLException If an SQL error occurs
- */
- protected BaseBasket () throws UnsupportedDatabaseBackendException, SQLException {
+ @Override
+ public void init (final ServletContext context, final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
- this.getLogger().trace("CALLED!"); //NOI18N
+ this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
+
+ // Is the bundle initialized?
+ if (!this.isBundledInitialized()) {
+ // Temporary initialize default bundle
+ // @TODO The enum Gender uses this
+ this.initBundle();
+ }
+
+ // Initialize properties from context
+ this.initProperties(context);
// Create frontend instance
BasketFrontend frontend = new BasketDatabaseFrontend();
+ // Set session id here
+ this.setSessionId(session.getId());
+
+ // Set it in frontend, too
+ frontend.setSessionId(session.getId());
+
// Debug message
this.getLogger().debug(MessageFormat.format("frontend={0} being set ...", frontend)); //NOI18N
this.setFrontend(frontend);
}
+ /**
+ * Protected constructor with session instance
+ *
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend has been configured
+ * @throws java.sql.SQLException If an SQL error occurs
+ */
+ protected BaseBasket () throws UnsupportedDatabaseBackendException, SQLException {
+ // Trace message
+ this.getLogger().trace("CALLED!"); //NOI18N
+ }
+
@Override
public void addItem (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace call
return item;
}
+ @Override
+ public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Deligate call to frontend
+ return ((BasketFrontend) this.getFrontend()).isEmpty();
+ }
+
@Override
public boolean isItemAdded (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace call
return isAdded;
}
- /**
- * Setter for session id
- *
- * @param sessionId Session id
- */
- protected final void setSessionId (final String sessionId) {
- this.sessionId = sessionId;
- }
-
- /**
- * Getter for session id
- *
- * @return Session id
- */
- protected final String getSessionId () {
- return this.sessionId;
- }
-
/**
* Called when fields are set on deserialization
*
package org.mxchange.pizzaapplication.basket;
import java.io.IOException;
+import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
import org.mxchange.jcore.FrameworkInterface;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.item.AddableBasketItem;
import org.mxchange.pizzaapplication.product.Product;
* @author Roland Haeder
* @param <T> Any addable basket items
*/
-public interface Basket<T extends AddableBasketItem> extends FrameworkInterface {
+public interface Basket<T extends AddableBasketItem> extends Serializable, FrameworkInterface {
/**
* Adds given item instance to this basket
*/
public void addItem (final T item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ /**
+ * Checks if the basket is empty
+ *
+ * @return Whether the basket is empty
+ * @throws java.io.IOException If an IO error occurs
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
+ * @throws java.lang.NoSuchMethodException If a method was not found
+ * @throws java.lang.IllegalAccessException If the invoked method is not public
+ * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ */
+ public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
/**
* Checks whether the given item as already been added. Mostly
* implementations may check the id number as this is mostly believed being
* @throws java.lang.reflect.InvocationTargetException If anything else happened?
*/
public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Initializes this instance with given ServletContext
+ *
+ * @param context Servlet context
+ * @param session Session instance
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws java.io.IOException If an IO error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ */
+ public void init (final ServletContext context, final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException;
}
package org.mxchange.pizzaapplication.basket.item;
import java.sql.SQLException;
-import java.text.MessageFormat;
-import javax.servlet.http.HttpSession;
-import org.mxchange.jcore.BaseFrameworkSystem;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.basket.BaseBasket;
import org.mxchange.pizzaapplication.basket.Basket;
* A basket for orderable items
*
* @author Roland Haeder
- * @param <T> Any instance that implements AddableBasketItem
*/
-public class ItemBasket<T extends AddableBasketItem> extends BaseBasket<T> implements Basket<T> {
+public class ItemBasket extends BaseBasket<AddableBasketItem> implements Basket<AddableBasketItem> {
/**
* Serial number
*/
private static final long serialVersionUID = 4384123923163957L;
- /**
- * Creates a singleton instance from given session's id
- *
- * @param session An instance of a HttpSession class
- * @return A session-id based singleton instance of this basket
- * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If an unsupported backend was configured
- * @throws java.sql.SQLException If an SQL error occurs
- */
- @SuppressWarnings ("unchecked")
- public final static Basket<AddableBasketItem> getInstance (final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException {
- // Trace message
- BaseFrameworkSystem.getInstance().getLogger().trace(MessageFormat.format("session={0} - CALLED!", session)); //NOI18N
-
- // Get instance
- Basket<AddableBasketItem> basket = (Basket<AddableBasketItem>) session.getAttribute("basket"); //NOI18N
-
- // Debug message
- BaseFrameworkSystem.getInstance().getLogger().debug(MessageFormat.format("basket={0}", basket));
-
- // Is the basket already created?
- if (!(basket instanceof Basket)) {
- // Not yet, so create it
- basket = new ItemBasket<>(session);
-
- // Add it in session
- session.setAttribute("basket", basket); //NOI18N
- }
-
- // Return it casted
- return basket;
- }
-
/**
* Default constructor to be able to throw exceptions from super constructor
- *
- * @param session HttpSession instance
+ * @param context Context instance
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
+ * @throws java.sql.SQLException If an SQL error occurs
*/
- private ItemBasket (final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException {
+ public ItemBasket () throws UnsupportedDatabaseBackendException, SQLException {
// Call super constructor
super();
-
- // Trace message
- this.getLogger().trace(MessageFormat.format("session={0} - CALLED!", session)); //NOI18N
-
- // Session must be set
- if (null == session) {
- // Session is null
- throw new NullPointerException("session is null");
- }
-
- // Set session id here
- this.setSessionId(session.getId());
}
}
+++ /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;
-
-import org.mxchange.pizzaapplication.customer.Customer;
-
-/**
- * An interface for customer beans
- *
- * @author Roland Haeder
- */
-public interface CustomerBean extends Customer {
-}
--- /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;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import javax.faces.FacesException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import org.mxchange.pizzaapplication.category.Category;
+import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ *
+ * @author Roland Haeder
+ */
+public interface PizzaBean extends Serializable {
+ /**
+ * Some "getter" for amount from session
+ *
+ * @param product Product instance
+ * @param session Session instance
+ * @return Amount as string
+ * @deprecated Old code
+ */
+ @Deprecated
+ public String getAmountFromSession (final Product product, final HttpSession session);
+
+ /**
+ * Some "getter" for choose from session
+ *
+ * @param product Product instance
+ * @param session Session instance
+ * @return Choose as string
+ * @deprecated Old code
+ */
+ @Deprecated
+ public String getChooseFromSession (final Product product, final HttpSession session);
+
+ /**
+ * Handler for amount from session
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Amount as string
+ * @deprecated Old code
+ */
+ @Deprecated
+ public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
+
+ /**
+ * Some "getter" for printable choosen (checkbox) from request or session
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Amount as string
+ * @deprecated Old code
+ */
+ @Deprecated
+ public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
+
+ /**
+ * Some "getter" for total price of position from request or session.
+ * Single price and amount is multiplyed.
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Amount as string
+ */
+ public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
+
+ /**
+ * Initializes this instance
+ *
+ * @throws FacesException If something was wrong
+ */
+ public void init () throws FacesException;
+
+ /**
+ * Checks whether the given product is choosen, request overules session.
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Whether the product is choosen
+ * @deprecated Old lost code
+ */
+ @Deprecated
+ public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session);
+
+ /**
+ * Calculates total price of all choosen products
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @return Total price of all choosen products
+ * @throws javax.servlet.ServletException If something unexpected happened
+ */
+ public float calculateTotalPrice (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+ /**
+ * Calculates total amount of all choosen products
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @return Total amount of all choosen products
+ * @throws javax.servlet.ServletException If something unexpected happened
+ */
+ public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+ /**
+ * Some "getter" for HTML code 'checked="checked"' if the product is choosen
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Whether the product is choosen
+ */
+ public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session);
+
+ /**
+ * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @return Whether the product is choosen
+ * @throws javax.servlet.ServletException If something unexpected happened
+ */
+ public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+ /**
+ * Marks given product as ordered in session
+ *
+ * @param product Product to mark as ordered
+ * @param session Session instance
+ * @deprecated Old code
+ */
+ @Deprecated
+ public void markProductAsOrdered(final Product product, final HttpSession session);
+
+ /**
+ * Marks given product as choosen in session
+ *
+ * @param product Product to mark as ordered
+ * @param session Session instance
+ * @deprecated Old code
+ */
+ @Deprecated
+ public void markProductAsChoosen(final Product product, final HttpSession session);
+
+ /**
+ * Unmarks given product as ordered in session
+ *
+ * @param product Product to unmark as ordered
+ * @param session Session instance
+ * @deprecated Old code
+ */
+ @Deprecated
+ public void unmarkProductAsOrdered(final Product product, final HttpSession session);
+
+ /**
+ * Unmarks given product as choosen in session
+ *
+ * @param product Product to unmark as choosen
+ * @param session Session instance
+ * @deprecated Old code
+ */
+ @Deprecated
+ public void unmarkProductAsChoosen(final Product product, final HttpSession session);
+
+ /**
+ * Some getter for printable value from session or an empty string for null.
+ *
+ * @param session Session instance
+ * @param key Key to get
+ * @return Value from key, empty string for null
+ */
+ public Object getPrintableValeFromSession (final HttpSession session, final String key);
+
+ /**
+ * Somewhat setter in session
+ *
+ * @param session Session instance
+ * @param key Session key to set
+ * @param value Value to set
+ */
+ public void setValueInSession (final HttpSession session, final String key, final Object value);
+
+ /**
+ * Some "getter" for a an array of only available products
+ *
+ * @return Only available products
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Iterator<Product> getAvailableProducts () throws ServletException;
+
+ /**
+ * Some "getter" for a an array of all products
+ *
+ * @return All products
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Iterator<Product> getAllProducts () throws ServletException;
+
+ /**
+ * Some "getter" for a an array of all categories
+ *
+ * @return All categories
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Iterator<Category> getCategories () throws ServletException;
+
+ /**
+ * Checks if given Product instance is available and returns a printable
+ * (human-readable) string.
+ *
+ * @param product Product instance to check
+ * @return Human-readable version of product availability
+ */
+ public String getPrintableProduktAvailability (final Product product);
+
+ /**
+ * Returns a printable (human-readable) string of product's category
+ *
+ * @param product Product instance to check
+ * @return Human-readable version of product availability
+ * @throws javax.servlet.ServletException If something unexpected happened
+ */
+ public String getPrintableProduktCategory (final Product product) throws ServletException;
+
+ /**
+ * Marks all choosen products as ordered
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @throws javax.servlet.ServletException If something unexpected happened
+ * @deprecated Old code
+ */
+ @Deprecated
+ public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException;
+
+ /**
+ * Adds given category data from request to database
+ *
+ * @param request Request instance
+ * @throws javax.servlet.ServletException If something unexpected happened
+ * @throws org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException If the given title is already used
+ */
+ public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException;
+
+ /**
+ * Adds given product data from request to database
+ *
+ * @param request Request instance
+ * @throws javax.servlet.ServletException If something unexpected happened
+ * @throws org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException If the given product title is already used
+ */
+ public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException;
+
+ /**
+ * Generates link HTML code for given category's parent id, if set. This
+ * link then points to products.jsp?category_id=x
+ *
+ * @param category Category instance
+ * @return HTML code
+ */
+ public String generateLinkForParent (final Category category);
+
+ /**
+ * Handles admin product form requests
+ *
+ * @param request Request instance
+ * @param response Response instance
+ * @throws ServletException If something unexpected happened
+ */
+ public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+
+ /**
+ * Handles admin category form requests
+ *
+ * @param request Request instance
+ * @param response Response instance
+ * @throws ServletException If something unexpected happened
+ */
+ public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+}
--- /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;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.util.Iterator;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.faces.FacesException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
+import org.mxchange.pizzaapplication.application.PizzaApplication;
+import org.mxchange.pizzaapplication.application.PizzaServiceApplication;
+import org.mxchange.pizzaapplication.beans.basket.BasketBean;
+import org.mxchange.pizzaapplication.category.Category;
+import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException;
+import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ * Main application class
+ *
+ * @author Roland Haeder
+ */
+@Named("service")
+@SessionScoped
+public class PizzaServiceBean implements PizzaBean {
+ /**
+ * Serial id
+ */
+ private static final long serialVersionUID = 58137539530279L;
+
+ /**
+ * Servlet context
+ */
+ @Inject
+ private ServletContext application;
+
+ /**
+ * Basket instance
+ */
+ @Inject
+ private BasketBean basket;
+
+ /**
+ * Pizza application
+ */
+ private final PizzaApplication app;
+
+ /**
+ * Initializer block
+ */
+ {
+ // Get new application instance
+ this.app = new PizzaServiceApplication();
+ }
+
+ @Override
+ @PostConstruct
+ public void init () throws FacesException {
+ try {
+ // Call init method
+ this.app.init(this.application);
+ } catch (final UnsupportedDatabaseBackendException | SQLException | IOException | BadTokenException ex) {
+ // Continue to throw
+ throw new FacesException(ex);
+ }
+ }
+
+ /**
+ * Default constructor
+ */
+ public PizzaServiceBean () {
+ }
+
+ /**
+ * Calculates total amount of all choosen products
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @return Total amount of all choosen products
+ */
+ @Override
+ public int calculateTotalAmount (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ return this.app.calculateTotalAmount(request, session);
+ }
+
+ /**
+ * Calculates total price of all choosen products
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @return Total price of all choosen products
+ */
+ @Override
+ public float calculateTotalPrice (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ return this.app.calculateTotalPrice(request, session);
+ }
+
+ /**
+ * Some "getter" for amount from session
+ *
+ * @param product Product instance
+ * @param session Session instance
+ * @return Amount as string
+ */
+ @Override
+ @Deprecated
+ public String getAmountFromSession (final Product product, final HttpSession session) {
+ return this.app.getAmountFromSession(product, session);
+ }
+
+ /**
+ * Some "getter" for HTML code 'checked="checked"' if the product is choosen
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Whether the product is choosen
+ */
+ @Override
+ public String getCheckedHtmlFromProduct (final Product product, final HttpServletRequest request, final HttpSession session) {
+ return this.app.getCheckedHtmlFromProduct(product, request, session);
+ }
+
+ /**
+ * Some "getter" for choose from session
+ *
+ * @param product Product instance
+ * @param session Session instance
+ * @return Choose as string
+ */
+ @Override
+ @Deprecated
+ public String getChooseFromSession (final Product product, final HttpSession session) {
+ return this.app.getChooseFromSession(product, session);
+ }
+
+ /**
+ * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
+ *
+ * @param request Request instance
+ * @param session Session instance
+ * @return Whether the product is choosen
+ */
+ @Override
+ public String getDisabledHtmlFromSession (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ return this.app.getDisabledHtmlFromSession(request, session);
+ }
+
+ /**
+ * Some "getter" for choosen (checkbox) from session
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Amount as string
+ */
+ @Override
+ @Deprecated
+ public String getPrintableChoosenFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
+ return this.app.getPrintableChoosenFromRequestSession(product, request, session);
+ }
+
+ /**
+ * Checks if given Product instance is available and returns a printable
+ * (human-readable) string.
+ *
+ * @param product Product instance to check
+ * @return Human-readable version of product availability
+ */
+ @Override
+ public String getPrintableProduktAvailability (final Product product) {
+ return this.app.getPrintableProduktAvailability(product);
+ }
+
+ /**
+ * Some getter for printable value from session or an empty string for null.
+ *
+ * @param session Session instance
+ * @param key Key to get
+ * @return Value from key, empty string for null
+ */
+ @Override
+ public Object getPrintableValeFromSession (final HttpSession session, final String key) {
+ return this.app.getPrintableValeFromSession(session, key);
+ }
+
+ /**
+ * Some "getter" for a an array of only available products
+ *
+ * @return All products
+ */
+ @Override
+ public Iterator<Product> getAvailableProducts () throws ServletException {
+ return this.app.getAvailableProducts();
+ }
+
+ /**
+ * Some "getter" for a an array of all products
+ *
+ * @return All products
+ */
+ @Override
+ public Iterator<Product> getAllProducts () throws ServletException {
+ return this.app.getAllProducts();
+ }
+
+ /**
+ * Some "getter" for a an array of all categories
+ *
+ * @return All categories
+ */
+ @Override
+ public Iterator<Category> getCategories () throws ServletException {
+ return this.app.getCategories();
+ }
+
+ /**
+ * Some "getter" for total price of position from request or session.
+ * Single price and amount is multiplyed.
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Amount as string
+ */
+ @Override
+ public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
+ return this.app.getTotalPositionPriceFromRequestSession(product, request, session);
+ }
+
+ /**
+ * Handler for amount from request or session
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Amount as string
+ */
+ @Override
+ @Deprecated
+ public String handleAmountFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
+ return this.app.handleAmountFromRequestSession(product, request, session);
+ }
+
+ /**
+ * Checks whether the given product is choosen, request overules session.
+ *
+ * @param product Product instance
+ * @param request Request instance
+ * @param session Session instance
+ * @return Whether the product is choosen
+ */
+ @Override
+ @Deprecated
+ public boolean isProductChoosen (final Product product, final HttpServletRequest request, final HttpSession session) {
+ return this.app.isProductChoosen(product, request, session);
+ }
+
+ /**
+ * Marks all choosen products as ordered
+ *
+ * @param request Request instance
+ * @param session Session instance
+ */
+ @Override
+ @Deprecated
+ public void markAllChoosenProductsAsOrdered (final HttpServletRequest request, final HttpSession session) throws ServletException {
+ this.app.markAllChoosenProductsAsOrdered(request, session);
+ }
+
+ /**
+ * Marks given product as choosen in session
+ *
+ * @param product Product to mark as ordered
+ * @param session Session instance
+ */
+ @Override
+ @Deprecated
+ public void markProductAsChoosen (final Product product, final HttpSession session) {
+ this.app.markProductAsChoosen(product, session);
+ }
+
+ /**
+ * Marks given product as ordered in session
+ *
+ * @param product Product to mark as ordered
+ * @param session Session instance
+ */
+ @Override
+ @Deprecated
+ public void markProductAsOrdered (final Product product, final HttpSession session) {
+ this.app.markProductAsOrdered(product, session);
+ }
+
+ /**
+ * Somewhat setter in session
+ *
+ * @param session Session instance
+ * @param key Session key to set
+ * @param value Value to set
+ */
+ @Override
+ public void setValueInSession (final HttpSession session, final String key, final Object value) {
+ this.app.setValueInSession(session, key, value);
+ }
+
+ /**
+ * Unmarks given product as choosen in session
+ *
+ * @param product Product to unmark as choosen
+ * @param session Session instance
+ */
+ @Override
+ @Deprecated
+ public void unmarkProductAsChoosen (final Product product, final HttpSession session) {
+ this.app.unmarkProductAsChoosen(product, session);
+ }
+
+ /**
+ * Unmarks given product as ordered in session
+ *
+ * @param product Product to unmark as ordered
+ * @param session Session instance
+ */
+ @Override
+ @Deprecated
+ public void unmarkProductAsOrdered (final Product product, final HttpSession session) {
+ this.app.unmarkProductAsOrdered(product, session);
+ }
+
+ @Override
+ public void doAdminAddCategory (final HttpServletRequest request) throws ServletException, CategoryTitleAlreadyUsedException {
+ this.app.doAdminAddCategory(request);
+ }
+
+ @Override
+ public void doAdminAddProduct (final HttpServletRequest request) throws ServletException, ProductTitleAlreadyUsedException {
+ this.app.doAdminAddProduct(request);
+ }
+
+ @Override
+ public String generateLinkForParent (final Category category) {
+ return this.app.generateLinkForParent(category);
+ }
+
+ @Override
+ public String getPrintableProduktCategory (final Product product) throws ServletException {
+ return this.app.getPrintableProduktCategory(product);
+ }
+
+ @Override
+ public void doAdminHandleProductForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
+ this.app.doAdminHandleProductForms(request, response);
+ }
+
+ @Override
+ public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
+ this.app.doAdminHandleCategoryForms(request, response);
+ }
+}
--- /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.basket;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.sql.SQLException;
+import javax.faces.FacesException;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
+import org.mxchange.pizzaapplication.item.AddableBasketItem;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ * An interface for a basket bean
+ *
+ * @author Roland Haeder
+ */
+public interface BasketBean extends Serializable {
+ /**
+ * Initializes this instance
+ *
+ * @throws FacesException If something was wrong
+ */
+ public void init () throws FacesException;
+
+ /**
+ * Adds given item instance to this basket
+ * @param item Item instance to add
+ * @throws java.io.IOException If an IO error occurs
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
+ * @throws java.lang.NoSuchMethodException If a method was not found
+ * @throws java.lang.IllegalAccessException If the invoked method is not public
+ * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ */
+ public void addItem (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Checks if the basket is empty
+ *
+ * @return Whether the basket is empty
+ * @throws java.io.IOException If an IO error occurs
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
+ * @throws java.lang.NoSuchMethodException If a method was not found
+ * @throws java.lang.IllegalAccessException If the invoked method is not public
+ * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ */
+ public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Checks whether the given item as already been added. Mostly
+ * implementations may check the id number as this is mostly believed being
+ * unique.
+ *
+ * @param item Item instance to check
+ * @return Whether the given item has been found
+ * @throws java.io.IOException If an IO error occurs
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
+ * @throws java.lang.NoSuchMethodException If a method was not found
+ * @throws java.lang.IllegalAccessException If the invoked method is not public
+ * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ */
+ public boolean isItemAdded (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Returns an item for given product instance or null if not found.
+ *
+ * @param product Product instance
+ * @return Item instance or null
+ * @throws java.io.IOException If an IO error occurs
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
+ * @throws java.lang.NoSuchMethodException If a method was not found
+ * @throws java.lang.IllegalAccessException If the invoked method is not public
+ * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ */
+ public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Getter for human-readable string from given key
+ *
+ * @param key Key to return
+ * @return Human-readable message
+ */
+ public String getMessageStringFromKey (final String key);
+}
--- /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.basket;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.sql.SQLException;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.Dependent;
+import javax.faces.FacesException;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
+import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
+import org.mxchange.pizzaapplication.basket.Basket;
+import org.mxchange.pizzaapplication.basket.item.ItemBasket;
+import org.mxchange.pizzaapplication.item.AddableBasketItem;
+import org.mxchange.pizzaapplication.product.Product;
+
+/**
+ * A basket for orderable items
+ *
+ * @author Roland Haeder
+ */
+@Named("basket")
+@Dependent
+public class ItemBasketBean implements BasketBean {
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 4384123923163957L;
+
+ /**
+ * Servlet context
+ */
+ @Inject
+ private ServletContext application;
+
+ /**
+ * Session
+ */
+ @Inject
+ private HttpSession session;
+
+ /**
+ * Instance of wrapped basket
+ */
+ private final Basket<AddableBasketItem> basket;
+
+ /**
+ * Default constructor to be able to throw exceptions from super constructor
+ * @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
+ * @throws java.sql.SQLException If an SQL error occurs
+ */
+ public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException {
+ // Get new application instance
+ this.basket = new ItemBasket();
+ }
+
+ @Override
+ public void addItem (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ this.basket.addItem(item);
+ }
+
+ @Override
+ public AddableBasketItem getItem (final Product product) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ return this.basket.getItem(product);
+ }
+
+ @Override
+ public String getMessageStringFromKey (final String key) {
+ return this.basket.getMessageStringFromKey(key);
+ }
+
+ @Override
+ @PostConstruct
+ public void init () throws FacesException {
+ try {
+ // Init instance
+ this.basket.init(this.application, this.session);
+ } catch (final UnsupportedDatabaseBackendException | IOException | SQLException | BadTokenException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+
+ @Override
+ public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ return this.basket.isEmpty();
+ }
+
+ @Override
+ public boolean isItemAdded (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ return this.basket.isItemAdded(item);
+ }
+}
--- /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.customer;
+
+import org.mxchange.pizzaapplication.customer.Customer;
+
+/**
+ * An interface for customer beans
+ *
+ * @author Roland Haeder
+ */
+public interface CustomerBean extends Customer {
+}
import org.mxchange.jcore.contact.Contact;
import org.mxchange.jcore.contact.Gender;
import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
-import org.mxchange.pizzaapplication.beans.CustomerBean;
+import org.mxchange.pizzaapplication.beans.customer.CustomerBean;
import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
/**
throw new UnsupportedOperationException(MessageFormat.format("Not supported yet: rowIndex={0}", rowIndex));
}
+ @Override
+ public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Trace message
+ this.getLogger().trace("CALLED!");
+
+ // Session should be set here
+ if (this.getSessionId() == null) {
+ // Abort here
+ throw new NullPointerException("sessionId is null");
+ }
+
+ // Init search instance
+ SearchableCriteria criteria = new SearchCriteria();
+
+ // Add session id and product id and limit to 1
+ criteria.addCriteria(BasketDatabaseConstants.COLUMN_SESSION_ID, this.getSessionId());
+ criteria.setLimit(1);
+
+ // Get result back
+ Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria);
+
+ // Is it empty?
+ boolean isEmpty = (!result.hasNext());
+
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("isEmpty={0} - EXIT!", isEmpty));
+
+ // Return it
+ return isEmpty;
+ }
+
@Override
public boolean isItemAdded (final AddableBasketItem item, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
*/
public AddableBasketItem getItem (final Product product, final String sessionId) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+ /**
+ * Checks if the basket is empty
+ *
+ * @return Whether the basket is empty
+ * @throws java.io.IOException If an IO error occurs
+ * @throws java.sql.SQLException If an SQL error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
+ * @throws org.mxchange.jcore.exceptions.CorruptedDatabaseFileException If a corrupted database file was found
+ * @throws java.lang.NoSuchMethodException If a method was not found
+ * @throws java.lang.IllegalAccessException If the invoked method is not public
+ * @throws java.lang.reflect.InvocationTargetException If anything else happened?
+ */
+ public boolean isEmpty () throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
/**
* Checks if given item instance is found in basket by its id number.
*
import javax.servlet.http.HttpSession;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
-import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.basket.Basket;
-import org.mxchange.pizzaapplication.basket.item.ItemBasket;
import org.mxchange.pizzaapplication.filter.servlet.BaseServletFilter;
import org.mxchange.pizzaapplication.item.AddableBasketItem;
public class BasketItemAddedFilter extends BaseServletFilter implements Filter {
@Override
+ @SuppressWarnings ("unchecked")
public void doFilter (final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
// Trace message
this.getLogger().trace(MessageFormat.format("request={0},response={1},chain={2} - CALLED!", request, response, chain)); //NOI18N
AddableBasketItem item = (AddableBasketItem) object;
// Debug message
- this.getLogger().debug(MessageFormat.format("item.id={0},item.itemId={1},item.itemType={2},item.amount={3}", item.getId(), item.getItemId(), item.getItemType(), item.getAmount()));
+ this.getLogger().debug(MessageFormat.format("item.id={0},item.itemId={1},item.itemType={2},item.amount={3}", item.getId(), item.getItemId(), item.getItemType(), item.getAmount())); //NOI18N
// Init instance
Basket<AddableBasketItem> basket;
}
// Get basket instance
- basket = ItemBasket.getInstance(session);
+ basket = (Basket<AddableBasketItem>) session.getAttribute("basket"); //NOI18N
// Is the item already added?
if (item.getItemId() == null) {
// Register item with it
basket.addItem(item);
- } catch (final UnsupportedDatabaseBackendException | SQLException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final SQLException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
// Continue to throw
throw new ServletException(ex);
}
*/
public void setItemType (final String type);
- /**
- * Session id
- * @return the sessionId
- */
- public String getSessionId ();
-
- /**
- * Session id
- * @param sessionId the sessionId to set
- */
- public void setSessionId (final String sessionId);
-
/**
* Compare method
* @param item Item to compare to
*/
private String itemType;
- /**
- * Session id
- */
- private String sessionId;
-
@Override
public int compareTo (final AddableBasketItem item) {
// Trace message
this.itemType = itemType;
}
- /**
- * Session id
- * @return the sessionId
- */
- @Override
- public final String getSessionId () {
- return this.sessionId;
- }
-
- /**
- * Session id
- * @param sessionId the sessionId to set
- */
- @Override
- public final void setSessionId (final String sessionId) {
- this.sessionId = sessionId;
- }
-
@Override
public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
// Trace message
--- /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.tags.basket;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.sql.SQLException;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.BodyTagSupport;
+import org.mxchange.jcore.exceptions.BadTokenException;
+import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
+import org.mxchange.pizzaapplication.beans.basket.BasketBean;
+
+/**
+ * A basket tag that outputs a small basket and a link to the full basket website.
+ *
+ * @author Roland Haeder
+ */
+@SessionScoped
+public class MiniBasketTag extends BodyTagSupport {
+ /**
+ * Basket instance
+ */
+ @Inject
+ private BasketBean basket;
+
+ /**
+ * Outputs a div container with last added item + a link to the basket
+ * web page.
+ *
+ * @return No need to process the body
+ * @throws JspException If anything happens
+ */
+ @Override
+ public int doStartTag () throws JspException {
+ // Init output
+ StringBuilder out = new StringBuilder("<div class=\"mini_basket\">\n");
+
+ // basket should not be null
+ if (this.basket == null) {
+ // Not set
+ throw new NullPointerException("basket instance is null");
+ }
+
+ try {
+ // Some entries found?
+ if (this.basket.isEmpty()) {
+ // Empty basket
+ out.append("<div class=\"mini_basket_info\">\n");
+ out.append(this.basket.getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n");
+ out.append("</div>\n");
+ } else {
+ // Some times were found
+ out.append("FOUND!");
+ }
+ } catch (final IOException | SQLException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ // Continue to throw
+ throw new JspException(ex);
+ }
+
+ // Finish output
+ out.append("</div>\n");
+
+ try {
+ // Get output instance and write it
+ pageContext.getOut().print(out.toString());
+ } catch (final IOException ex) {
+ // Continue to throw
+ throw new JspException(ex);
+ }
+
+ // Don't process any body
+ return SKIP_BODY;
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
+ <tlib-version>1.0</tlib-version>
+ <jsp-version>1.2</jsp-version>
+ <short-name>basket</short-name>
+ <uri>http://mxchange.org/pizza-service/tags/basket</uri>
+
+ <tag>
+ <name>mini_basket</name>
+ <description>A mini basket showing latest added item and a link to the full basket web page</description>
+ <tag-class>org.mxchange.pizzaapplication.tags.basket.MiniBasketTag</tag-class>
+ </tag>
+</taglib>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page import="org.mxchange.pizzaapplication.category.Category"%>
<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Kategorien</title>
+ <title>Pizza-Service - Kategorien</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Kategorien</h1>
+ <h1>Pizza-Service - Kategorien</h1>
</div>
</div>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Iterator"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Administration</title>
+ <title>Pizza-Service - Administration</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Administration</h1>
+ <h1>Pizza-Service - Administration</h1>
</div>
</div>
<%@page import="java.util.Map"%>
<%@page import="org.mxchange.jcore.contact.Gender"%>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<%@page import="org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Produkte</title>
+ <title>Pizza-Service - Produkte</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Produkte</h1>
+ <h1>Pizza-Service - Produkte</h1>
</div>
</div>
--%>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden</title>
+ <title>Pizza-Service - Sitzung beenden</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden</h1>
+ <h1>Pizza-Service - Sitzung beenden</h1>
</div>
</div>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Einloggen</title>
+ <title>Pizza-Service - Einloggen</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Einloggen</h1>
+ <h1>Pizza-Service - Einloggen</h1>
</div>
</div>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Passwort vergessen</title>
+ <title>Pizza-Service - Passwort vergessen</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Passwort vergessen</h1>
+ <h1>Pizza-Service - Passwort vergessen</h1>
</div>
</div>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Neukunde</title>
+ <title>Pizza-Service - Neukunde</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Neukunde</h1>
+ <h1>Pizza-Service - Neukunde</h1>
</div>
</div>
<div id="content_outer">
<div id="content_title">
- <h2>Anmelden zum <%=PizzaServiceApplication.MAIN_TITLE%>:</h2>
+ <h2>Anmelden zum Pizza-Service:</h2>
</div>
<div id="content">
Author : Roland Haeder
--%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<%@page import="java.io.PrintWriter"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Fehler</title>
+ <title>Pizza-Service - Fehler</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Fehler</h1>
+ <h1>Pizza-Service - Fehler</h1>
</div>
</div>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
<jsp:useBean id="item" scope="request" class="org.mxchange.pizzaapplication.item.basket.BasketItem" type="AddableBasketItem" />
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
// Get amount from item
Long amount = item.getAmount();
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+ <title>Pizza-Service - Form-Handler</title>
</head>
<body>
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+ <h1>Pizza-Service - Form-Handler</h1>
</div>
<jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page import="org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
// Handle forms
app.doAdminHandleCategoryForms(request, response);
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+ <title>Pizza-Service - Form-Handler</title>
</head>
<body>
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+ <h1>Pizza-Service - Form-Handler</h1>
</div>
<jsp:include page="/static/admin/admin_menu.jsp" flush="false" />
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
// Handle forms
app.doAdminHandleProductForms(request, response);
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+ <title>Pizza-Service - Form-Handler</title>
</head>
<body>
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+ <h1>Pizza-Service - Form-Handler</h1>
</div>
<jsp:include page="/static/admin/admin_menu.jsp" flush="false" />
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
// Is it post?
if ("POST".equals(request.getMethod())) { //NOI18N
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+ <title>Pizza-Service - Form-Handler</title>
</head>
<body>
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+ <h1>Pizza-Service - Form-Handler</h1>
</div>
<jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
<%@page import="java.util.Map"%>
<%@page import="org.mxchange.jcore.contact.Gender"%>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
// Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
+ PizzaBean app = PizzaServiceBean.getInstance(application);
// Is it post?
if ("POST".equals(request.getMethod())) { //NOI18N
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+ <title>Pizza-Service - Form-Handler</title>
</head>
<body>
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+ <h1>Pizza-Service - Form-Handler</h1>
</div>
<jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Impressum</title>
+ <title>Pizza-Service - Impressum</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Impressum</h1>
+ <h1>Pizza-Service - Impressum</h1>
</div>
</div>
Author : Roland Haeder
--%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page import="java.util.Map"%>
<%@page import="java.util.Iterator"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page import="org.mxchange.pizzaapplication.basket.Basket"%>
-<%@page import="org.mxchange.pizzaapplication.basket.item.ItemBasket"%>
<%@page import="org.mxchange.pizzaapplication.item.basket.BasketItem"%>
<%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@taglib prefix="basket" uri="http://mxchange.org/pizza-service/tags/basket" %>
+<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+<jsp:useBean id="basket" scope="session" class="org.mxchange.pizzaapplication.beans.basket.ItemBasketBean" type="org.mxchange.pizzaapplication.beans.basket.BasketBean" />
-<%
- // Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Willkommen</title>
+ <title>Pizza-Service - Willkommen</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Willkommen</h1>
+ <h1>Pizza-Service - Willkommen</h1>
</div>
</div>
</div>
<div id="content">
+ <basket:mini_basket />
+
<table class="table">
<tr>
<th class="table_header_column">
<%
// Get Iterator
- Iterator<Product> iterator = app.getAvailableProducts();
+ Iterator<Product> iterator = service.getAvailableProducts();
// "Walk" through all products and unmark them as ordered
while (iterator.hasNext()) {
// Debug message
product.getLogger().debug("product.itemId=" + product.getItemId());
- // Get basket instance
- Basket<AddableBasketItem> basket = ItemBasket.getInstance(session);
-
// Create an item instance form this product
AddableBasketItem item = basket.getItem(product);
}
// Unmark as ordered
- app.unmarkProductAsOrdered(product, session);
+ service.unmarkProductAsOrdered(product, session);
%>
<form action="<%=request.getContextPath()%>/form_handler/add_item.jsp" accept-charset="utf-8" id="form" method="post">
<table class="table">
+++ /dev/null
-<?xml version='1.0' encoding='UTF-8' ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html"
- xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
- xmlns:f="http://xmlns.jcp.org/jsf/core">
- <ui:param name="path" value="#{request.contextPath}" />
- <h:head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" href="#{path}/style.css" type="text/css"/>
- <title>Willkommen</title>
- </h:head>
- <h:body>
- <div id="header">
- <div id="title">
- <h1>Willkommen</h1>
- </div>
- </div>
-
- <ui:include src="/static/guest/guest_menu.xhtml" id="menu" />
-
- <div id="content_outer">
- <div id="content_title">
- <h2>Folgendes kann bestellt werden:</h2>
- </div>
-
- <div id="content">
- <h:panelGrid class="table" columns="4">
- <h:column class="table_header_column">Bestellen?</h:column>
- <h:column class="table_header_column">Anzahl:</h:column>
- <h:column class="table_header_column">Produkt:</h:column>
- <h:column class="table_header_column">Einzelpreis:</h:column>
- </h:panelGrid>
-
- <%
- // Get app instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-
- // Get Iterator
- Iterator<Product> iterator = app.getAvailableProducts();
-
- // "Walk" through all products and unmark them as ordered
- while (iterator.hasNext()) {
- // Get product instance
- Product product = iterator.next();
-
- // Get basket instance
- Basket<AddableBasketItem> basket = ItemBasket.getInstance(session);
-
- // Create an item instance form this product
- AddableBasketItem item = basket.getItem(product);
-
- // Has it been already added to the basket?
- if (item != null) {
- // Some nice output ...
- %>
- <h:panelGrid class="table" columns="4">
- <h:column class="table_header_column"><a href="#{path}/basket.jsp" title="Zum Warenkorb">Warenkorb</a></h:column>
- <h:column class="table_header_column"><%=item.getAmount()%></h:column>
- <h:column class="table_header_column"><%=product.getTitle()%></h:column>
- <h:column class="table_header_column"><f:convertNumber type="currency"><%=product.getPrice()%></f:convertNumber></h:column>
- </h:panelGrid>
- <%
- // Then skip this item
- continue;
- }
-
- // Unmark as ordered
- app.unmarkProductAsOrdered(product, session);
- %>
- <h:form>
- <h:panelGrid class="table" columns="4">
- <h:column class="table_header_column">
- <h:commandButton action="#{path}/form_handler/add_item.jsp" class="submit" value="Hinzufügen" />
- <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_ID%>" value="<%=product.getItemId()%>" />
- <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_TYPE%>" value="Product" />
- </h:column>
- <h:column class="table_header_column">
- <!--<h:inputText class="input" size="3" maxlength="20" />-->
- <input class="input" type="text" name="<%=PizzaApplication.HTTP_PARAM_AMOUNT%>" size="3" maxlength="20" />
- </h:column>
- <h:column class="table_header_column">
- <%=product.getTitle()%>
- </h:column>
- <h:column class="table_header_column right">
- <f:convertNumber type="currency"><%=product.getPrice()%></f:convertNumber>
- </h:column>
- </h:panelGrid>
- </h:form>
- <%
- }
- %>
- </div>
- </div>
-
- <ui:include src="/static/guest/guest_footer.xhtml" id="footer" />
-
- </h:body>
-</html>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Datenschutzbestimmungen</title>
+ <title>Pizza-Service - Datenschutzbestimmungen</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Datenschutzbestimmungen</h1>
+ <h1>Pizza-Service - Datenschutzbestimmungen</h1>
</div>
</div>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-
-<%
- // Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
<select class="select" name="category" size="1">
- <c:forEach var="category" items="<%=app.getCategories()%>">
+ <c:forEach var="category" items="<%=service.getCategories()%>">
<option value="${category.getCategoryId()}">${category.decodedTitle()}</option>
</c:forEach>
</select>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-
-<%
- // Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
<select class="select" name="<%=PizzaCategoryDatabaseConstants.COLUMN_PARENT%>" size="1">
<option value="">Ist oberste Kategorie</option>
- <c:forEach var="category" items="<%=app.getCategories()%>">
+ <c:forEach var="category" items="<%=service.getCategories()%>">
<option value="${category.getCategoryId()}">${category.decodedTitle()}</option>
</c:forEach>
</select>
Author : Roland Haeder
--%>
<%@page import="org.mxchange.jcore.contact.Gender"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.customer.CustomerBean" %>
<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
+<jsp:useBean id="service" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
-<%
- // Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
-
-<select class="select" name="gender" id="gender" size="1" <%=app.getDisabledHtmlFromSession(request, session)%>>
+<select class="select" name="gender" id="gender" size="1" <%=service.getDisabledHtmlFromSession(request, session)%>>
<%
// "Walk" through all genders and output them
for (final Gender gender : Gender.values()) {
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
- <title><%=PizzaServiceApplication.MAIN_TITLE%> - Allgemeine Geschäftsbedingungen</title>
+ <title>Pizza-Service - Allgemeine Geschäftsbedingungen</title>
</head>
<body>
<div id="header">
<div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Allgemeine Geschäftsbedingungen</h1>
+ <h1>Pizza-Service - Allgemeine Geschäftsbedingungen</h1>
</div>
</div>