j2ee.copy.static.files.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.5
-j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar
+j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/javax.persistence.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
-j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
-j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
+j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
+j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv3ee6
jar.compress=false
// Trace message
this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
+ // context shall not be null
+ if (null == context) {
+ // Abort here
+ throw new NullPointerException("context is null");
+ }
+
// We need some properties that needs to be set
for (final String name : this.getPropertyNames()) {
// Debug log
* @param request Request instance
* @param session Session instance
* @return Amount as string
+ * @deprecated Old code
*/
+ @Deprecated
public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session);
/**
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
import org.mxchange.pizzaapplication.category.Category;
-import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend;
import org.mxchange.pizzaapplication.database.frontend.category.PizzaCategoryDatabaseFrontend;
import org.mxchange.pizzaapplication.database.frontend.product.PizzaProductDatabaseFrontend;
import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend;
-import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
import org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException;
import org.mxchange.pizzaapplication.exceptions.ProductTitleAlreadyUsedException;
import org.mxchange.pizzaapplication.product.Product;
*/
private CategoryFrontend categoryFrontend;
+ /**
+ * Default constructor
+ */
+ public PizzaServiceApplication () {
+ // Trace message
+ this.getLogger().trace("CALLED!");
+ }
+
@Override
public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
this.getLogger().trace(MessageFormat.format("context={0} - CALLED!", context)); //NOI18N
+ // context should not be null
+ if (null == context) {
+ // Abort here
+ throw new NullPointerException("context is null");
+ }
+
// Is the bundle initialized?
if (!this.isBundledInitialized()) {
// Temporary initialize default bundle
this.getLogger().trace("EXIT!"); //NOI18N
}
- /**
- * Default constructor
- */
- public PizzaServiceApplication () {
- }
-
/**
* Calculates total amount of all choosen products
*
*/
@Override
public Iterator<Product> getAvailableProducts () throws ServletException {
+ // categoryFrontend must be set
+ if (null == this.productFrontend) {
+ // Abort here
+ throw new NullPointerException("productFrontend is null");
+ }
+
try {
// Ask frontend for a list of products
return this.productFrontend.getAvailableProducts();
*/
@Override
public Iterator<Product> getAllProducts () throws ServletException {
+ // Trace message
+ this.getLogger().trace("CALLED!");
+
+ // categoryFrontend must be set
+ if (null == this.productFrontend) {
+ // Abort here
+ throw new NullPointerException("productFrontend is null");
+ }
+
try {
// Ask frontend for a list of products
return this.productFrontend.getAllProducts();
*/
@Override
public Iterator<Category> getCategories () throws ServletException {
+ // Trace message
+ this.getLogger().trace("CALLED!");
+
+ // categoryFrontend must be set
+ if (null == this.categoryFrontend) {
+ // Abort here
+ throw new NullPointerException("categoryFrontend is null");
+ }
+
try {
// Ask frontend for a list of categories
return this.categoryFrontend.getCategories();
* @return Amount as string
*/
@Override
+ @Deprecated
public float getTotalPositionPriceFromRequestSession (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 it has been found
*/
private boolean isCategoryTitleUsed(final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // categoryFrontend must be set
+ if (null == this.categoryFrontend) {
+ // Abort here
+ throw new NullPointerException("categoryFrontend is null");
+ }
+
// Delegate to frontend
return this.categoryFrontend.isCategoryTitleUsed(title);
}
* @return Whether the product title has already been used
*/
private boolean isProductTitleUsed (final String title) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ // categoryFrontend must be set
+ if (null == this.productFrontend) {
+ // Abort here
+ throw new NullPointerException("productFrontend is null");
+ }
+
// Delegate to frontend
return this.productFrontend.isProductTitleUsed(title);
}
}
// Get all fields
- String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
- String parent = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_PARENT);
+ String title = request.getParameter(CategoryFrontend.COLUMN_TITLE);
+ String parent = request.getParameter(CategoryFrontend.COLUMN_PARENT);
// Debug message
this.getLogger().debug(MessageFormat.format("title={0},parent={1}", title, parent)); //NOI18N
// Check all fields
if (null == title) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
} else if ((parent != null) && (!parent.isEmpty())) {
// "parent" is set, so check it
try {
}
// Get title, price and category id
- String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE);
- String price = request.getParameter(PizzaProductDatabaseConstants.COLUMN_PRICE);
- String category = request.getParameter(PizzaProductDatabaseConstants.COLUMN_CATEGORY);
- String available = request.getParameter(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
+ String title = request.getParameter(ProductFrontend.COLUMN_TITLE);
+ String price = request.getParameter(ProductFrontend.COLUMN_PRICE);
+ String category = request.getParameter(ProductFrontend.COLUMN_CATEGORY);
+ String available = request.getParameter(ProductFrontend.COLUMN_AVAILABLE);
// Debug message
this.getLogger().debug(MessageFormat.format("title={0},price={1},category={2},available={3}", title, price, category, available)); //NOI18N
// Check all fields
if (null == title) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N
} else if (null == price) {
// "price" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_PRICE)); //NOI18N
} else if (price.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_PRICE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_PRICE)); //NOI18N
} else if (null == category) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N
} else if (category.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_CATEGORY)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_CATEGORY)); //NOI18N
} else if (null == available) {
// "title" not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N
} else if (available.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_AVAILABLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_AVAILABLE)); //NOI18N
} else if ((!"true".equals(available)) && (!"false".equals(available))) { //NOI18N
// Invalid value
- throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is invalid: {1}", ProductFrontend.COLUMN_AVAILABLE, available)); //NOI18N
}
// Parse numbers
this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
// Init title
- String title = request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE);
+ String title = request.getParameter(ProductFrontend.COLUMN_TITLE);
// request must not be null and "title" must be found and non-empty
if (null == request) {
throw new NullPointerException("request is null"); //NOI18N
} else if (null == title) {
// title is not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", ProductFrontend.COLUMN_TITLE)); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaProductDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", ProductFrontend.COLUMN_TITLE)); //NOI18N
}
// Default is not used
this.getLogger().trace(MessageFormat.format("request={0} - CALLED!", request)); //NOI18N
// Init title
- String title = request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
+ String title = request.getParameter(CategoryFrontend.COLUMN_TITLE);
// request must not be null and "title" must be found and non-empty
if (null == request) {
throw new NullPointerException("request is null"); //NOI18N
} else if (null == title) {
// title is not set
- throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is not set.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
} else if (title.isEmpty()) {
// Is left empty
- throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", PizzaCategoryDatabaseConstants.COLUMN_TITLE)); //NOI18N
+ throw new IllegalArgumentException(MessageFormat.format("{0} is empty.", CategoryFrontend.COLUMN_TITLE)); //NOI18N
}
// Default is not used
package org.mxchange.pizzaapplication.basket;
import java.io.IOException;
-import java.io.ObjectInputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
*/
private static final long serialVersionUID = 784396762230845717L;
+ /**
+ * 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 init (final ServletContext context, final HttpSession session) throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
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 it
return isAdded;
}
-
- /**
- * Called when fields are set on deserialization
- *
- * @param in Object input stream
- * @throws IOException If any IO error occurs
- * @throws ClassNotFoundException If the class is not found
- */
- private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException {
- // Trace message
- this.getLogger().trace(MessageFormat.format("in={0} - CALLED!", in));
-
- try {
- // Init everything else
-
- // Init frontend
- BasketFrontend frontend = new BasketDatabaseFrontend();
-
- // Set it here
- this.setFrontend(frontend);
- } catch (final UnsupportedDatabaseBackendException | SQLException ex) {
- // Continue to throw
- throw new IOException(ex);
- }
- }
}
/**
* Default constructor to be able to throw exceptions from super constructor
- * @param context Context instance
* @throws org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException If the backend is unsupported
* @throws java.sql.SQLException If an SQL error occurs
*/
import java.io.Serializable;
import java.util.Iterator;
import javax.faces.FacesException;
+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.apache.logging.log4j.Logger;
+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;
* @throws ServletException If something unexpected happened
*/
public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException;
+
+ /**
+ * Getter for logger
+ *
+ * @return Logger
+ */
+ public Logger getLogger ();
+
+ /**
+ * @return the basket
+ */
+ public BasketBean getBasket ();
+
+ /**
+ * @param basket the basket to set
+ */
+ public void setBasket (final BasketBean basket);
+
+ /**
+ * @return the application
+ */
+ public ServletContext getApplication ();
+
+ /**
+ * @param application the application to set
+ */
+ public void setApplication (final ServletContext application);
}
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.application.PizzaApplication;
*/
private final PizzaApplication app;
+ /**
+ * Class' logger
+ */
+ private final Logger LOG;
+
/**
* Initializer block
*/
{
// Get new application instance
+ LOG = LogManager.getLogger(this);
+ LOG.debug("INITIALIZER!");
this.app = new PizzaServiceApplication();
}
+ /**
+ * Default constructor
+ */
+ public PizzaServiceBean () {
+ this.getLogger().trace("CALLED!");
+ }
+
@Override
@PostConstruct
public void init () throws FacesException {
+ // Trace message
+ this.getLogger().trace("application=" + this.getApplication() + ",basket=" + this.getBasket() + " - CALLED!");
+
+ // Must not be null
+ if (this.getApplication() == null) {
+ // Abort here
+ throw new NullPointerException("application is null");
+ }
+
try {
// Call init method
- this.app.init(this.application);
+ this.app.init(this.getApplication());
} 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
*
* @return Amount as string
*/
@Override
+ @Deprecated
public float getTotalPositionPriceFromRequestSession (final Product product, final HttpServletRequest request, final HttpSession session) {
return this.app.getTotalPositionPriceFromRequestSession(product, request, session);
}
public void doAdminHandleCategoryForms (final HttpServletRequest request, final HttpServletResponse response) throws ServletException {
this.app.doAdminHandleCategoryForms(request, response);
}
+
+ /**
+ * Getter for logger
+ *
+ * @return Logger
+ */
+ @Override
+ public Logger getLogger () {
+ return this.LOG;
+ }
+
+ /**
+ * @return the basket
+ */
+ @Override
+ public BasketBean getBasket () {
+ // Trace message
+ this.getLogger().trace("basked=" + this.basket + " - EXIT!");
+
+ // Return it
+ return this.basket;
+ }
+
+ /**
+ * @param basket the basket to set
+ */
+ @Override
+ public void setBasket (final BasketBean basket) {
+ // Trace message
+ this.getLogger().trace("basked=" + basket + " - CALLED!");
+
+ // Set it here
+ this.basket = basket;
+ }
+
+ /**
+ * @return the application
+ */
+ @Override
+ public ServletContext getApplication () {
+ // Trace message
+ this.getLogger().trace("application=" + this.application + " - EXIT!");
+
+ // Return it
+ return this.application;
+ }
+
+ /**
+ * @param application the application to set
+ */
+ @Override
+ public void setApplication (final ServletContext application) {
+ // Trace message
+ this.getLogger().trace("application=" + application + " - CALLED!");
+
+ // Set it here
+ this.application = application;
+ }
}
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import javax.faces.FacesException;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import org.apache.logging.log4j.Logger;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.pizzaapplication.item.AddableBasketItem;
* @return Human-readable message
*/
public String getMessageStringFromKey (final String key);
+
+ /**
+ * Getter for logger
+ *
+ * @return Logger
+ */
+ public Logger getLogger ();
+
+ /**
+ * @return the application
+ */
+ public ServletContext getApplication ();
+
+ /**
+ * @param application the application to set
+ */
+ public void setApplication (final ServletContext application);
+
+ /**
+ * @return the session
+ */
+ public HttpSession getSession ();
+
+ /**
+ * @param session the session to set
+ */
+ public void setSession (final HttpSession session);
}
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import javax.annotation.PostConstruct;
-import javax.enterprise.context.Dependent;
+import javax.enterprise.context.SessionScoped;
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.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
* @author Roland Haeder
*/
@Named("basket")
-@Dependent
+@SessionScoped
public class ItemBasketBean implements BasketBean {
/**
* Serial number
@Inject
private HttpSession session;
+ /**
+ * Class' logger
+ */
+ private final Logger LOG;
+
/**
* Instance of wrapped basket
*/
private final Basket<AddableBasketItem> basket;
+ /**
+ * Initializer block
+ */
+ {
+ // Get new application instance
+ this.basket = new ItemBasket();
+ LOG = LogManager.getLogger(this);
+ }
+
/**
* 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
+ * @throws java.io.IOException If an IO Error occurs
+ * @throws org.mxchange.jcore.exceptions.BadTokenException If a bad token was found
*/
- public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException {
- // Get new application instance
- this.basket = new ItemBasket();
+ public ItemBasketBean () throws UnsupportedDatabaseBackendException, SQLException, IOException, BadTokenException {
+ // Trace message
+ this.getLogger().trace("CALLED!");
}
@Override
@Override
@PostConstruct
public void init () throws FacesException {
+ // Trace message
+ this.getLogger().trace("application=" + this.getApplication() + ",session=" + this.getSession() + " - CALLED!");
+
try {
// Init instance
- this.basket.init(this.application, this.session);
+ this.basket.init(this.getApplication(), this.getSession());
} catch (final UnsupportedDatabaseBackendException | IOException | SQLException | BadTokenException ex) {
// Continue to throw
throw new FaceletException(ex);
public boolean isItemAdded (final AddableBasketItem item) throws IOException, SQLException, BadTokenException, CorruptedDatabaseFileException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
return this.basket.isItemAdded(item);
}
+
+ /**
+ * Getter for logger
+ *
+ * @return Logger
+ */
+ @Override
+ public Logger getLogger () {
+ return this.LOG;
+ }
+
+ /**
+ * @return the application
+ */
+ @Override
+ public ServletContext getApplication () {
+ return this.application;
+ }
+
+ /**
+ * @param application the application to set
+ */
+ @Override
+ public void setApplication (final ServletContext application) {
+ this.application = application;
+ }
+
+ /**
+ * @return the session
+ */
+ @Override
+ public HttpSession getSession () {
+ return this.session;
+ }
+
+ /**
+ * @param session the session to set
+ */
+ @Override
+ public void setSession (final HttpSession session) {
+ this.session = session;
+ }
}
*/
package org.mxchange.pizzaapplication.beans.customer;
-import org.mxchange.pizzaapplication.customer.Customer;
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.contact.Gender;
/**
* An interface for customer beans
*
* @author Roland Haeder
*/
-public interface CustomerBean extends Customer {
+public interface CustomerBean extends Serializable {
+ /**
+ * Returns an iterator of all values from this object
+ *
+ * @return An iterator
+ * @throws java.lang.NoSuchMethodException If the invoked method was not found
+ * @throws java.lang.IllegalAccessException If the method cannot be accessed
+ * @throws java.lang.reflect.InvocationTargetException Any other problems?
+ */
+ public Iterator<Map.Entry<Field, Object>> iterator ()throws NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Some "getter" for translated gender of the contact
+ *
+ * @return Translated / human-readable gender
+ */
+ public String getTranslatedGender ();
+
+ /**
+ * Gender of the contact
+ *
+ * @return the gender
+ */
+ public Gender getGender ();
+
+ /**
+ * Gender of the contact
+ *
+ * @param gender the gender to set
+ */
+ public void setGender (final Gender gender);
+
+ /**
+ * First name
+ *
+ * @return the first name
+ */
+ public String getFirstName ();
+
+ /**
+ * First name
+ *
+ * @param firstName the first name to set
+ */
+ public void setFirstName (final String firstName);
+
+ /**
+ * Family name
+ *
+ * @return the familyName
+ */
+ public String getFamilyName ();
+
+ /**
+ * Family name
+ *
+ * @param familyName the familyName to set
+ */
+ public void setFamilyName (final String familyName);
+
+ /**
+ * Companyname
+ *
+ * @return the companyName
+ */
+ public String getCompanyName ();
+
+ /**
+ * Companyname
+ *
+ * @param companyName the companyName to set
+ */
+ public void setCompanyName (final String companyName);
+
+ /**
+ * Street
+ *
+ * @return the street
+ */
+ public String getStreet ();
+
+ /**
+ * Street
+ *
+ * @param street the street to set
+ */
+ public void setStreet (final String street);
+
+ /**
+ * House number
+ *
+ * @return the houseNumber
+ */
+ public Long getHouseNumber ();
+
+ /**
+ * House number
+ *
+ * @param houseNumber the houseNumber to set
+ */
+ public void setHouseNumber (final Long houseNumber);
+
+ /**
+ * ZIP code
+ *
+ * @return the zipCode
+ */
+ public Long getZipCode ();
+
+ /**
+ * ZIP code
+ *
+ * @param zipCode the zipCode to set
+ */
+ public void setZipCode (final Long zipCode);
+
+ /**
+ * City
+ *
+ * @return the city
+ */
+ public String getCity ();
+
+ /**
+ * City
+ *
+ * @param city the city to set
+ */
+ public void setCity (final String city);
+
+ /**
+ * Country code
+ *
+ * @return the countryCode
+ */
+ public String getCountryCode ();
+
+ /**
+ * Country code
+ *
+ * @param countryCode the countryCode to set
+ */
+ public void setCountryCode (final String countryCode);
+
+ /**
+ * Email address
+ *
+ * @return the emailAddress
+ */
+ public String getEmailAddress ();
+
+ /**
+ * Email address
+ *
+ * @param emailAddress the emailAddress to set
+ */
+ public void setEmailAddress (final String emailAddress);
+
+ /**
+ * Phone number
+ *
+ * @return the phoneNumber
+ */
+ public String getPhoneNumber ();
+
+ /**
+ * Phone number
+ *
+ * @param phoneNumber the phoneNumber to set
+ */
+ public void setPhoneNumber (final String phoneNumber);
+
+ /**
+ * Fax number
+ *
+ * @return the faxNumber
+ */
+ public String getFaxNumber ();
+
+ /**
+ * Fax number
+ *
+ * @param faxNumber the faxNumber to set
+ */
+ public void setFaxNumber (final String faxNumber);
+
+ /**
+ * Cellphone number
+ *
+ * @return the cellphoneNumber
+ */
+ public String getCellphoneNumber ();
+
+ /**
+ * Cellphone number
+ *
+ * @param cellphoneNumber the cellphoneNumber to set
+ */
+ public void setCellphoneNumber (final String cellphoneNumber);
+
+ /**
+ * Birth day
+ *
+ * @return the birthday
+ */
+ public String getBirthday ();
+
+ /**
+ * Birth day
+ *
+ * @param birthday the birthday to set
+ */
+ public void setBirthday (final String birthday);
+
+ /**
+ * Comments
+ *
+ * @return the comment
+ */
+ public String getComment ();
+
+ /**
+ * Comments
+ *
+ * @param comment the comment to set
+ */
+ public void setComment (final String comment);
+
+ /**
+ * Checks whether the contact is user's own data
+ *
+ * @return Own data?
+ */
+ public boolean isOwnContact ();
+
+ /**
+ * Shows the contact to the user
+ *
+ * @param client Client instance to call back
+ */
+ public void show (final Client client);
+
+ /**
+ * Some "getter for a value from given column name. This name will be
+ * translated into a method name and then this method is called.
+ *
+ * @param columnName Column name
+ * @return Value from field
+ * @throws IllegalArgumentException Some implementations may throw this
+ * @throws java.lang.NoSuchMethodException If the invoked method was not found
+ * @throws java.lang.IllegalAccessException If the method cannot be accessed
+ * @throws java.lang.reflect.InvocationTargetException Any other problems?
+ */
+ public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException;
+
+ /**
+ * Some "setter" for a value from given column name. You may wish to overwrite this method in your
+ * own class.
+ *
+ * @param columnName Column name
+ * @param value Value to set in object's field
+ * @throws IllegalArgumentException Some implementations may throw this
+ * @throws java.lang.NoSuchMethodException If the invoked method was not found
+ * @throws java.lang.IllegalAccessException If the method cannot be accessed
+ * @throws java.lang.reflect.InvocationTargetException Any other problems?
+ */
+ public void setValueFromColumn (final String columnName, final Object value) throws NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException;
}
--- /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 java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.Map;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Named;
+import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
+import org.mxchange.pizzaapplication.beans.customer.CustomerBean;
+import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
+
+/**
+ * A customer bean which hides the customer instance
+ *
+ * @author Roland Haeder
+ */
+@Named("customer")
+@SessionScoped
+public class PizzaServiceCustomerBean implements CustomerBean {
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 543145347916L;
+
+ /**
+ * Contact instance
+ */
+ private Contact contact;
+
+ /**
+ * Default constructor
+ */
+ public PizzaServiceCustomerBean () {
+ // Instance customer
+ Contact customer = new PizzaServiceCustomer();
+
+ // Fake gender
+ customer.setGender(Gender.UNKNOWN);
+
+ // And set it here
+ this.setContact(customer);
+ }
+
+ @Override
+ public String getBirthday () {
+ // Deligate to "hidden" object
+ return this.getContact().getBirthday();
+ }
+
+ @Override
+ public void setBirthday (final String birthday) {
+ // Deligate to "hidden" object
+ this.getContact().setBirthday(birthday);
+ }
+
+ @Override
+ public String getCellphoneNumber () {
+ // Deligate to "hidden" object
+ return this.getContact().getCellphoneNumber();
+ }
+
+ @Override
+ public void setCellphoneNumber (final String cellphoneNumber) {
+ // Deligate to "hidden" object
+ this.getContact().setCellphoneNumber(cellphoneNumber);
+ }
+
+ @Override
+ public String getCity () {
+ // Deligate to "hidden" object
+ return this.getContact().getCity();
+ }
+
+ @Override
+ public void setCity (final String city) {
+ // Deligate to "hidden" object
+ this.getContact().setCity(city);
+ }
+
+ @Override
+ public String getComment () {
+ // Deligate to "hidden" object
+ return this.getContact().getComment();
+ }
+
+ @Override
+ public void setComment (final String comment) {
+ // Deligate to "hidden" object
+ this.getContact().setComment(comment);
+ }
+
+ @Override
+ public String getCompanyName () {
+ // Deligate to "hidden" object
+ return this.getContact().getCompanyName();
+ }
+
+ @Override
+ public void setCompanyName (final String companyName) {
+ // Deligate to "hidden" object
+ this.getContact().setCompanyName(companyName);
+ }
+
+ @Override
+ public String getCountryCode () {
+ // Deligate to "hidden" object
+ return this.getContact().getCountryCode();
+ }
+
+ @Override
+ public void setCountryCode (final String countryCode) {
+ // Deligate to "hidden" object
+ this.getContact().setCountryCode(countryCode);
+ }
+
+ @Override
+ public String getEmailAddress () {
+ // Deligate to "hidden" object
+ return this.getContact().getEmailAddress();
+ }
+
+ @Override
+ public void setEmailAddress (final String emailAddress) {
+ // Deligate to "hidden" object
+ this.getContact().setEmailAddress(emailAddress);
+ }
+
+ @Override
+ public String getFamilyName () {
+ // Trace call
+ //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
+
+ // Deligate to "hidden" object
+ return this.getContact().getFamilyName();
+ }
+
+ @Override
+ public void setFamilyName (final String familyName) {
+ // Trace call
+ //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
+
+ // Deligate to "hidden" object
+ this.getContact().setFamilyName(familyName);
+ }
+
+ @Override
+ public String getFaxNumber () {
+ // Deligate to "hidden" object
+ return this.getContact().getFaxNumber();
+ }
+
+ @Override
+ public void setFaxNumber (final String faxNumber) {
+ // Deligate to "hidden" object
+ this.getContact().setFaxNumber(faxNumber);
+ }
+
+ @Override
+ public Gender getGender () {
+ // Deligate to "hidden" object
+ return this.getContact().getGender();
+ }
+
+ @Override
+ public void setGender (final Gender gender) {
+ // Deligate to "hidden" object
+ this.getContact().setGender(gender);
+ }
+
+ @Override
+ public Long getHouseNumber () {
+ // Deligate to "hidden" object
+ return this.getContact().getHouseNumber();
+ }
+
+ @Override
+ public void setHouseNumber (final Long houseNumber) {
+ // Deligate to "hidden" object
+ this.getContact().setHouseNumber(houseNumber);
+ }
+
+ @Override
+ public String getPhoneNumber () {
+ // Deligate to "hidden" object
+ return this.getContact().getPhoneNumber();
+ }
+
+ @Override
+ public void setPhoneNumber (final String phoneNumber) {
+ // Deligate to "hidden" object
+ this.getContact().setPhoneNumber(phoneNumber);
+ }
+
+ @Override
+ public String getStreet () {
+ // Deligate to "hidden" object
+ return this.getContact().getStreet();
+ }
+
+ @Override
+ public void setStreet (final String street) {
+ // Deligate to "hidden" object
+ this.getContact().setStreet(street);
+ }
+
+ @Override
+ public String getFirstName () {
+ // Deligate to "hidden" object
+ return this.getContact().getFirstName();
+ }
+
+ @Override
+ public void setFirstName (final String firstName) {
+ // Deligate to "hidden" object
+ this.getContact().setFirstName(firstName);
+ }
+
+ @Override
+ public String getTranslatedGender () {
+ // Deligate to "hidden" object
+ return this.getContact().getTranslatedGender();
+ }
+
+ @Override
+ public Long getZipCode () {
+ // Deligate to "hidden" object
+ return this.getContact().getZipCode();
+ }
+
+ @Override
+ public void setZipCode (final Long zipCode) {
+ // Deligate to "hidden" object
+ this.getContact().setZipCode(zipCode);
+ }
+
+ @Override
+ public boolean isOwnContact () {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Iterator<Map.Entry<Field, Object>> iterator () throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Deligate to "hidden" object
+ return this.getContact().iterator();
+ }
+
+ @Override
+ public void show (final Client client) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ @Override
+ public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Deligate to "hidden" object
+ return this.getContact().getValueFromColumn(columnName);
+ }
+
+ @Override
+ public void setValueFromColumn (final String columnName, final Object value) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
+ // Deligate to "hidden" object
+ this.getContact().setValueFromColumn(columnName, value);
+ }
+
+ /**
+ * Setter for Contact instance
+ * @param contact Contact instance to set
+ */
+ private void setContact (final Contact contact) {
+ this.contact = contact;
+ }
+
+ /**
+ * Getter for Contact instance
+ * @return Contact instance
+ */
+ private Contact getContact () {
+ return this.contact;
+ }
+}
+++ /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.customer.bean;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.Map;
-import org.mxchange.jcore.client.Client;
-import org.mxchange.jcore.contact.Contact;
-import org.mxchange.jcore.contact.Gender;
-import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
-import org.mxchange.pizzaapplication.beans.customer.CustomerBean;
-import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements CustomerBean {
- /**
- * Default constructor
- */
- public PizzaServiceCustomerBean () {
- // Instance customer
- Contact customer = new PizzaServiceCustomer();
-
- // Fake gender
- customer.setGender(Gender.UNKNOWN);
-
- // And set it here
- this.setContact(customer);
- }
-
- @Override
- public String getBirthday () {
- // Deligate to "hidden" object
- return this.getContact().getBirthday();
- }
-
- @Override
- public void setBirthday (final String birthday) {
- // Deligate to "hidden" object
- this.getContact().setBirthday(birthday);
- }
-
- @Override
- public String getCellphoneNumber () {
- // Deligate to "hidden" object
- return this.getContact().getCellphoneNumber();
- }
-
- @Override
- public void setCellphoneNumber (final String cellphoneNumber) {
- // Deligate to "hidden" object
- this.getContact().setCellphoneNumber(cellphoneNumber);
- }
-
- @Override
- public String getCity () {
- // Deligate to "hidden" object
- return this.getContact().getCity();
- }
-
- @Override
- public void setCity (final String city) {
- // Deligate to "hidden" object
- this.getContact().setCity(city);
- }
-
- @Override
- public String getComment () {
- // Deligate to "hidden" object
- return this.getContact().getComment();
- }
-
- @Override
- public void setComment (final String comment) {
- // Deligate to "hidden" object
- this.getContact().setComment(comment);
- }
-
- @Override
- public String getCompanyName () {
- // Deligate to "hidden" object
- return this.getContact().getCompanyName();
- }
-
- @Override
- public void setCompanyName (final String companyName) {
- // Deligate to "hidden" object
- this.getContact().setCompanyName(companyName);
- }
-
- @Override
- public String getCountryCode () {
- // Deligate to "hidden" object
- return this.getContact().getCountryCode();
- }
-
- @Override
- public void setCountryCode (final String countryCode) {
- // Deligate to "hidden" object
- this.getContact().setCountryCode(countryCode);
- }
-
- @Override
- public String getEmailAddress () {
- // Deligate to "hidden" object
- return this.getContact().getEmailAddress();
- }
-
- @Override
- public void setEmailAddress (final String emailAddress) {
- // Deligate to "hidden" object
- this.getContact().setEmailAddress(emailAddress);
- }
-
- @Override
- public String getFamilyName () {
- // Trace call
- //* NOISY-DEBUG: */ this.getLogger().trace("CALLED!");
-
- // Deligate to "hidden" object
- return this.getContact().getFamilyName();
- }
-
- @Override
- public void setFamilyName (final String familyName) {
- // Trace call
- //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("familyName={0} - CALLED!", familyName));
-
- // Deligate to "hidden" object
- this.getContact().setFamilyName(familyName);
- }
-
- @Override
- public String getFaxNumber () {
- // Deligate to "hidden" object
- return this.getContact().getFaxNumber();
- }
-
- @Override
- public void setFaxNumber (final String faxNumber) {
- // Deligate to "hidden" object
- this.getContact().setFaxNumber(faxNumber);
- }
-
- @Override
- public Gender getGender () {
- // Deligate to "hidden" object
- return this.getContact().getGender();
- }
-
- @Override
- public void setGender (final Gender gender) {
- // Deligate to "hidden" object
- this.getContact().setGender(gender);
- }
-
- @Override
- public Long getHouseNumber () {
- // Deligate to "hidden" object
- return this.getContact().getHouseNumber();
- }
-
- @Override
- public void setHouseNumber (final Long houseNumber) {
- // Deligate to "hidden" object
- this.getContact().setHouseNumber(houseNumber);
- }
-
- @Override
- public String getPhoneNumber () {
- // Deligate to "hidden" object
- return this.getContact().getPhoneNumber();
- }
-
- @Override
- public void setPhoneNumber (final String phoneNumber) {
- // Deligate to "hidden" object
- this.getContact().setPhoneNumber(phoneNumber);
- }
-
- @Override
- public String getStreet () {
- // Deligate to "hidden" object
- return this.getContact().getStreet();
- }
-
- @Override
- public void setStreet (final String street) {
- // Deligate to "hidden" object
- this.getContact().setStreet(street);
- }
-
- @Override
- public String getFirstName () {
- // Deligate to "hidden" object
- return this.getContact().getFirstName();
- }
-
- @Override
- public void setFirstName (final String firstName) {
- // Deligate to "hidden" object
- this.getContact().setFirstName(firstName);
- }
-
- @Override
- public String getTranslatedGender () {
- // Deligate to "hidden" object
- return this.getContact().getTranslatedGender();
- }
-
- @Override
- public Long getZipCode () {
- // Deligate to "hidden" object
- return this.getContact().getZipCode();
- }
-
- @Override
- public void setZipCode (final Long zipCode) {
- // Deligate to "hidden" object
- this.getContact().setZipCode(zipCode);
- }
-
- @Override
- public boolean isOwnContact () {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public Iterator<Map.Entry<Field, Object>> iterator () throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // Deligate to "hidden" object
- return this.getContact().iterator();
- }
-
- @Override
- public void show (final Client client) {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
-
- @Override
- public Object getValueFromColumn (final String columnName) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // Deligate to "hidden" object
- return this.getContact().getValueFromColumn(columnName);
- }
-
- @Override
- public void setValueFromColumn (final String columnName, final Object value) throws IllegalArgumentException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- // Deligate to "hidden" object
- this.getContact().setValueFromColumn(columnName, value);
- }
-}
+++ /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.database.category;
-
-/**
- * Holder class for database columns for product frontend
- *
- * @author Roland Haeder
- */
-public final class PizzaCategoryDatabaseConstants {
- /**
- * Column name for "id"
- */
- public static final String COLUMN_ID = "category_id"; //NOI18N
-
- /**
- * Column name for "parent"
- */
- public static final String COLUMN_PARENT = "parent"; //NOI18N
-
- /**
- * Column name for "title"
- */
- public static final String COLUMN_TITLE = "title"; //NOI18N
-
- /**
- * No instance from this class
- */
- private PizzaCategoryDatabaseConstants () {
- }
-}
* @author Roland Häder
*/
public interface CategoryFrontend extends DatabaseFrontend {
+ /**
+ * Column name for "parent"
+ */
+ public static final String COLUMN_PARENT = "parent"; //NOI18N
+ /**
+ * Column name for "title"
+ */
+ public static final String COLUMN_TITLE = "title"; //NOI18N
+ /**
+ * Column name for "id"
+ */
+ public static final String COLUMN_ID = "category_id"; //NOI18N
/**
* Adds given category title as new category, parent may be null if not
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
import org.mxchange.pizzaapplication.category.Category;
import org.mxchange.pizzaapplication.category.product.ProductCategory;
-import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
import org.mxchange.pizzaapplication.product.Product;
/**
this.clearDataSet();
// Add title and parent
- this.addToDataSet(PizzaCategoryDatabaseConstants.COLUMN_TITLE, title);
- this.addToDataSet(PizzaCategoryDatabaseConstants.COLUMN_PARENT, parent);
+ this.addToDataSet(CategoryFrontend.COLUMN_TITLE, title);
+ this.addToDataSet(CategoryFrontend.COLUMN_PARENT, parent);
// Handle this over to the backend
// @todo Nothing is done yet!
if ((value instanceof String) && ("".equals(value))) { //NOI18N
// This value may need to be changed
switch (key) {
- case PizzaCategoryDatabaseConstants.COLUMN_PARENT: // Convert this
+ case CategoryFrontend.COLUMN_PARENT: // Convert this
v = null;
break;
}
SearchableCriteria criteria = new SearchCriteria();
// Add id to it
- criteria.addCriteria(PizzaCategoryDatabaseConstants.COLUMN_ID, id);
+ criteria.addCriteria(CategoryFrontend.COLUMN_ID, id);
// Only one entry is find
criteria.setLimit(1);
@Override
public String getIdName () {
// Return column id
- return PizzaCategoryDatabaseConstants.COLUMN_ID;
+ return CategoryFrontend.COLUMN_ID;
}
/**
// "Walk" through all entries
while (resultSet.next()) {
// Get id, title and parent id
- Long id = resultSet.getLong(PizzaCategoryDatabaseConstants.COLUMN_ID);
- String title = resultSet.getString(PizzaCategoryDatabaseConstants.COLUMN_TITLE);
- Long parent = resultSet.getLong(PizzaCategoryDatabaseConstants.COLUMN_PARENT);
+ Long id = resultSet.getLong(CategoryFrontend.COLUMN_ID);
+ String title = resultSet.getString(CategoryFrontend.COLUMN_TITLE);
+ Long parent = resultSet.getLong(CategoryFrontend.COLUMN_PARENT);
// Debug message
this.getLogger().debug(MessageFormat.format("id={0},title={1},parent={2}", id, title, parent)); //NOI18N
SearchableCriteria criteria = new SearchCriteria();
// Add criteria
- criteria.addCriteria(PizzaCategoryDatabaseConstants.COLUMN_TITLE, title);
+ criteria.addCriteria(CategoryFrontend.COLUMN_TITLE, title);
// Only one entry is find
criteria.setLimit(1);
import org.mxchange.jcore.exceptions.BadTokenException;
import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jcore.exceptions.UnsupportedDatabaseBackendException;
-import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
import org.mxchange.pizzaapplication.product.Product;
import org.mxchange.pizzaapplication.product.pizza.PizzaProduct;
this.clearDataSet();
// Add title and parent
- this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_TITLE, title);
- this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_PRICE, price);
- this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_CATEGORY, category);
- this.addToDataSet(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, available);
+ this.addToDataSet(ProductFrontend.COLUMN_TITLE, title);
+ this.addToDataSet(ProductFrontend.COLUMN_PRICE, price);
+ this.addToDataSet(ProductFrontend.COLUMN_CATEGORY, category);
+ this.addToDataSet(ProductFrontend.COLUMN_AVAILABLE, available);
// Handle this over to the backend
// @todo Nothing is done yet!
SearchableCriteria criteria = new SearchCriteria();
// Add criteria
- criteria.addCriteria(PizzaProductDatabaseConstants.COLUMN_AVAILABLE, true);
+ criteria.addCriteria(ProductFrontend.COLUMN_AVAILABLE, true);
// Run the query
Result<? extends Storeable> result = this.getBackend().doSelectByCriteria(criteria);
@Override
public String getIdName () {
// Return column id
- return PizzaProductDatabaseConstants.COLUMN_ITEM_ID;
+ return ProductFrontend.COLUMN_ITEM_ID;
}
/**
// "Walk" through all entries
while (resultSet.next()) {
// Get id, title and parent id
- Long id = resultSet.getLong(PizzaProductDatabaseConstants.COLUMN_ITEM_ID);
- String title = resultSet.getString(PizzaProductDatabaseConstants.COLUMN_TITLE);
- Float price = resultSet.getFloat(PizzaProductDatabaseConstants.COLUMN_PRICE);
- Long category = resultSet.getLong(PizzaProductDatabaseConstants.COLUMN_CATEGORY);
- Boolean available = resultSet.getBoolean(PizzaProductDatabaseConstants.COLUMN_AVAILABLE);
+ Long id = resultSet.getLong(ProductFrontend.COLUMN_ITEM_ID);
+ String title = resultSet.getString(ProductFrontend.COLUMN_TITLE);
+ Float price = resultSet.getFloat(ProductFrontend.COLUMN_PRICE);
+ Long category = resultSet.getLong(ProductFrontend.COLUMN_CATEGORY);
+ Boolean available = resultSet.getBoolean(ProductFrontend.COLUMN_AVAILABLE);
// Debug message
this.getLogger().debug(MessageFormat.format("id={0},title={1},category={2},available={3}", id, title, category, available)); //NOI18N
SearchableCriteria criteria = new SearchCriteria();
// Add criteria
- criteria.addCriteria(PizzaProductDatabaseConstants.COLUMN_TITLE, title);
+ criteria.addCriteria(ProductFrontend.COLUMN_TITLE, title);
// Only one entry is find
criteria.setLimit(1);
* @author Roland Häder
*/
public interface ProductFrontend extends DatabaseFrontend {
+ /**
+ * Column name for "item_id"
+ */
+ public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N
+ /**
+ * Column name for "available"
+ */
+ public static final String COLUMN_AVAILABLE = "available"; //NOI18N
+ /**
+ * Column name for "price"
+ */
+ public static final String COLUMN_PRICE = "price"; //NOI18N
+ /**
+ * Column name for "category"
+ */
+ public static final String COLUMN_CATEGORY = "category"; //NOI18N
+ /**
+ * Column name for "title"
+ */
+ public static final String COLUMN_TITLE = "title"; //NOI18N
/**
* Adds product to database by given title, price and category id
+++ /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.database.product;
-
-/**
- * Holder class for database columns for product frontend
- *
- * @author Roland Haeder
- */
-public final class PizzaProductDatabaseConstants {
- /**
- * Column name for "available"
- */
- public static final String COLUMN_AVAILABLE = "available"; //NOI18N
-
- /**
- * Column name for "category"
- */
- public static final String COLUMN_CATEGORY = "category"; //NOI18N
-
- /**
- * Column name for "item_id"
- */
- public static final String COLUMN_ITEM_ID = "item_id"; //NOI18N
-
- /**
- * Column name for "price"
- */
- public static final String COLUMN_PRICE = "price"; //NOI18N
-
- /**
- * Column name for "title"
- */
- public static final String COLUMN_TITLE = "title"; //NOI18N
-
- /**
- * No instance from this class
- */
- private PizzaProductDatabaseConstants () {
- }
-}
import java.text.MessageFormat;
import javax.servlet.http.HttpServletRequest;
-import org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants;
+import org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend;
/**
* An exception thrown when the given title is already used
*/
public CategoryTitleAlreadyUsedException (final HttpServletRequest request) {
// Call super constructor
- super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaCategoryDatabaseConstants.COLUMN_TITLE))); //NOI18N
+ super(MessageFormat.format("Title {0} is already used.", request.getParameter(CategoryFrontend.COLUMN_TITLE))); //NOI18N
}
-
}
import java.text.MessageFormat;
import javax.servlet.http.HttpServletRequest;
-import org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants;
+import org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend;
/**
* An exception thrown when the given title is already used
*/
public ProductTitleAlreadyUsedException (final HttpServletRequest request) {
// Call super constructor
- super(MessageFormat.format("Title {0} is already used.", request.getParameter(PizzaProductDatabaseConstants.COLUMN_TITLE))); //NOI18N
+ super(MessageFormat.format("Title {0} is already used.", request.getParameter(ProductFrontend.COLUMN_TITLE))); //NOI18N
}
-
}
--- /dev/null
+/*
+ * Copyright (C) 2015 quix0r
+ *
+ * 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 javax.servlet.jsp.tagext.BodyTag;
+import org.mxchange.pizzaapplication.beans.basket.BasketBean;
+
+/**
+ *
+ * @author quix0r
+ */
+public interface BasketTag extends BodyTag {
+
+ /**
+ * @return the basket
+ */
+ public BasketBean getBasket ();
+
+ /**
+ * @param basket the basket to set
+ */
+ public void setBasket (final BasketBean 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;
*
* @author Roland Haeder
*/
-@SessionScoped
-public class MiniBasketTag extends BodyTagSupport {
+public class MiniBasketTag extends BodyTagSupport implements BasketTag {
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 457415727452384L;
+
/**
* Basket instance
*/
- @Inject
private BasketBean basket;
/**
StringBuilder out = new StringBuilder("<div class=\"mini_basket\">\n");
// basket should not be null
- if (this.basket == null) {
+ if (this.getBasket() == null) {
// Not set
throw new NullPointerException("basket instance is null");
}
try {
// Some entries found?
- if (this.basket.isEmpty()) {
+ if (this.getBasket().isEmpty()) {
// Empty basket
out.append("<div class=\"mini_basket_info\">\n");
- out.append(this.basket.getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n");
+ out.append(this.getBasket().getMessageStringFromKey("MiniBasketTag.basket_is_empty")).append("\n");
out.append("</div>\n");
} else {
// Some times were found
try {
// Get output instance and write it
- pageContext.getOut().print(out.toString());
+ this.pageContext.getOut().print(out.toString());
} catch (final IOException ex) {
// Continue to throw
throw new JspException(ex);
// Don't process any body
return SKIP_BODY;
}
+
+ /**
+ * @return the basket
+ */
+ @Override
+ public BasketBean getBasket () {
+ return this.basket;
+ }
+
+ /**
+ * @param basket the basket to set
+ */
+ @Override
+ public void setBasket (final BasketBean basket) {
+ this.basket = basket;
+ }
}
<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>
+ <attribute>
+ <name>basket</name>
+ <description>Basket instance, should be the same as the bean</description>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+ <type>org.mxchange.pizzaapplication.beans.basket.BasketBean</type>
+ </attribute>
</tag>
</taglib>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page import="org.mxchange.pizzaapplication.category.Category"%>
-<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<%
- // Init application instance
- PizzaBean app = PizzaServiceBean.getInstance(application);
-%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
<!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">
</thead>
<tbody>
- <c:forEach var="category" items="<%=app.getCategories()%>">
+ <c:forEach var="category" items="<%=controller.getCategories()%>">
<tr>
<td>
- <input class="input" type="checkbox" name="<%=PizzaCategoryDatabaseConstants.COLUMN_ID%>[${category.getCategoryId()}]" value="1" />
+ <input class="input" type="checkbox" name="<%=CategoryFrontend.COLUMN_ID%>[${category.getCategoryId()}]" value="1" />
</td>
<td>
${category.decodedTitle()}
</div>
<div class="table_right">
- <input class="input" type="text" name="<%=PizzaCategoryDatabaseConstants.COLUMN_TITLE%>" size="10" maxlength="255" />
+ <input class="input" type="text" name="<%=CategoryFrontend.COLUMN_TITLE%>" size="10" maxlength="255" />
</div>
<div class="clear"></div>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
-<%
- // Init application instance
- 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>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
-<%@page import="org.mxchange.pizzaapplication.database.product.PizzaProductDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.product.ProductFrontend"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
-<%
- // Init application instance
- 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>
</thead>
<tbody>
- <c:forEach var="product" items="<%=app.getAllProducts()%>">
+ <c:forEach var="product" items="<%=controller.getAllProducts()%>">
<tr>
<td>
${product.getItemId()}:
</div>
<div class="table_right">
- <input class="input" type="text" name="<%=PizzaProductDatabaseConstants.COLUMN_TITLE%>" size="10" maxlength="255" />
+ <input class="input" type="text" name="<%=ProductFrontend.COLUMN_TITLE%>" size="10" maxlength="255" />
</div>
<div class="clear"></div>
</div>
<div class="table_right">
- <input class="input" type="text" name="<%=PizzaProductDatabaseConstants.COLUMN_PRICE%>" size="10" maxlength="255" />
+ <input class="input" type="text" name="<%=ProductFrontend.COLUMN_PRICE%>" size="10" maxlength="255" />
</div>
<div class="clear"></div>
Author : Roland Haeder
--%>
+<%@page import="org.mxchange.jcore.BaseFrameworkSystem"%>
<%--<%@page errorPage="errorHandler.jsp" %>--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
<%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+
<jsp:useBean id="item" scope="request" class="org.mxchange.pizzaapplication.item.basket.BasketItem" type="AddableBasketItem" />
<jsp:setProperty name="item" property="*" />
<%
- // Init application instance
- PizzaBean app = PizzaServiceBean.getInstance(application);
-
// Get amount from item
Long amount = item.getAmount();
// Debug message
- app.getLogger().debug("amount=" + amount);
+ BaseFrameworkSystem.getInstance().getLogger().debug("amount=" + amount);
// Is amount null or zero?
if ((null == amount) || (amount == 0)) {
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@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.beans.customer.CustomerBean" %>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page import="org.mxchange.pizzaapplication.exceptions.CategoryTitleAlreadyUsedException"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
<%
- // Init application instance
- PizzaBean app = PizzaServiceBean.getInstance(application);
-
// Handle forms
- app.doAdminHandleCategoryForms(request, response);
+ controller.doAdminHandleCategoryForms(request, response);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@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.beans.customer.CustomerBean" %>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
<%
- // Init application instance
- PizzaBean app = PizzaServiceBean.getInstance(application);
-
// Handle forms
- app.doAdminHandleProductForms(request, response);
+ controller.doAdminHandleProductForms(request, response);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+++ /dev/null
-<%--
- Document : order
- Created on : 07.08.2015, 14:58:21
- Author : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@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
- PizzaBean app = PizzaServiceBean.getInstance(application);
-
- // Is it post?
- if ("POST".equals(request.getMethod())) { //NOI18N
- // @TODO Handle saving customer data and such things
-
- // Mark all choosen products as ordered
- app.markAllChoosenProductsAsOrdered(request, session);
-
- // Redirect to proper URL
- // @TODO Commented out for developing:
- //response.sendRedirect(request.getContextPath() + "/finished.jsp");
-%>
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:setProperty name="customer" property="*" />
-<jsp:forward page="../finished.jsp" />
-<%
- }
-%>
-
-<!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>Pizza-Service - Form-Handler</title>
- </head>
-
- <body>
- <div id="title">
- <h1>Pizza-Service - Form-Handler</h1>
- </div>
-
- <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
- <jsp:include page="/static/error/direct_call.jsp" flush="false" />
- </body>
-</html>
+++ /dev/null
-<%--
- Document : order
- Created on : 04.08.2015, 10:55:10
- Author : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="java.util.Iterator"%>
-<%@page import="java.util.Map"%>
-<%@page import="org.mxchange.jcore.contact.Gender"%>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-<%@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
- PizzaBean app = PizzaServiceBean.getInstance(application);
-
- // Is it post?
- if ("POST".equals(request.getMethod())) { //NOI18N
- // 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();
-
- // Mark product as not ordered
- app.unmarkProductAsOrdered(product, session);
-
- // Is it choosen and amount set?
- if (app.isProductChoosen(product, request, session)) {
- // Then mark it as choosen
- app.markProductAsChoosen(product, session);
- } else {
- // Unmark it
- app.unmarkProductAsChoosen(product, session);
- }
- }
-
- // Redirect to proper URL
- // @TODO Commented out for developing:
- //response.sendRedirect(request.getContextPath() + "/finished.jsp");
-%>
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:setProperty name="customer" property="*" />
-<jsp:forward page="../preview.jsp" />
-<%
- }
-%>
-<!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>Pizza-Service - Form-Handler</title>
- </head>
-
- <body>
- <div id="title">
- <h1>Pizza-Service - Form-Handler</h1>
- </div>
-
- <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
-
- <jsp:include page="/static/error/direct_call.jsp" flush="false" />
- </body>
-</html>
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.PizzaApplication"%>
<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
<%@page import="org.mxchange.pizzaapplication.product.Product"%>
<%@page import="org.mxchange.pizzaapplication.basket.Basket"%>
<%@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" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
<!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">
</div>
<div id="content">
- <basket:mini_basket />
+ <basket:mini_basket basket="${controller.basket}" />
<table class="table">
<tr>
<%
// Get Iterator
- Iterator<Product> iterator = service.getAvailableProducts();
+ Iterator<Product> iterator = controller.getAvailableProducts();
// "Walk" through all products and unmark them as ordered
while (iterator.hasNext()) {
product.getLogger().debug("product.itemId=" + product.getItemId());
// Create an item instance form this product
- AddableBasketItem item = basket.getItem(product);
+ AddableBasketItem item = controller.getBasket().getItem(product);
// Debug message
product.getLogger().debug("item=" + item);
// Then skip this item
continue;
}
-
- // Unmark as ordered
- service.unmarkProductAsOrdered(product, session);
%>
<form action="<%=request.getContextPath()%>/form_handler/add_item.jsp" accept-charset="utf-8" id="form" method="post">
<table class="table">
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%@page import="org.mxchange.pizzaapplication.database.category.PizzaCategoryDatabaseConstants"%>
+<%@page import="org.mxchange.pizzaapplication.database.frontend.category.CategoryFrontend"%>
<%@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" />
+<jsp:useBean id="controller" 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="<%=service.getCategories()%>">
+<select class="select" name="<%=CategoryFrontend.COLUMN_ID%>" size="1">
+ <c:forEach var="category" items="<%=controller.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.database.frontend.category.CategoryFrontend"%>
<%@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" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
-<select class="select" name="<%=PizzaCategoryDatabaseConstants.COLUMN_PARENT%>" size="1">
+<select class="select" name="<%=CategoryFrontend.COLUMN_PARENT%>" size="1">
<option value="">Ist oberste Kategorie</option>
- <c:forEach var="category" items="<%=service.getCategories()%>">
+ <c:forEach var="category" items="<%=controller.getCategories()%>">
<option value="${category.getCategoryId()}">${category.decodedTitle()}</option>
</c:forEach>
</select>
<%@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" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
-<select class="select" name="gender" id="gender" size="1" <%=service.getDisabledHtmlFromSession(request, session)%>>
+<select class="select" name="gender" id="gender" size="1" <%=controller.getDisabledHtmlFromSession(request, session)%>>
<%
// "Walk" through all genders and output them
for (final Gender gender : Gender.values()) {