]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued with project:
authorRoland Haeder <roland@mxchange.org>
Fri, 7 Aug 2015 09:56:20 +0000 (11:56 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 7 Aug 2015 09:57:31 +0000 (11:57 +0200)
- Included displaying of gender and translation (yes, there is a better way doing internalizations than this one)
- Introduced BasePizzaServiceSystem which is a general class for (almost) all other classes
- Moved some classes to proper location

Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
src/java/org/mxchange/pizzaapplication/beans/CustomerBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java [deleted file]
src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java [new file with mode: 0644]
web/finished.jsp
web/order.jsp

index 4b4c3c2de16034568690ed961bfc3b34de3e8ea4..f7de050362d27f4dea276b22965f814f3f0c39ff 100644 (file)
@@ -12,3 +12,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+BaseContact.gender.unknown.text=Unbekannt
+BaseContact.gender.male.text=Herr
+BaseContact.gender.female.text=Frau
+BaseContact.gender.company.text=Firma
index 4b4c3c2de16034568690ed961bfc3b34de3e8ea4..0813997e1742c59347999690ad157d600846b234 100644 (file)
@@ -12,3 +12,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+BaseContact.gender.unknown.text=Unknown
+BaseContact.gender.male.text=Mr.
+BaseContact.gender.female.text=Mrs.
+BaseContact.gender.company.text=Company
diff --git a/src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java b/src/java/org/mxchange/pizzaapplication/BasePizzaServiceSystem.java
new file mode 100644 (file)
index 0000000..84f1e1c
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+import org.mxchange.jcore.BaseFrameworkSystem;
+
+/**
+ * A general class for whole pizza application.
+ *
+ * @author Roland Haeder
+ */
+public class BasePizzaServiceSystem extends BaseFrameworkSystem {
+       
+}
index 8a6e4bf116d6429dc6af9986e6fdc801effaace9..e856628a96f8435570873237b1cd9bdf95ff3064 100644 (file)
@@ -25,7 +25,7 @@ import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
-import org.mxchange.jcore.BaseFrameworkSystem;
+import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
 import org.mxchange.pizzaapplication.product.PizzaProduct;
 import org.mxchange.pizzaapplication.product.Product;
 
@@ -33,7 +33,7 @@ import org.mxchange.pizzaapplication.product.Product;
  *
  * @author Roland Haeder
  */
-public class PizzaServiceApplication extends BaseFrameworkSystem implements PizzaApplication {
+public class PizzaServiceApplication extends BasePizzaServiceSystem implements PizzaApplication {
        /**
         * Main title
         */
diff --git a/src/java/org/mxchange/pizzaapplication/beans/CustomerBean.java b/src/java/org/mxchange/pizzaapplication/beans/CustomerBean.java
new file mode 100644 (file)
index 0000000..0902343
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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;
+
+import org.mxchange.pizzaapplication.customer.Customer;
+
+/**
+ * An interface for customer beans
+ *
+ * @author Roland Haeder
+ */
+public interface CustomerBean extends Customer, Iterable<Object> {
+}
diff --git a/src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java b/src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java
deleted file mode 100644 (file)
index e1edf34..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.customer.bean;
-
-import org.mxchange.pizzaapplication.customer.Customer;
-import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
-
-/**
- * A customer bean which hides the customer instance
- *
- * @author Roland Haeder
- */
-public class CustomerBean extends PizzaServiceCustomer implements Customer {
-
-       /**
-        * Default constructor
-        */
-       public CustomerBean () {
-               // Init customer instance
-               Customer customer = new PizzaServiceCustomer();
-
-               // Set it here
-               this.setContact(customer);
-       }
-}
diff --git a/src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java b/src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java
new file mode 100644 (file)
index 0000000..88a6d3a
--- /dev/null
@@ -0,0 +1,248 @@
+/*
+ * 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.customer.bean;
+
+import java.util.Iterator;
+import org.mxchange.jcore.client.Client;
+import org.mxchange.jcore.contact.Contact;
+import org.mxchange.jcore.contact.Gender;
+import org.mxchange.pizzaapplication.BasePizzaServiceSystem;
+import org.mxchange.pizzaapplication.beans.CustomerBean;
+import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer;
+
+/**
+ * A customer bean which hides the customer instance
+ *
+ * @author Roland Haeder
+ */
+public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements CustomerBean {
+       /**
+        * Default constructor
+        */
+       public PizzaServiceCustomerBean () {
+               // Instance customer
+               Contact customer = new PizzaServiceCustomer();
+
+               // Init bundle
+               this.initBundle();
+
+               // And set it here
+               this.setContact(customer);
+       }
+
+       @Override
+       public String getBirthday () {
+               // Deligate to "hidden" object
+               return this.getContact().getBirthday();
+       }
+
+       @Override
+       public void setBirthday (final String birthday) {
+               // Deligate to "hidden" object
+               this.getContact().setBirthday(birthday);
+       }
+
+       @Override
+       public String getCellphoneNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getCellphoneNumber();
+       }
+
+       @Override
+       public void setCellphoneNumber (final String cellphoneNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setCellphoneNumber(cellphoneNumber);
+       }
+
+       @Override
+       public String getCity () {
+               // Deligate to "hidden" object
+               return this.getContact().getCity();
+       }
+
+       @Override
+       public void setCity (final String city) {
+               // Deligate to "hidden" object
+               this.getContact().setCity(city);
+       }
+
+       @Override
+       public String getComment () {
+               // Deligate to "hidden" object
+               return this.getContact().getComment();
+       }
+
+       @Override
+       public void setComment (final String comment) {
+               // Deligate to "hidden" object
+               this.getContact().setComment(comment);
+       }
+
+       @Override
+       public String getCompanyName () {
+               // Deligate to "hidden" object
+               return this.getContact().getCompanyName();
+       }
+
+       @Override
+       public void setCompanyName (final String companyName) {
+               // Deligate to "hidden" object
+               this.getContact().setCompanyName(companyName);
+       }
+
+       @Override
+       public String getCountryCode () {
+               // Deligate to "hidden" object
+               return this.getContact().getCountryCode();
+       }
+
+       @Override
+       public void setCountryCode (final String countryCode) {
+               // Deligate to "hidden" object
+               this.getContact().setCountryCode(countryCode);
+       }
+
+       @Override
+       public String getEmailAddress () {
+               // Deligate to "hidden" object
+               return this.getContact().getEmailAddress();
+       }
+
+       @Override
+       public void setEmailAddress (final String emailAddress) {
+               // Deligate to "hidden" object
+               this.getContact().setEmailAddress(emailAddress);
+       }
+
+       @Override
+       public String getFamilyName () {
+               // Deligate to "hidden" object
+               return this.getContact().getFamilyName();
+       }
+
+       @Override
+       public void setFamilyName (final String familyName) {
+               // Deligate to "hidden" object
+               this.getContact().setFamilyName(familyName);
+       }
+
+       @Override
+       public String getFaxNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getFaxNumber();
+       }
+
+       @Override
+       public void setFaxNumber (final String faxNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setFaxNumber(faxNumber);
+       }
+
+       @Override
+       public Gender getGender () {
+               // Deligate to "hidden" object
+               return this.getContact().getGender();
+       }
+
+       @Override
+       public void setGender (final Gender gender) {
+               // Deligate to "hidden" object
+               this.getContact().setGender(gender);
+       }
+
+       @Override
+       public long getHouseNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getHouseNumber();
+       }
+
+       @Override
+       public void setHouseNumber (final long houseNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setHouseNumber(houseNumber);
+       }
+
+       @Override
+       public String getPhoneNumber () {
+               // Deligate to "hidden" object
+               return this.getContact().getPhoneNumber();
+       }
+
+       @Override
+       public void setPhoneNumber (final String phoneNumber) {
+               // Deligate to "hidden" object
+               this.getContact().setPhoneNumber(phoneNumber);
+       }
+
+       @Override
+       public String getStreet () {
+               // Deligate to "hidden" object
+               return this.getContact().getStreet();
+       }
+
+       @Override
+       public void setStreet (final String street) {
+               // Deligate to "hidden" object
+               this.getContact().setStreet(street);
+       }
+
+       @Override
+       public String getSurname () {
+               // Deligate to "hidden" object
+               return this.getContact().getSurname();
+       }
+
+       @Override
+       public void setSurname (final String surname) {
+               // Deligate to "hidden" object
+               this.getContact().setSurname(surname);
+       }
+
+       @Override
+       public String getTranslatedGender () {
+               // Deligate to "hidden" object
+               return this.getContact().getTranslatedGender();
+       }
+
+       @Override
+       public long getZipCode () {
+               // Deligate to "hidden" object
+               return this.getContact().getZipCode();
+       }
+
+       @Override
+       public void setZipCode (final long zipCode) {
+               // Deligate to "hidden" object
+               this.getContact().setZipCode(zipCode);
+       }
+
+       @Override
+       public boolean isOwnContact () {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+
+       @Override
+       public Iterator<Object> iterator () {
+               // Deligate to "hidden" object
+               return this.getContact().iterator();
+       }
+
+       @Override
+       public void show (final Client client) {
+               throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+       }
+}
index 61b604bab7216c525aee76a731f2d098b454e784..6adaf51a49490820a668134982069c5b7ed0505f 100644 (file)
@@ -4,19 +4,17 @@
        Author     : Roland Haeder
 --%>
 
-<%--
-<%@page errorPage="errorHandler.jsp" %>
---%>
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.customer.Customer" %>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 
-<jsp:useBean id="customer" scope="request" class="org.mxchange.pizzaapplication.customer.bean.CustomerBean" type="Customer" />
+<jsp:useBean id="customer" scope="request" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
 <jsp:setProperty name="customer" property="*" />
 
 <%
                                                        </td>
                                                </tr>
 
+                                               <tr>
+                                                       <td colspan="5" class="table_header">
+                                                               Ihre Daten:
+                                                       </td>
+                                               </tr>
+
+                                               <tr>
+                                                       <td colspan="5" class="table_header">
+                                                               <%
+                                                               Iterator<Object> fieldIterator = customer.iterator();
+                                                               %>
+                                                               <ul>
+                                                               <%
+                                                               while (fieldIterator.hasNext()) {
+                                                               %>
+                                                                       <li><%=fieldIterator.next()%></li>
+                                                               <%
+                                                               }
+                                                               %>
+                                                               </ul>
+                                                       </td>
+                                               </tr>
+
                                                <tr>
                                                        <td colspan="5" class="table_footer">
                                                                <%
index cc190c179266c828bdfaf872d2aa45c8ecc39d8c..57b8786b16b5e519232af348fe354c34014b6346 100644 (file)
@@ -4,16 +4,18 @@
        Author     : Roland Haeder
 --%>
 
-<%@page errorPage="errorHandler.jsp" %>
+<%@page import="org.mxchange.jcore.contact.Gender"%>
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page import="java.util.Iterator"%>
 <%@page import="java.util.Map"%>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.customer.Customer" %>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.CustomerBean" type="Customer" />
+<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
+
 <jsp:setProperty name="customer" property="*" />
 
 <%
                                                                        <legend title="Bitte geben Sie Ihre Daten ein.">Bitte Ihre Daten eingeben:</legend>
 
                                                                        <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="gender">Anrede</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <select name="gender" id="gender" size="1">
+                                                                                               <%
+                                                                                               Gender[] genders = Gender.values();
+                                                                                               for (Gender gender : genders) {
+                                                                                                       %>
+                                                                                                       <option value="<%=gender.getDatabaseValue()%>"><%=gender%></option>
+                                                                                                       <%
+                                                                                               }
+                                                                                               %>
+                                                                                       </select>
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
                                                                        <div class="data_row">
                                                                                <div class="data_left">
                                                                                        <label for="companyname">Firmenname:</label>
                                                                                <div class="clear"></div>
                                                                        </div>
 
+                                                                       <div class="data_row">
                                                                                <div class="data_left">
                                                                                        <label for="surname">Vorname:</label>
                                                                                </div>