]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Mon, 21 Sep 2015 10:15:25 +0000 (12:15 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 21 Sep 2015 10:15:25 +0000 (12:15 +0200)
- added controller for receicpt link (maybe not working)
- updated jars
Signed-off-by:Roland Häder <roland@mxchange.org>

19 files changed:
lib/jcore-ee-logger.jar
lib/jcoreee.jar
lib/jshop-core.jar
lib/jshop-ee-lib.jar
nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.properties
nbproject/project.xml
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebBean.java
src/java/org/mxchange/pizzaapplication/beans/checkout/CheckoutWebController.java
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/CustomerWebController.java
src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/receipt/ReceiptWebController.java [new file with mode: 0644]
web/WEB-INF/faces-config.xml
web/WEB-INF/web.xml
web/customer/checkout_done.xhtml

index 903d01684cac1cda94982d4a7c57c683c021ed75..a3e9a18a174e09d63605848180af6d80a61cb381 100644 (file)
Binary files a/lib/jcore-ee-logger.jar and b/lib/jcore-ee-logger.jar differ
index 42674a26cdfe924a0f1bbc181451a5e055c6db1b..6061f285cd719c267ee2f1a5e8a526abc4202328 100644 (file)
Binary files a/lib/jcoreee.jar and b/lib/jcoreee.jar differ
index 5f4906c7ffb49defc0f43891ed5564ef2af01111..4fed9f73c33604283902aa6f749660ecf52e01d2 100644 (file)
Binary files a/lib/jshop-core.jar and b/lib/jshop-core.jar differ
index 0301ab7d83c831b0e4ead827bd127b1f4a059983..b67666574e2101e939da483758ad9566bddb56f9 100644 (file)
Binary files a/lib/jshop-ee-lib.jar and b/lib/jshop-ee-lib.jar differ
index 71688694bd5d53c3a4169b416fc56b5c446ad6da..ee9577bd80cabdc45135fd73f25402cc7e449a2b 100644 (file)
@@ -882,6 +882,9 @@ exists or setup the property manually. For example like this:
             <property name="deploy.on.save" value="false"/>
         </ant>
         <ant antfile="${project.jcore-ee-logger}/build.xml" inheritall="false" target="dist"/>
+        <ant antfile="${project.jcore-logger-lib}/build.xml" inheritall="false" target="jar">
+            <property name="deploy.on.save" value="false"/>
+        </ant>
     </target>
     <target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps">
         <ant antfile="${project.PizzaService-lib}/build.xml" inheritall="false" target="jar">
@@ -890,6 +893,9 @@ exists or setup the property manually. For example like this:
         <ant antfile="${project.jcore-ee-logger}/build.xml" inheritall="false" target="dist-ear">
             <property location="${build.dir}" name="dist.ear.dir"/>
         </ant>
+        <ant antfile="${project.jcore-logger-lib}/build.xml" inheritall="false" target="jar">
+            <property name="deploy.on.save" value="false"/>
+        </ant>
     </target>
     <target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
     <target depends="init,deps-jar" name="-pre-pre-compile">
@@ -1035,6 +1041,7 @@ exists or setup the property manually. For example like this:
     <target depends="init,compile,compile-jsps,-pre-dist,-do-dist-with-manifest,-do-dist-without-manifest" name="do-dist"/>
     <target depends="init" if="dist.ear.dir" name="library-inclusion-in-manifest">
         <copyfiles files="${file.reference.jcore.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${reference.jcore-logger-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${reference.jcore-ee-logger.dist}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}"/>
         <copyfiles files="${file.reference.jcoreee.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jshop-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
@@ -1050,6 +1057,7 @@ exists or setup the property manually. For example like this:
     </target>
     <target depends="init" name="library-inclusion-in-archive" unless="dist.ear.dir">
         <copyfiles files="${file.reference.jcore.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${reference.jcore-logger-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${reference.jcore-ee-logger.dist}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jcoreee.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jshop-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
@@ -1475,6 +1483,7 @@ exists or setup the property manually. For example like this:
     <target depends="init" name="deps-clean" unless="no.deps">
         <ant antfile="${project.PizzaService-lib}/build.xml" inheritall="false" target="clean"/>
         <ant antfile="${project.jcore-ee-logger}/build.xml" inheritall="false" target="clean"/>
+        <ant antfile="${project.jcore-logger-lib}/build.xml" inheritall="false" target="clean"/>
     </target>
     <target depends="init" name="do-clean">
         <condition property="build.dir.to.clean" value="${build.web.dir}">
index 96ec5171f758ec98e0a9994d92b692240e085277..6164bbce761a3fdc8b14ba3929b4ae730938c19b 100644 (file)
@@ -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
index 71fed62f545e39da2be0d37cf160284678579878..4d8c4b20b74ac238dc00d664e59ac6498499fc7b 100644 (file)
@@ -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=\
index be28ec7484aad5d70dfba850532582529e334c6c..6ebdb53c761a0df06b3768694ac644a931934d13 100644 (file)
                     <file>${file.reference.jcore.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
+                <library dirs="200">
+                    <file>${reference.jcore-logger-lib.jar}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
                 <library dirs="100">
                     <file>${reference.jcore-ee-logger.dist}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 <clean-target>clean</clean-target>
                 <id>dist</id>
             </reference>
+            <reference>
+                <foreign-project>jcore-logger-lib</foreign-project>
+                <artifact-type>jar</artifact-type>
+                <script>build.xml</script>
+                <target>jar</target>
+                <clean-target>clean</clean-target>
+                <id>jar</id>
+            </reference>
         </references>
     </configuration>
 </project>
index adf460f3df41b21414624bf65d987f1efa62e6df..fafeed6e878a8a39089b41d3803a8c3ed4526355 100644 (file)
@@ -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
index 9c43e8defb97c69a875e9451a290a24f4ec355d7..a804c1366242f905a699fcb168d065b34050ad79 100644 (file)
@@ -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
index 3de6f0eab6987cb717694b7e1bf2648adadcafff..eedb20d5ce9987f4edf699734b7e0970249a4330 100644 (file)
@@ -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<AddableBasketItem> 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
index 4e30f29f417dc44996452519b2c17d0d8e320ee4..f314f02b354e29157ff9b2b9e3cd1b81298c10cf 100644 (file)
@@ -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);
 }
