<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">
<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">
<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"/>
</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"/>
<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}">
-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
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}:\
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=\
<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>
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
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
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
* Queue instance
*/
private Queue queue;
-
+
/**
* Session instance
*/
*/
private ObjectMessage message;
+ /**
+ * Customer instance
+ */
+ private Customer customer;
+
////////////////////// Bean injections ///////////////////////
/**
* Basket bean
@Inject
private CustomerWebController customerController;
+ /**
+ * Receipt bean
+ */
+ @Inject
+ private ReceiptWebController receiptController;
+
@Override
public String doCheckout () {
// Trace message
}
// 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();
// Construct container
WrapableCheckout wrapper = new CheckoutWrapper();
- wrapper.setCustomer(customer);
+ wrapper.setCustomer(this.getCustomer());
wrapper.setList(list);
try {
// 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
package org.mxchange.pizzaapplication.beans.checkout;
import java.io.Serializable;
+import org.mxchange.jshopcore.model.customer.Customer;
/**
* An interface for the shop
* @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);
}
}
@Override
- public Customer createInstance () {
+ public Customer createCustomerInstance () {
// Trace message
this.getLogger().logTrace("createInstance: CALLED!");
// Required personal data must be set
*
* @return A Customer instance
*/
- public Customer createInstance ();
+ public Customer createCustomerInstance ();
/**
* Gender of the 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.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;
+ }
+}
--- /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.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 ();
+}
<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>
<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>
</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">