import java.text.MessageFormat;
import java.util.List;
-import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.FacesException;
import javax.faces.view.facelets.FaceletException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
import org.mxchange.jshopcore.exceptions.BasketItemAlreadyAddedException;
import org.mxchange.jshopcore.model.basket.AddableBasketItem;
import org.mxchange.jshopcore.model.basket.Basket;
*/
@Named ("basketController")
@SessionScoped
-public class BasketWebBean extends BaseFrameworkBean implements BasketWebController {
+public class BasketWebBean implements BasketWebController {
/**
* Serial number
@Override
public String addItem (final Product product) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("addItem: product={0} - CALLED!", product));
+ //this.getLogger().logTrace(MessageFormat.format("addItem: product={0} - CALLED!", product));
// product should not be null
if (null == product) {
// Is amount set?
if (this.getAmount() == null) {
// Trace message
- this.getLogger().logTrace("addItem: amount not specified, returning null ... - EXIT!");
+ //this.getLogger().logTrace("addItem: amount not specified, returning null ... - EXIT!");
// No amount specified?!
return null;
this.setAmount(null);
// Trace message
- this.getLogger().logTrace(MessageFormat.format("addItem: item {0} - has been added to basket. - EXIT!", item));
+ //this.getLogger().logTrace(MessageFormat.format("addItem: item {0} - has been added to basket. - EXIT!", item));
// Added
return "item_added"; //NOI18N
@Override
public List<AddableBasketItem> allItems () {
// Trace message
- this.getLogger().logTrace("allItems: CALLED!");
+ //this.getLogger().logTrace("allItems: CALLED!");
// Deligate to basket instance
List<AddableBasketItem> list = this.basket.getAll();
// Trace message
- this.getLogger().logTrace(MessageFormat.format("allItems: list={0} - EXIT!", list));
+ //this.getLogger().logTrace(MessageFormat.format("allItems: list={0} - EXIT!", list));
// Return it
return list;
@Override
public Float calculateCurrentItemPrice () {
// Trace message
- this.getLogger().logTrace("calculateCurrentItemPrice: CALLED!");
+ //this.getLogger().logTrace("calculateCurrentItemPrice: CALLED!");
// Is the current item/amount set?
if (this.getCurrentItem() == null) {
Float totalPrice = (this.getCurrentItem().getProduct().getPrice() * this.getCurrentItem().getAmount());
// Trace message
- this.getLogger().logTrace(MessageFormat.format("calculateCurrentItemPrice: totalPrice={0} - EXIT!", totalPrice));
+ //this.getLogger().logTrace(MessageFormat.format("calculateCurrentItemPrice: totalPrice={0} - EXIT!", totalPrice));
// Return it
return totalPrice;
@Override
public Float calculateItemPrice (final AddableBasketItem item) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: item={0} - CALLED!", item));
+ //this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: item={0} - CALLED!", item));
// item must not be null
if (null == item) {
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: totalPrice={0} - EXIT!", totalPrice));
+ //this.getLogger().logTrace(MessageFormat.format("calculateItemPrice: totalPrice={0} - EXIT!", totalPrice));
// Return it
return totalPrice;
@Override
public Float calculateTotalPrice () {
// Trace message
- this.getLogger().logTrace("calculateTotalPrice: CALLED!");
+ //this.getLogger().logTrace("calculateTotalPrice: CALLED!");
// Init total price
Float totalPrice = 0.0f;
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("calculateTotalPrice: totalPrice={0} - EXIT!", totalPrice));
+ //this.getLogger().logTrace(MessageFormat.format("calculateTotalPrice: totalPrice={0} - EXIT!", totalPrice));
// Return final sum
return totalPrice;
@Override
public String changeItem (final AddableBasketItem item) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("changeItem: item={0} - CALLED!", item));
+ //this.getLogger().logTrace(MessageFormat.format("changeItem: item={0} - CALLED!", item));
// item shall not be null
if (null == item) {
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("changeItem: targetPage={0} - EXIT!", targetPage));
+ //this.getLogger().logTrace(MessageFormat.format("changeItem: targetPage={0} - EXIT!", targetPage));
// Return page
return targetPage;
@Override
public Long getItemAmount (final Product product) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("getItemAmount: product={0} - CALLED!", product));
+ //this.getLogger().logTrace(MessageFormat.format("getItemAmount: product={0} - CALLED!", product));
// product should not be null
if (null == product) {
// Iterate over all
for (final AddableBasketItem item : this.allItems()) {
// Debug message
- this.getLogger().logDebug(MessageFormat.format("getItemAmount: item={0}", item));
+ //this.getLogger().logDebug(MessageFormat.format("getItemAmount: item={0}", item));
// Is this product instance and same?
if (null == item) {
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("getItemAmount: itemAmount={0} - EXIT!", itemAmount));
+ //this.getLogger().logTrace(MessageFormat.format("getItemAmount: itemAmount={0} - EXIT!", itemAmount));
// Return it
return itemAmount;
return (!this.isEmpty());
}
- @PostConstruct
- public void init () {
- // Call generic init first
- super.genericInit();
- }
-
@Override
public boolean isEmpty () {
// Deligate to basket instance
@Override
public boolean isProductAdded (final Product product) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("isProductAdded: product={0} - EXIT!", product));
+ //this.getLogger().logTrace(MessageFormat.format("isProductAdded: product={0} - EXIT!", product));
// Must not be null
if (null == product) {
AddableBasketItem fake = new BasketItem(product);
// Debug message
- this.getLogger().logDebug(MessageFormat.format("isProductAdded: fake={0}", fake));
+ //this.getLogger().logDebug(MessageFormat.format("isProductAdded: fake={0}", fake));
// Ask bean about it
boolean isAdded = this.basket.isAdded(fake);
// Debug message
- this.getLogger().logDebug(MessageFormat.format("isProductAdded: isAdded={0}", isAdded));
+ //this.getLogger().logDebug(MessageFormat.format("isProductAdded: isAdded={0}", isAdded));
// Is it added?
if (isAdded) {
AddableBasketItem item = this.getItemFromProduct(product);
// Debug message
- this.getLogger().logDebug(MessageFormat.format("isProductAdded: item={0} - setting as current item.", item));
+ //this.getLogger().logDebug(MessageFormat.format("isProductAdded: item={0} - setting as current item.", item));
// Set this as current item
this.setCurrentItem(item);
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("isProductAdded: isAdded={0} - EXIT!", isAdded));
+ //this.getLogger().logTrace(MessageFormat.format("isProductAdded: isAdded={0} - EXIT!", isAdded));
// Return status
return isAdded;
@Override
public String outputLastAddedItem () {
// Trace message
- this.getLogger().logTrace("outputLastAddedItem: CALLED!");
+ //this.getLogger().logTrace("outputLastAddedItem: CALLED!");
// Default message
String lastItem = ""; //NOI18N
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("outputLastAddedItem: lastItem={0} - EXIT!", lastItem));
+ //this.getLogger().logTrace(MessageFormat.format("outputLastAddedItem: lastItem={0} - EXIT!", lastItem));
// Return it
return lastItem;
*/
private AddableBasketItem getItemFromProduct (final Product product) {
// Trace message
- this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: product={0} - CALLED!", product));
+ //this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: product={0} - CALLED!", product));
// Product must not be null
if (null == product) {
AddableBasketItem fake = new BasketItem(product);
// Debug message
- this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: fake={0}", fake));
+ //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: fake={0}", fake));
// Get all items
List<AddableBasketItem> list = this.basket.getAll();
// Debug message
- this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: list={0}", list));
+ //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: list={0}", list));
// Check all entries
for (final AddableBasketItem item : list) {
// Debug message
- this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: item={0}", item));
+ //this.getLogger().logDebug(MessageFormat.format("getItemFromProduct: item={0}", item));
// item must not be null
if (null == item) {
}
// Trace message
- this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: foundItem={0} - EXIT!", foundItem));
+ //this.getLogger().logTrace(MessageFormat.format("getItemFromProduct: foundItem={0} - EXIT!", foundItem));
// Return it
return foundItem;
*/
package org.mxchange.pizzaapplication.beans.checkout;
-import java.text.MessageFormat;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
import org.mxchange.jshopcore.model.basket.AddableBasketItem;
import org.mxchange.jshopcore.model.customer.Customer;
import org.mxchange.jshopcore.wrapper.CheckoutWrapper;
*/
@Named ("checkoutController")
@SessionScoped
-public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebController {
+public class CheckoutWebBean implements CheckoutWebController {
/**
* Serial number
@Override
public String doCheckout () {
// Trace message
- this.getLogger().logTrace("doCheckout: CALLED!");
+ //this.getLogger().logTrace("doCheckout: CALLED!");
// Are the beans set?
if (null == this.basketController) {
// Are at least the required fields set?
if (!this.customerController.isRequiredPersonalDataSet()) {
// Trace message
- this.getLogger().logTrace("doCheckout: Not all required fields are set, returning checkout2 ... - EXIT!");
+ //this.getLogger().logTrace("doCheckout: Not all required fields are set, returning checkout2 ... - EXIT!");
// Not set, should not happen
return "checkout2"; //NOI18N
} else if (this.basketController.isEmpty()) {
// Trace message
- this.getLogger().logTrace("doCheckout: basket is empty, returning empty_basket ... - EXIT!");
+ //this.getLogger().logTrace("doCheckout: basket is empty, returning empty_basket ... - EXIT!");
// Nothing to order
return "empty_basket"; //NOI18N
this.setCustomer(this.customerController.createCustomerInstance());
// Debug message
- this.getLogger().logDebug(MessageFormat.format("doCheckout: customer={0}", this.getCustomer()));
+ //this.getLogger().logDebug(MessageFormat.format("doCheckout: customer={0}", this.getCustomer()));
// Get ordered list
List<AddableBasketItem> list = this.basketController.allItems();
// Debug message
- this.getLogger().logTrace(MessageFormat.format("doCheckout: list={0}", list));
+ //this.getLogger().logTrace(MessageFormat.format("doCheckout: list={0}", list));
// Construct container
WrapableCheckout wrapper = new CheckoutWrapper();
@PostConstruct
public void init () {
- // Call super init for getting resource bundle
- super.genericInit();
-
try {
// Get initial context
Context context = new InitialContext();
*/
package org.mxchange.pizzaapplication.beans.customer;
-import java.text.MessageFormat;
-import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.faces.view.facelets.FaceletException;
import javax.inject.Named;
import org.mxchange.jcore.model.contact.Contact;
import org.mxchange.jcore.model.contact.CustomerContact;
import org.mxchange.jcore.model.contact.gender.Gender;
-import org.mxchange.jcoreee.beans.BaseFrameworkBean;
import org.mxchange.jshopcore.model.customer.Customer;
import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote;
import org.mxchange.jshopcore.model.customer.ShopCustomer;
*/
@Named("customerController")
@SessionScoped
-public class CustomerWebBean extends BaseFrameworkBean implements CustomerWebController {
+public class CustomerWebBean implements CustomerWebController {
/**
* Serial number
*/
@Override
public Customer createCustomerInstance () {
// Trace message
- this.getLogger().logTrace("createInstance: CALLED!");
+ //this.getLogger().logTrace("createInstance: CALLED!");
+
// Required personal data must be set
assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
customer.setContact(contact);
// Trace message
- this.getLogger().logTrace(MessageFormat.format("createInstance: customer={0} - EXIT!", customer));
+ //this.getLogger().logTrace(MessageFormat.format("createInstance: customer={0} - EXIT!", customer));
// Return it
return customer;
}
- @PostConstruct
- public void init () throws RuntimeException {
- // Call super init first
- super.genericInit();
- }
-
@Override
public Gender getGender () {
return this.gender;