]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued:
authorRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 07:10:04 +0000 (09:10 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 07:10:04 +0000 (09:10 +0200)
- added jcountry-core + jcountry-lib
- added bean for country data retrieval
Signed-off-by:Roland Häder <roland@mxchange.org>

lib/jcountry-lib.jar [new file with mode: 0644]
nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.xml
src/java/org/mxchange/pizzaapplication/beans/country/CountryWebBean.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/beans/country/CountryWebController.java [new file with mode: 0644]
web/WEB-INF/templates/generic/form_personal_data.tpl

diff --git a/lib/jcountry-lib.jar b/lib/jcountry-lib.jar
new file mode 100644 (file)
index 0000000..f917c1d
Binary files /dev/null and b/lib/jcountry-lib.jar differ
index 1a6f7cb7c90b58e264ea5c80bf083687761b4505..4bfee71fb1c035265a7fe955bc064ee3074c9c90 100644 (file)
@@ -1034,6 +1034,7 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.jcore-logger-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcoreee.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcountry-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+        <copyfiles files="${file.reference.jcountry-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jphone-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcontacts-core.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"/>
@@ -1049,6 +1050,7 @@ exists or setup the property manually. For example like this:
         <copyfiles files="${file.reference.jcore-logger-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jcoreee.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jcountry-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+        <copyfiles files="${file.reference.jcountry-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jphone-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jcontacts-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jshop-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
index 502b5f11aaeb9254cc82e14644c9966640805ee2..380295333006369322bfb80d9bcc0bb9c494e3ee 100644 (file)
@@ -3,6 +3,6 @@ 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=2f309951
-nbproject/build-impl.xml.script.CRC32=fc9d2f6b
+nbproject/build-impl.xml.data.CRC32=3d4ee603
+nbproject/build-impl.xml.script.CRC32=1aff867f
 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
index 078ef3c9decee8cd16be00f7bb7d2277f26a8180..9d65d23174785fcb775f4283aca75db936d34644 100644 (file)
                     <file>${file.reference.jcountry-core.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
+                <library dirs="200">
+                    <file>${file.reference.jcountry-lib.jar}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
                 <library dirs="200">
                     <file>${file.reference.jphone-core.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebBean.java b/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebBean.java
new file mode 100644 (file)
index 0000000..940a42e
--- /dev/null
@@ -0,0 +1,82 @@
+package org.mxchange.pizzaapplication.beans.country;
+
+/*
+ * 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/>.
+ */
+import java.util.Collections;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
+
+/**
+ * A country bean
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("country")
+@ApplicationScoped
+public class CountryWebBean implements CountryWebController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 176_985_298_681_742_960L;
+
+       /**
+        * Remote country EJB
+        */
+       private final CountrySingletonBeanRemote countryBean;
+
+       /**
+        * List of all countries
+        */
+       private List<Country> countryList;
+
+       /**
+        * Default constructor
+        */
+       public CountryWebBean () {
+               // Try this
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Try to lookup the bean
+                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("ejb/addressbook-singleton-country"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw
+                       throw new FaceletException(ex);
+               }
+       }
+
+       @Override
+       public List<Country> allCountries () {
+               // Return "cached" version
+               return Collections.unmodifiableList(this.countryList);
+       }
+
+       @PostConstruct
+       public void init () {
+               this.countryList = this.countryBean.allCountries();
+       }
+}
diff --git a/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebController.java b/src/java/org/mxchange/pizzaapplication/beans/country/CountryWebController.java
new file mode 100644 (file)
index 0000000..666fab6
--- /dev/null
@@ -0,0 +1,36 @@
+package org.mxchange.pizzaapplication.beans.country;
+
+/*
+ * 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/>.
+ */
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcountry.data.Country;
+
+/**
+ * An interface for country beans
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+public interface CountryWebController extends Serializable {
+
+       /**
+        * A list of all countries
+        * <p>
+        * @return All countries
+        */
+       public List<Country> allCountries ();
+}
index 35f7ae94155fc7377ba3bb315ca8a84ddb5e1cf5..26da8c966a4da22e9e002b17cdc98797e58e4808 100644 (file)
                                <div class="clear"></div>
                        </div>
 
+                       <div class="table_row">
+                               <div class="table_left">
+                                       <h:outputLabel for="country" value="#{msg.PERSONAL_DATA_COUNTRY_CODE}" />
+                               </div>
+
+                               <div class="table_right">
+                                       <h:selectOneMenu class="select" id="country" value="#{userController.country}">
+                                               <f:selectItems value="#{country.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{msg[c.countryI18nkey]}" />
+                                       </h:selectOneMenu>
+                               </div>
+
+                               <div class="clear"></div>
+                       </div>
+
                        <div class="table_row">
                                <div class="table_left">
                                        <h:outputLabel for="phoneNumber" value="#{msg.PERSONAL_DATA_PHONE_NUMBER}" />