index 298b056d9fdc19155c97ad7c988e06793a405b45..4bb3504268896db92d090e5b3531c47375e023c2 100644 (file)
@@ -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
index e912d05dfe83b872436f5e0973d013c84091f1c6..554e9c1dd2f6df6f54bf503284c1c836fd7c1ab2 100644 (file)
@@ -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 (file)
index 0000000..1c6c3e4
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+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<roland@mxchange.org>
+ */
+@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 (file)
index 0000000..07f2bd6
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+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<roland@mxchange.org>
+ */
+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 ();
+}
index 8a6b22d8c98950b85f0ddc0c338fd74d6e2927ca..6c71590e39303f74b1ebe057174e418007501fa4 100644 (file)
                        <to-view-id>/customer/empty_basket.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
+       <navigation-rule>
+               <from-view-id>/admin/admin_logout.xhtml</from-view-id>
+               <navigation-case>
+                       <from-outcome>index</from-outcome>
+                       <to-view-id>/*</to-view-id>
+               </navigation-case>
+       </navigation-rule>
 </faces-config>
index 6899c50e501ee16aef1db48493e25f1bba26cb1a..30b3e002b9a3c7e12a8deb69b9fa0619ea5b8f51 100644 (file)
@@ -22,7 +22,7 @@
                <mime-type>text/plain</mime-type>
        </mime-mapping>
        <servlet-mapping>
-               <servlet-name>pdfRecipt</servlet-name>
+               <servlet-name>pdf</servlet-name>
                <url-pattern>/customer/recipt.pdf</url-pattern>
        </servlet-mapping>
        <session-config>
index 16460f5577cf9369916b5e1fc2ea1640de5343e7..4d1b86215e0242d92c17fb0a4ee70ca8c6edf1b9 100644 (file)
                </ui:define>
 
                <ui:define name="content">
-                       TODO: Noch offen
+                       Rechnung abrufen:
+                       <h:link class="receipt_link" id="receipt" outcome="pdf" value="#{msg.LINK_OPEN_RECEIPT}" target="_blank">
+                               <f:param name="customer" value="#{checkoutController.customer.id}" />
+                               <f:param name="key" value="#{receiptController.fetchAccessKey()}" />
+                       </h:link>
                </ui:define>
 
                <ui:define name="footer">