From: Roland Haeder Date: Thu, 24 Sep 2015 13:32:07 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b27f3915e36b6d06ea98abf8b4436886415f82df;p=pizzaservice-war.git Continued: - auto-reformatted many files - some getter names have changed, fixed here - parentId is no longer in Category objects, need to get parentCategory.categoryId - updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcore-logger-lib.jar b/lib/jcore-logger-lib.jar index ca19891b..ccc4dab7 100644 Binary files a/lib/jcore-logger-lib.jar and b/lib/jcore-logger-lib.jar differ diff --git a/lib/jcore.jar b/lib/jcore.jar index 57dc0a07..c0bdbee1 100644 Binary files a/lib/jcore.jar and b/lib/jcore.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 884b0d96..d550fe01 100644 Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ diff --git a/lib/jshop-core.jar b/lib/jshop-core.jar index 90365fe7..3e77fa79 100644 Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ diff --git a/lib/jshop-ee-lib.jar b/lib/jshop-ee-lib.jar index deaa0afb..28730218 100644 Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ diff --git a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java index 5421d9a1..b7fce984 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/basket/BasketWebController.java @@ -29,41 +29,57 @@ import org.mxchange.jshopcore.model.product.Product; public interface BasketWebController extends Serializable { /** - * Clears this basket instance + * Adds given product instance to basket by adding amount from form data to + * it. + * + * @param product Product instance to add + * @return Redirect target or null */ - public void clear (); + public String addItem (final Product product); /** - * Checks whether the basket is empty + * Gets for all added items * - * @return Whether the basket is empty + * @return A list of all added items */ - public boolean isEmpty (); + public List allItems (); /** - * Checks whether the basket has items in it. This method is wrapper to - * isEmpty() + * Calculates total price (no tax added) of current item. If no current item + * is set and no amount, a NPE is thrown. * - * @return Whether the basket is empty + * @return Current item's total price */ - public boolean hasItems (); + public Float calculateCurrentItemPrice (); /** - * Checks whether the currently set product is added in basked + * Calculates total price (no tax added) for given item. * - * @param product Product instance - * @return Whether the product is added + * @param item Item instance to calculate total price for + * @return Total price */ - public boolean isProductAdded (final Product product); + public Float calculateItemPrice (final AddableBasketItem item); /** - * Adds given product instance to basket by adding amount from form data to - * it. + * Calculates total sum (no tax added) for all items * - * @param product Product instance to add - * @return Redirect target or null + * @return Total price of all items */ - public String addItem (final Product product); + public Float calculateTotalPrice (); + + /** + * Changes given item instance's amount in basket and redirects to proper + * page. If the item is not found, another "error" page is called. + * + * @param item Item instance to change + * @return Page redirection + */ + public String changeItem (final AddableBasketItem item); + + /** + * Clears this basket instance + */ + public void clear (); /** * Getter for item amount property @@ -94,27 +110,14 @@ public interface BasketWebController extends Serializable { public void setCurrentItem (final AddableBasketItem currentItem); /** - * Calculates total price (no tax added) of current item. If no current item - * is set and no amount, a NPE is thrown. - * - * @return Current item's total price - */ - public Float calculateCurrentItemPrice (); - - /** - * Calculates total price (no tax added) for given item. - * - * @param item Item instance to calculate total price for - * @return Total price - */ - public Float calculateItemPrice (final AddableBasketItem item); - - /** - * Calculates total sum (no tax added) for all items + * Some getter for item amount of given product. This method requires a full + * iteration over all items in the basket to look for proper product + * instance. * - * @return Total price of all items + * @param product Product instance + * @return Item amount of given product */ - public Float calculateTotalPrice (); + public Long getItemAmount (final Product product); /** * Getter for last entry @@ -131,35 +134,32 @@ public interface BasketWebController extends Serializable { public int getLastNumRows (); /** - * Gets for all added items + * Checks whether the basket has items in it. This method is wrapper to + * isEmpty() * - * @return A list of all added items + * @return Whether the basket is empty */ - public List allItems (); + public boolean hasItems (); /** - * Some getter for item amount of given product. This method requires a full - * iteration over all items in the basket to look for proper product - * instance. - * - * @param product Product instance - * @return Item amount of given product + * Checks whether the basket is empty + * + * @return Whether the basket is empty */ - public Long getItemAmount (final Product product); + public boolean isEmpty (); /** - * Changes given item instance's amount in basket and redirects to proper - * page. If the item is not found, another "error" page is called. + * Checks whether the currently set product is added in basked * - * @param item Item instance to change - * @return Page redirection + * @param product Product instance + * @return Whether the product is added */ - public String changeItem (final AddableBasketItem item); + public boolean isProductAdded (final Product product); /** * Outputs last added item in the basket. - * + * * @return Last added item */ - public String outputLastAddedItem(); + public String outputLastAddedItem (); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java index 687ada65..2db3a58e 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebBean.java @@ -35,9 +35,10 @@ import org.mxchange.pizzaapplication.beans.shop.ShopWebController; * * @author Roland Haeder */ -@Named("admin_category") +@Named ("admin_category") @RequestScoped public class AdminCategoryWebBean implements AdminCategoryWebController { + /** * Serial number */ @@ -62,9 +63,9 @@ public class AdminCategoryWebBean implements AdminCategoryWebController { private String title; /** - * Parent id + * Parent category */ - private Long parentId; + private Category parentCategory; /** * Default constructor @@ -88,7 +89,7 @@ public class AdminCategoryWebBean implements AdminCategoryWebController { try { // Create category Category category = new ProductCategory(); - category.setParentId(this.getParentId()); + category.setParentCategory(this.getParentCategory()); category.setTitle(this.getTitle()); // Deligate to remote bean @@ -113,12 +114,12 @@ public class AdminCategoryWebBean implements AdminCategoryWebController { } @Override - public Long getParentId () { - return this.parentId; + public Category getParentCategory () { + return this.parentCategory; } @Override - public void setParentId (final Long parentId) { - this.parentId = parentId; + public void setParentCategory (final Category parentCategory) { + this.parentCategory = parentCategory; } } diff --git a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java index 545550ad..8ea0703d 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/category/AdminCategoryWebController.java @@ -17,6 +17,7 @@ package org.mxchange.pizzaapplication.beans.category; import javax.faces.view.facelets.FaceletException; +import org.mxchange.jshopcore.model.category.Category; /** * An interface for product controllers for "ADMIN" role @@ -28,35 +29,36 @@ public interface AdminCategoryWebController { /** * Adds given category data from request to database * - * @throws javax.faces.view.facelets.FaceletException If something unexpected happened + * @throws javax.faces.view.facelets.FaceletException If something + * unexpected happened */ public void addCategory () throws FaceletException; /** - * Getter for title + * Getter for parent id * - * @return the title + * @return Parent id */ - public String getTitle (); + public Category getParentCategory (); /** - * Setter for title + * Setter for parent category * - * @param title the title to set + * @param parentCategory Parent category to set */ - public void setTitle (final String title); + public void setParentCategory (final Category parentCategory); /** - * Getter for parent id + * Getter for title * - * @return Parent id + * @return the title */ - public Long getParentId (); + public String getTitle (); /** - * Setter for parent id + * Setter for title * - * @param parentId Parent id to set + * @param title the title to set */ - public void setParentId (final Long parentId); + public void setTitle (final String title); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java index c85fdb0d..726fabed 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java @@ -69,7 +69,7 @@ public class CheckoutWebBean implements CheckoutWebController { * Queue instance */ private Queue queue; - + /** * Session instance */ diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java index f314f02b..a3250207 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java @@ -25,9 +25,10 @@ import org.mxchange.jshopcore.model.customer.Customer; * @author Roland Haeder */ public interface CheckoutWebController extends Serializable { + /** * Runs the actual checkout and returns a proper page redirection target. - * + * * @return Page redirection target */ public String doCheckout (); diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java index 32638065..b9ccd5cc 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java @@ -23,7 +23,7 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import org.mxchange.jcore.model.contact.Contact; -import org.mxchange.jcore.model.contact.CustomerContact; +import org.mxchange.jcore.model.contact.UserContact; import org.mxchange.jcore.model.contact.gender.Gender; import org.mxchange.jshopcore.model.customer.Customer; import org.mxchange.jshopcore.model.customer.CustomerSessionBeanRemote; @@ -34,18 +34,15 @@ import org.mxchange.jshopcore.model.customer.ShopCustomer; * * @author Roland Haeder */ -@Named("customerController") +@Named ("customerController") @SessionScoped public class CustomerWebBean implements CustomerWebController { + /** * Serial number */ private static final long serialVersionUID = 542_145_347_916L; - /** - * Remote customer bean - */ - private final CustomerSessionBeanRemote customerBean; /////////////////////// Properties ///////////////////// /** @@ -72,16 +69,15 @@ public class CustomerWebBean implements CustomerWebController { * Country code */ private String countryCode; - /** - * Email address + * Remote customer bean */ - private String emailAddress; + private final CustomerSessionBeanRemote customerBean; /** - * Gender instance + * Email address */ - private Gender gender; + private String emailAddress; /** * Family name @@ -98,6 +94,11 @@ public class CustomerWebBean implements CustomerWebController { */ private String firstName; + /** + * Gender instance + */ + private Gender gender; + /** * House number */ @@ -150,11 +151,7 @@ public class CustomerWebBean implements CustomerWebController { Customer customer = new ShopCustomer(); // Create new contact - Contact contact = new CustomerContact(); - contact.setGender(this.getGender()); - contact.setFirstName(this.getFirstName()); - contact.setFamilyName(this.getFamilyName()); - contact.setCompanyName(this.getCompanyName()); + Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName(), this.getCompanyName()); contact.setStreet(this.getStreet()); contact.setHouseNumber(this.getHouseNumber()); contact.setZipCode(this.getZipCode()); @@ -174,103 +171,103 @@ public class CustomerWebBean implements CustomerWebController { } @Override - public Gender getGender () { - return this.gender; + public String getCellphoneNumber () { + return this.cellphoneNumber; } @Override - public void setGender (final Gender gender) { - this.gender = gender; + public void setCellphoneNumber (final String cellphoneNumber) { + this.cellphoneNumber = cellphoneNumber; } @Override - public String getCompanyName () { - return this.companyName; + public String getCity () { + return this.city; } @Override - public void setCompanyName (final String companyName) { - this.companyName = companyName; + public void setCity (final String city) { + this.city = city; } @Override - public String getFirstName () { - return this.firstName; + public String getCompanyName () { + return this.companyName; } @Override - public void setFirstName (final String firstName) { - this.firstName = firstName; + public void setCompanyName (final String companyName) { + this.companyName = companyName; } @Override - public String getFamilyName () { - return this.familyName; + public String getCountryCode () { + return this.countryCode; } @Override - public void setFamilyName (final String familyName) { - this.familyName = familyName; + public void setCountryCode (final String countryCode) { + this.countryCode = countryCode; } @Override - public String getStreet () { - return this.street; + public String getEmailAddress () { + return this.emailAddress; } @Override - public void setStreet (final String street) { - this.street = street; + public void setEmailAddress (final String emailAddress) { + this.emailAddress = emailAddress; } @Override - public Long getHouseNumber () { - return this.houseNumber; + public String getFamilyName () { + return this.familyName; } @Override - public void setHouseNumber (final Long houseNumber) { - this.houseNumber = houseNumber; + public void setFamilyName (final String familyName) { + this.familyName = familyName; } @Override - public Long getZipCode () { - return this.zipCode; + public String getFaxNumber () { + return this.faxNumber; } @Override - public void setZipCode (final Long zipCode) { - this.zipCode = zipCode; + public void setFaxNumber (final String faxNumber) { + this.faxNumber = faxNumber; } @Override - public String getCity () { - return this.city; + public String getFirstName () { + return this.firstName; } @Override - public void setCity (final String city) { - this.city = city; + public void setFirstName (final String firstName) { + this.firstName = firstName; } @Override - public String getCountryCode () { - return this.countryCode; + public Gender getGender () { + return this.gender; } @Override - public void setCountryCode (final String countryCode) { - this.countryCode = countryCode; + public void setGender (final Gender gender) { + this.gender = gender; } @Override - public String getEmailAddress () { - return this.emailAddress; + public Long getHouseNumber () { + return this.houseNumber; } @Override - public void setEmailAddress (final String emailAddress) { - this.emailAddress = emailAddress; + public void setHouseNumber (final Long houseNumber) { + this.houseNumber = houseNumber; } @Override @@ -284,23 +281,23 @@ public class CustomerWebBean implements CustomerWebController { } @Override - public String getFaxNumber () { - return this.faxNumber; + public String getStreet () { + return this.street; } @Override - public void setFaxNumber (final String faxNumber) { - this.faxNumber = faxNumber; + public void setStreet (final String street) { + this.street = street; } @Override - public String getCellphoneNumber () { - return this.cellphoneNumber; + public Long getZipCode () { + return this.zipCode; } @Override - public void setCellphoneNumber (final String cellphoneNumber) { - this.cellphoneNumber = cellphoneNumber; + public void setZipCode (final Long zipCode) { + this.zipCode = zipCode; } @Override diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java index 554e9c1d..cc6c07ea 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java @@ -35,144 +35,144 @@ public interface CustomerWebController extends Serializable { public Customer createCustomerInstance (); /** - * Gender of the contact + * Cellphone number * - * @return the gender + * @return the cellphoneNumber */ - public Gender getGender (); + public String getCellphoneNumber (); /** - * Gender of the contact + * Cellphone number * - * @param gender the gender to set + * @param cellphoneNumber the cellphoneNumber to set */ - public void setGender (final Gender gender); + public void setCellphoneNumber (final String cellphoneNumber); /** - * Company name + * City * - * @return the companyName + * @return the city */ - public String getCompanyName (); + public String getCity (); /** - * Company name + * City * - * @param companyName the companyName to set + * @param city the city to set */ - public void setCompanyName (final String companyName); + public void setCity (final String city); /** - * First name + * Company name * - * @return the first name + * @return the companyName */ - public String getFirstName (); + public String getCompanyName (); /** - * First name + * Company name * - * @param firstName the first name to set + * @param companyName the companyName to set */ - public void setFirstName (final String firstName); + public void setCompanyName (final String companyName); /** - * Family name + * Country code * - * @return the familyName + * @return the countryCode */ - public String getFamilyName (); + public String getCountryCode (); /** - * Family name + * Country code * - * @param familyName the familyName to set + * @param countryCode the countryCode to set */ - public void setFamilyName (final String familyName); + public void setCountryCode (final String countryCode); /** - * Street + * Email address * - * @return the street + * @return the emailAddress */ - public String getStreet (); + public String getEmailAddress (); /** - * Street + * Email address * - * @param street the street to set + * @param emailAddress the emailAddress to set */ - public void setStreet (final String street); + public void setEmailAddress (final String emailAddress); /** - * House number + * Family name * - * @return the houseNumber + * @return the familyName */ - public Long getHouseNumber (); + public String getFamilyName (); /** - * House number + * Family name * - * @param houseNumber the houseNumber to set + * @param familyName the familyName to set */ - public void setHouseNumber (final Long houseNumber); + public void setFamilyName (final String familyName); /** - * ZIP code + * Fax number * - * @return the zipCode + * @return the faxNumber */ - public Long getZipCode (); + public String getFaxNumber (); /** - * ZIP code + * Fax number * - * @param zipCode the zipCode to set + * @param faxNumber the faxNumber to set */ - public void setZipCode (final Long zipCode); + public void setFaxNumber (final String faxNumber); /** - * City + * First name * - * @return the city + * @return the first name */ - public String getCity (); + public String getFirstName (); /** - * City + * First name * - * @param city the city to set + * @param firstName the first name to set */ - public void setCity (final String city); + public void setFirstName (final String firstName); /** - * Country code + * Gender of the contact * - * @return the countryCode + * @return the gender */ - public String getCountryCode (); + public Gender getGender (); /** - * Country code + * Gender of the contact * - * @param countryCode the countryCode to set + * @param gender the gender to set */ - public void setCountryCode (final String countryCode); + public void setGender (final Gender gender); /** - * Email address + * House number * - * @return the emailAddress + * @return the houseNumber */ - public String getEmailAddress (); + public Long getHouseNumber (); /** - * Email address + * House number * - * @param emailAddress the emailAddress to set + * @param houseNumber the houseNumber to set */ - public void setEmailAddress (final String emailAddress); + public void setHouseNumber (final Long houseNumber); /** * Phone number @@ -189,32 +189,32 @@ public interface CustomerWebController extends Serializable { public void setPhoneNumber (final String phoneNumber); /** - * Fax number + * Street * - * @return the faxNumber + * @return the street */ - public String getFaxNumber (); + public String getStreet (); /** - * Fax number + * Street * - * @param faxNumber the faxNumber to set + * @param street the street to set */ - public void setFaxNumber (final String faxNumber); + public void setStreet (final String street); /** - * Cellphone number + * ZIP code * - * @return the cellphoneNumber + * @return the zipCode */ - public String getCellphoneNumber (); + public Long getZipCode (); /** - * Cellphone number + * ZIP code * - * @param cellphoneNumber the cellphoneNumber to set + * @param zipCode the zipCode to set */ - public void setCellphoneNumber (final String cellphoneNumber); + public void setZipCode (final Long zipCode); /** * Checks whether all required personal data is set diff --git a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java index 29b26d0f..90fa3dea 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/product/AdminProductWebController.java @@ -30,7 +30,8 @@ public interface AdminProductWebController { /** * Adds given product data from request to database * - * @throws javax.faces.view.facelets.FaceletException If something unexpected happened + * @throws javax.faces.view.facelets.FaceletException If something + * unexpected happened */ public void addProduct () throws FaceletException; @@ -43,58 +44,58 @@ public interface AdminProductWebController { public List getAllProducts () throws FaceletException; /** - * Getter for product's title property + * Getter for product's available property * - * @return Product's title + * @return Product's available property */ - public String getTitle (); + public Boolean getAvailable (); /** - * Setter for product's title property - * - * @param title Product's title + * Setter for product's available property + * + * @param available Product's available property */ - public void setTitle (final String title); + public void setAvailable (final Boolean available); /** - * Getter for product's price property + * Getter for product's category id * - * @return Product's price property + * @return Product's category id */ - public Float getPrice (); + public Long getId (); /** - * Setter for product's price property - * - * @param price Product's price property + * Setter for product's category id + * + * @param id Product's category id */ - public void setPrice (final Float price); + public void setId (final Long id); /** - * Setter for product's available property - * - * @param available Product's available property + * Getter for product's price property + * + * @return Product's price property */ - public void setAvailable (final Boolean available); + public Float getPrice (); /** - * Getter for product's available property - * - * @return Product's available property + * Setter for product's price property + * + * @param price Product's price property */ - public Boolean getAvailable (); + public void setPrice (final Float price); /** - * Getter for product's category id + * Getter for product's title property * - * @return Product's category id + * @return Product's title */ - public Long getId (); + public String getTitle (); /** - * Setter for product's category id + * Setter for product's title property * - * @param id Product's category id + * @param title Product's title */ - public void setId (final Long id); + public void setTitle (final String title); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java index 07f2bd66..a06cda1e 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java @@ -25,6 +25,7 @@ import org.mxchange.jshopcore.model.customer.Customer; * @author Roland Haeder */ public interface ReceiptWebController extends Serializable { + /** * Fetches last access key for given customer instance * @@ -33,16 +34,16 @@ public interface ReceiptWebController extends Serializable { public String fetchAccessKey (); /** - * Setter for customer instamce + * Getter for customer instamce * - * @param customer Customer instance + * @return Customer instance */ - public void setCustomer (final Customer customer); + public Customer getCustomer (); /** - * Getter for customer instamce + * Setter for customer instamce * - * @return Customer instance + * @param customer Customer instance */ - public Customer getCustomer (); + public void setCustomer (final Customer customer); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java index 172c4bc6..9b233a73 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebBean.java @@ -39,7 +39,7 @@ import org.mxchange.jshopcore.model.product.ProductSessionBeanRemote; * * @author Roland Haeder */ -@Named("controller") +@Named ("controller") @ApplicationScoped public class ShopWebBean extends BaseEeSystem implements ShopWebController { @@ -73,29 +73,6 @@ public class ShopWebBean extends BaseEeSystem implements ShopWebController { } } - @PostConstruct - public void init () { - try { - // Get initial context - Context context = new InitialContext(); - - // Try to lookup the bean - CategorySessionBeanRemote categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N - - // Get all categories - this.categories = categoryBean.getAllCategories(); - - // Try to lookup the bean - ProductSessionBeanRemote productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N - - // Get available products list - this.availableProducts = productBean.getAvailableProducts(); - } catch (final NamingException e) { - // Continued to throw - throw new FacesException(e); - } - } - @Override public List getAllCategories () throws FacesException { // Return it @@ -109,7 +86,7 @@ public class ShopWebBean extends BaseEeSystem implements ShopWebController { List deque = new LinkedList<>(); // Create fake entry - Category fake = new ProductCategory(0L, this.getMessageStringFromKey("ADMIN_CATEGORY_HAS_NO_PARENT"), 0L); //NOI18N + Category fake = new ProductCategory(0L, this.getMessageStringFromKey("ADMIN_CATEGORY_HAS_NO_PARENT"), null); //NOI18N // Add it deque.add(fake); @@ -127,4 +104,27 @@ public class ShopWebBean extends BaseEeSystem implements ShopWebController { // TODO Find something better here to prevent warning return Collections.unmodifiableList(this.availableProducts); } + + @PostConstruct + public void init () { + try { + // Get initial context + Context context = new InitialContext(); + + // Try to lookup the bean + CategorySessionBeanRemote categoryBean = (CategorySessionBeanRemote) context.lookup("ejb/stateless-category"); //NOI18N + + // Get all categories + this.categories = categoryBean.getAllCategories(); + + // Try to lookup the bean + ProductSessionBeanRemote productBean = (ProductSessionBeanRemote) context.lookup("ejb/stateless-product"); //NOI18N + + // Get available products list + this.availableProducts = productBean.getAvailableProducts(); + } catch (final NamingException e) { + // Continued to throw + throw new FacesException(e); + } + } } diff --git a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebController.java b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebController.java index efdadb28..4de37aa2 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/shop/ShopWebController.java @@ -43,14 +43,6 @@ public interface ShopWebController extends Serializable { */ public void addProduct (final Product product); - /** - * Some "getter" for a linked list of only available products - * - * @return Only available products - * @throws javax.faces.view.facelets.FaceletException If anything went wrong - */ - public List getAvailableProducts () throws FaceletException; - /** * Some "getter" for a linked list of all categories * @@ -67,4 +59,12 @@ public interface ShopWebController extends Serializable { * @throws javax.faces.view.facelets.FaceletException If anything went wrong */ public List getAllCategoriesParent () throws FaceletException; + + /** + * Some "getter" for a linked list of only available products + * + * @return Only available products + * @throws javax.faces.view.facelets.FaceletException If anything went wrong + */ + public List getAvailableProducts () throws FaceletException; } diff --git a/src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java b/src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java index 944bfd0c..9e2cf9db 100644 --- a/src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java +++ b/src/java/org/mxchange/pizzaapplication/servlet/receipt/PdfReceiptServlet.java @@ -62,6 +62,11 @@ public class PdfReceiptServlet extends HttpServlet { } } + @Override + public String getServletInfo () { + return "Produces an official recipit as PDF file for given access key."; + } + @Override protected void doGet (final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { // Is the key set? @@ -83,9 +88,4 @@ public class PdfReceiptServlet extends HttpServlet { this.doGet(request, response); } - @Override - public String getServletInfo () { - return "Produces an official recipit as PDF file for given access key."; - } - } diff --git a/web/WEB-INF/templates/admin/admin_category_selection_box.tpl b/web/WEB-INF/templates/admin/admin_category_selection_box.tpl index 6841d027..3141b802 100644 --- a/web/WEB-INF/templates/admin/admin_category_selection_box.tpl +++ b/web/WEB-INF/templates/admin/admin_category_selection_box.tpl @@ -5,7 +5,7 @@ xmlns:ui="http://java.sun.com/jsf/facelets"> - + diff --git a/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl b/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl index 9d87117a..ef9e7100 100644 --- a/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl +++ b/web/WEB-INF/templates/admin/admin_parent_category_selection_box.tpl @@ -4,7 +4,7 @@ xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"> - - + + diff --git a/web/WEB-INF/templates/basket/total_sum.tpl b/web/WEB-INF/templates/basket/total_sum.tpl index c350d77c..274f9a49 100644 --- a/web/WEB-INF/templates/basket/total_sum.tpl +++ b/web/WEB-INF/templates/basket/total_sum.tpl @@ -1,11 +1,11 @@ + xmlns="http://www.w3.org/1999/xhtml" + xmlns:ui="http://java.sun.com/jsf/facelets" + xmlns:h="http://xmlns.jcp.org/jsf/html" + xmlns:f="http://xmlns.jcp.org/jsf/core" + >
diff --git a/web/admin/category.xhtml b/web/admin/category.xhtml index 8db504cc..021b989a 100644 --- a/web/admin/category.xhtml +++ b/web/admin/category.xhtml @@ -29,12 +29,12 @@ #{msg.ADMIN_ENTER_CATEGORY_TITLE} - #{cat.title} + #{cat.title} #{msg.ADMIN_PARENT_CATEGORY} - #{cat.parentId} + #{cat.parentCategory.categoryId} @@ -48,45 +48,45 @@
-
-
- #{msg.ADMIN_ADD_CATEGORY_TITLE} -
+
+
+ #{msg.ADMIN_ADD_CATEGORY_TITLE} +
-
- #{msg.PLEASE_FILL_ALL_FIELDS} +
+ #{msg.PLEASE_FILL_ALL_FIELDS} -
-
- #{msg.ADMIN_ENTER_CATEGORY_TITLE} -
#{msg.ADMIN_ENTER_CATEGORY_TITLE_EXAMPLE}
-
+
+
+ #{msg.ADMIN_ENTER_CATEGORY_TITLE} +
#{msg.ADMIN_ENTER_CATEGORY_TITLE_EXAMPLE}
+
-
- +
+ +
+ +
-
-
+
+
+ #{msg.ADMIN_PARENT_CATEGORY} +
-
-
- #{msg.ADMIN_PARENT_CATEGORY} -
+
+ +
-
- +
+
-
+ -
- - -
diff --git a/web/admin/product.xhtml b/web/admin/product.xhtml index c1427f2f..33b0a9d7 100644 --- a/web/admin/product.xhtml +++ b/web/admin/product.xhtml @@ -28,22 +28,22 @@ #{msg.ADMIN_ENTER_PRODUCT_TITLE} - #{product.title} + #{product.title} #{msg.SINGLE_ITEM_PRICE} - #{product.price} + #{product.price} #{msg.CATEGORY} - #{product.categoryId} + #{product.categoryId} #{msg.IS_AVAILABLE} - #{product.available} + #{product.available} @@ -57,73 +57,73 @@
-
-
- #{msg.ADMIN_ADD_PRODUCT_TITLE} -
+
+
+ #{msg.ADMIN_ADD_PRODUCT_TITLE} +
-
- #{msg.PLEASE_FILL_ALL_FIELDS} +
+ #{msg.PLEASE_FILL_ALL_FIELDS} -
-
- #{msg.ADMIN_ENTER_PRODUCT_TITLE} -
#{msg.ADMIN_ENTER_PRODUCT_TITLE_EXAMPLE}
-
+
+
+ #{msg.ADMIN_ENTER_PRODUCT_TITLE} +
#{msg.ADMIN_ENTER_PRODUCT_TITLE_EXAMPLE}
+
-
- +
+ +
+ +
-
-
+
+
+ #{msg.SINGLE_ITEM_PRICE} +
(z.B. 50.0)
+
-
-
- #{msg.SINGLE_ITEM_PRICE} -
(z.B. 50.0)
-
+
+ +
-
- +
-
-
+
+
+ #{msg.CATEGORY} +
-
-
- #{msg.CATEGORY} -
+
+ +
-
- +
-
-
+
+
+ #{msg.IS_AVAILABLE} +
-
-
- #{msg.IS_AVAILABLE} -
+
+ + + + +
-
- - - - +
+
-
+ -
- - -
diff --git a/web/errorHandler.xhtml b/web/errorHandler.xhtml index 8d19de41..adb51696 100644 --- a/web/errorHandler.xhtml +++ b/web/errorHandler.xhtml @@ -1,7 +1,7 @@ -<%-- - Document : errorHandler - Created on : 05.08.2015, 12:06:39 - Author : Roland Haeder +<%-- +Document : errorHandler +Created on : 05.08.2015, 12:06:39 +Author : Roland Haeder --%> <%@page import="java.io.PrintWriter"%> diff --git a/web/index.xhtml b/web/index.xhtml index 225b9c29..5e10ffb6 100644 --- a/web/index.xhtml +++ b/web/index.xhtml @@ -34,7 +34,7 @@
- #{product.title} + #{product.title}