From: Roland Haeder Date: Mon, 21 Sep 2015 10:15:25 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cdb74558e500fadede7d54b5a2d264c4e42cc205;p=pizzaservice-war.git Continued: - added controller for receicpt link (maybe not working) - updated jars Signed-off-by:Roland Häder --- diff --git a/lib/jcore-ee-logger.jar b/lib/jcore-ee-logger.jar index 903d0168..a3e9a18a 100644 Binary files a/lib/jcore-ee-logger.jar and b/lib/jcore-ee-logger.jar differ diff --git a/lib/jcoreee.jar b/lib/jcoreee.jar index 42674a26..6061f285 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 5f4906c7..4fed9f73 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 0301ab7d..b6766657 100644 Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 71688694..ee9577bd 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -882,6 +882,9 @@ exists or setup the property manually. For example like this: + + + @@ -890,6 +893,9 @@ exists or setup the property manually. For example like this: + + + @@ -1035,6 +1041,7 @@ exists or setup the property manually. For example like this: + @@ -1050,6 +1057,7 @@ exists or setup the property manually. For example like this: + @@ -1475,6 +1483,7 @@ exists or setup the property manually. For example like this: + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 96ec5171..6164bbce 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -1,8 +1,8 @@ -build.xml.data.CRC32=d49c3b3c +build.xml.data.CRC32=6c97d849 build.xml.script.CRC32=82213886 build.xml.stylesheet.CRC32=651128d4@1.68.1.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=d49c3b3c -nbproject/build-impl.xml.script.CRC32=6d5d44eb +nbproject/build-impl.xml.data.CRC32=6c97d849 +nbproject/build-impl.xml.script.CRC32=353b1688 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/nbproject/project.properties b/nbproject/project.properties index 71fed62f..4d8c4b20 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -60,6 +60,7 @@ j2ee.server.type=gfv3ee6 jar.compress=false javac.classpath=\ ${file.reference.jcore.jar}:\ + ${reference.jcore-logger-lib.jar}:\ ${reference.jcore-ee-logger.dist}:\ ${file.reference.jcoreee.jar}:\ ${file.reference.jshop-core.jar}:\ @@ -99,9 +100,11 @@ lib.dir=${web.docbase.dir}/WEB-INF/lib persistence.xml.dir=${conf.dir} platform.active=default_platform project.jcore-ee-logger=../jcore-ee-logger +project.jcore-logger-lib=../jcore-logger-lib project.license=gpl30 project.PizzaService-lib=../pizzaservice-lib reference.jcore-ee-logger.dist=${project.jcore-ee-logger}/dist/jcore-ee-logger.jar +reference.jcore-logger-lib.jar=${project.jcore-logger-lib}/dist/jcore-logger-lib.jar reference.PizzaService-lib.jar=${project.PizzaService-lib}/dist/PizzaService-lib.jar resource.dir=setup run.test.classpath=\ diff --git a/nbproject/project.xml b/nbproject/project.xml index be28ec74..6ebdb53c 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -10,6 +10,10 @@ ${file.reference.jcore.jar} WEB-INF/lib + + ${reference.jcore-logger-lib.jar} + WEB-INF/lib + ${reference.jcore-ee-logger.dist} WEB-INF/lib @@ -79,6 +83,14 @@ clean dist + + jcore-logger-lib + jar + + jar + clean + jar + diff --git a/src/java/org/mxchange/localization/bundle_de_DE.properties b/src/java/org/mxchange/localization/bundle_de_DE.properties index adf460f3..fafeed6e 100644 --- a/src/java/org/mxchange/localization/bundle_de_DE.properties +++ b/src/java/org/mxchange/localization/bundle_de_DE.properties @@ -164,3 +164,4 @@ PAGE_TITLE_CUSTOMER_CHECKOUT_DONE=Bestellvorgang abgeschlossen SUB_TITLE_CUSTOMER_CHECKOUT_DONE=Der Bestellvorgang ist abgeschlossen: PAGE_TITLE_CUSTOMER_EMPTY_BASKET=Leerer Warenkorb! SUB_TITLE_CUSTOMER_EMPTY_BASKET=Sie haben keine Artikel zum Warenkorb hinzugef\u00fcgt: +LINK_OPEN_RECEIPT=Rechnung ansehen diff --git a/src/java/org/mxchange/localization/bundle_en_US.properties b/src/java/org/mxchange/localization/bundle_en_US.properties index 9c43e8de..a804c136 100644 --- a/src/java/org/mxchange/localization/bundle_en_US.properties +++ b/src/java/org/mxchange/localization/bundle_en_US.properties @@ -162,3 +162,4 @@ PAGE_TITLE_CUSTOMER_CHECKOUT_DONE=Checkout done SUB_TITLE_CUSTOMER_CHECKOUT_DONE=The checkout is completed: PAGE_TITLE_CUSTOMER_EMPTY_BASKET=Empty basket! SUB_TITLE_CUSTOMER_EMPTY_BASKET=You have no products added to basket: +LINK_OPEN_RECEIPT=View receipt diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java index 3de6f0ea..eedb20d5 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java @@ -41,6 +41,7 @@ import org.mxchange.jshopcore.wrapper.CheckoutWrapper; import org.mxchange.jshopcore.wrapper.WrapableCheckout; import org.mxchange.pizzaapplication.beans.basket.BasketWebController; import org.mxchange.pizzaapplication.beans.customer.CustomerWebController; +import org.mxchange.pizzaapplication.beans.receipt.ReceiptWebController; /** * Checkout controller @@ -70,7 +71,7 @@ public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebCon * Queue instance */ private Queue queue; - + /** * Session instance */ @@ -81,6 +82,11 @@ public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebCon */ private ObjectMessage message; + /** + * Customer instance + */ + private Customer customer; + ////////////////////// Bean injections /////////////////////// /** * Basket bean @@ -94,6 +100,12 @@ public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebCon @Inject private CustomerWebController customerController; + /** + * Receipt bean + */ + @Inject + private ReceiptWebController receiptController; + @Override public String doCheckout () { // Trace message @@ -124,10 +136,10 @@ public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebCon } // Create customer instance - Customer customer = this.customerController.createInstance(); + this.setCustomer(this.customerController.createCustomerInstance()); // Debug message - this.getLogger().logDebug(MessageFormat.format("doCheckout: customer={0}", customer)); + this.getLogger().logDebug(MessageFormat.format("doCheckout: customer={0}", this.getCustomer())); // Get ordered list List list = this.basketController.allItems(); @@ -137,7 +149,7 @@ public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebCon // Construct container WrapableCheckout wrapper = new CheckoutWrapper(); - wrapper.setCustomer(customer); + wrapper.setCustomer(this.getCustomer()); wrapper.setList(list); try { @@ -155,10 +167,23 @@ public class CheckoutWebBean extends BaseFrameworkBean implements CheckoutWebCon // Clear basket this.basketController.clear(); + // Set customer in receipt controller for verification + this.receiptController.setCustomer(this.getCustomer()); + // All fine return "checkout_done"; //NOI18N } + @Override + public Customer getCustomer () { + return this.customer; + } + + @Override + public void setCustomer (final Customer customer) { + this.customer = customer; + } + @PostConstruct public void init () { // Call super init for getting resource bundle diff --git a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java index 4e30f29f..f314f02b 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java @@ -17,6 +17,7 @@ package org.mxchange.pizzaapplication.beans.checkout; import java.io.Serializable; +import org.mxchange.jshopcore.model.customer.Customer; /** * An interface for the shop @@ -30,4 +31,18 @@ public interface CheckoutWebController extends Serializable { * @return Page redirection target */ public String doCheckout (); + + /** + * Getter for customer instance + * + * @return Customer instance + */ + public Customer getCustomer (); + + /** + * Setter for customer instance + * + * @param customer Customer instance + */ + public void setCustomer (final Customer customer); } diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java index 298b056d..4bb35042 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java @@ -140,7 +140,7 @@ public class CustomerWebBean extends BaseFrameworkBean implements CustomerWebCon } @Override - public Customer createInstance () { + public Customer createCustomerInstance () { // Trace message this.getLogger().logTrace("createInstance: CALLED!"); // Required personal data must be set diff --git a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java index e912d05d..554e9c1d 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java @@ -32,7 +32,7 @@ public interface CustomerWebController extends Serializable { * * @return A Customer instance */ - public Customer createInstance (); + public Customer createCustomerInstance (); /** * Gender of the contact diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebBean.java new file mode 100644 index 00000000..1c6c3e4a --- /dev/null +++ b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebBean.java @@ -0,0 +1,83 @@ +/* + * 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 . + */ +package org.mxchange.pizzaapplication.beans.receipt; + +import javax.enterprise.context.SessionScoped; +import javax.faces.FacesException; +import javax.inject.Named; +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import org.mxchange.jcoreee.beans.BaseFrameworkBean; +import org.mxchange.jshopcore.model.customer.Customer; +import org.mxchange.jshopcore.model.receipt.ReceiptBeanRemote; + +/** + * Checkout controller + * + * @author Roland Haeder + */ +@Named ("receiptController") +@SessionScoped +public class ReceiptWebBean extends BaseFrameworkBean implements ReceiptWebController { + + /** + * Serial number + */ + private static final long serialVersionUID = 95_723_834_783_478_781L; + + /** + * Customer instance + */ + private Customer customer; + + /** + * Remote bean instance + */ + private ReceiptBeanRemote receiptBean; + + /** + * Default constructor + */ + public ReceiptWebBean () { + try { + // Get initial context + Context context = new InitialContext(); + + // Get factory from JMS resource + this.receiptBean = (ReceiptBeanRemote) context.lookup("ejb/stateless-receipt"); + } catch (final NamingException e) { + // Continued to throw + throw new FacesException(e); + } + } + + @Override + public String fetchAccessKey () { + return this.receiptBean.fetchAccessKey(this.getCustomer()); + } + + @Override + public Customer getCustomer () { + return this.customer; + } + + @Override + public void setCustomer (final Customer customer) { + this.customer = customer; + } +} diff --git a/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java new file mode 100644 index 00000000..07f2bd66 --- /dev/null +++ b/src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java @@ -0,0 +1,48 @@ +/* + * 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 . + */ +package org.mxchange.pizzaapplication.beans.receipt; + +import java.io.Serializable; +import org.mxchange.jshopcore.model.customer.Customer; + +/** + * An interface for the shop + * + * @author Roland Haeder + */ +public interface ReceiptWebController extends Serializable { + /** + * Fetches last access key for given customer instance + * + * @return Access key to receipt + */ + public String fetchAccessKey (); + + /** + * Setter for customer instamce + * + * @param customer Customer instance + */ + public void setCustomer (final Customer customer); + + /** + * Getter for customer instamce + * + * @return Customer instance + */ + public Customer getCustomer (); +} diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml index 8a6b22d8..6c71590e 100644 --- a/web/WEB-INF/faces-config.xml +++ b/web/WEB-INF/faces-config.xml @@ -102,4 +102,11 @@ /customer/empty_basket.xhtml + + /admin/admin_logout.xhtml + + index + /* + + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index 6899c50e..30b3e002 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -22,7 +22,7 @@ text/plain - pdfRecipt + pdf /customer/recipt.pdf diff --git a/web/customer/checkout_done.xhtml b/web/customer/checkout_done.xhtml index 16460f55..4d1b8621 100644 --- a/web/customer/checkout_done.xhtml +++ b/web/customer/checkout_done.xhtml @@ -18,7 +18,11 @@ - TODO: Noch offen + Rechnung abrufen: + + + +