]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
introduced new lib jphone-lib.jar which holds remote interfaces for jphone-core
authorRoland Haeder <roland@mxchange.org>
Sat, 9 Apr 2016 16:10:27 +0000 (18:10 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 9 Apr 2016 16:10:27 +0000 (18:10 +0200)
30 files changed:
lib/jphone-lib.jar [new file with mode: 0644]
nbproject/build-impl.xml
nbproject/genfiles.properties
nbproject/project.properties
nbproject/project.xml
src/java/org/mxchange/jshopcore/model/category/PizzaCategoryConverter.java
src/java/org/mxchange/localization/bundle_de_DE.properties
src/java/org/mxchange/localization/bundle_en_US.properties
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/basket/PizzaBasketWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/category/PizzaAdminCategoryWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/checkout/PizzaCheckoutWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationController.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/customer/PizzaCustomerWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/product/PizzaAdminProductWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/receipt/PizzaReceiptWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationBean.java
src/java/org/mxchange/pizzaapplication/beans/shop/PizzaShopWebApplicationController.java
src/java/org/mxchange/pizzaservice/converter/country/PizzaCountryConverter.java [new file with mode: 0644]
src/java/org/mxchange/pizzaservice/converter/smsprovider/PizzaSmsProviderConverter.java [new file with mode: 0644]
src/java/org/mxchange/pizzaservice/converter/user/PizzaUserConverter.java [new file with mode: 0644]
web/WEB-INF/templates/base.tpl
web/WEB-INF/web.xml
web/admin/admin_user_list.xhtml

diff --git a/lib/jphone-lib.jar b/lib/jphone-lib.jar
new file mode 100644 (file)
index 0000000..bdeff31
Binary files /dev/null and b/lib/jphone-lib.jar differ
index bbdd9e37d43d8ca4277a36050f99d3143c51b2fe..1b0a0d3997544e3b8ab29b2bb99cbf90ed7d3a9b 100644 (file)
@@ -1036,6 +1036,7 @@ exists or setup the property manually. For example like this:
         <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.jphone-lib.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.jcustomer-core.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
         <copyfiles files="${file.reference.jcustomer-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
@@ -1054,6 +1055,7 @@ exists or setup the property manually. For example like this:
         <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.jphone-lib.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.jcustomer-core.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
         <copyfiles files="${file.reference.jcustomer-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
index 342fc01e7ddba06981301bce2c3e2679f864d853..9d44227bd1ca6c27d5f6e0008e6ae3bcf437e7b6 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=6cb26eb6
-nbproject/build-impl.xml.script.CRC32=ad01ddaf
+nbproject/build-impl.xml.data.CRC32=10a373e0
+nbproject/build-impl.xml.script.CRC32=f7d4e4e8
 nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.75.1.1
index 2df1fa2ef341fdcec48b1a0fe54e9a9fa4100135..9ed25a58dec3a9ee74b792aaa77872f9fb114d08 100644 (file)
@@ -46,6 +46,7 @@ file.reference.jcountry-lib.jar=lib/jcountry-lib.jar
 file.reference.jcustomer-core.jar=lib/jcustomer-core.jar
 file.reference.jcustomer-lib.jar=lib/jcustomer-lib.jar
 file.reference.jphone-core.jar=lib/jphone-core.jar
+file.reference.jphone-lib.jar=lib/jphone-lib.jar
 file.reference.jshop-core.jar=lib/jshop-core.jar
 file.reference.jshop-ee-lib.jar=lib/jshop-ee-lib.jar
 includes=**
@@ -68,6 +69,7 @@ javac.classpath=\
     ${file.reference.jcountry-core.jar}:\
     ${file.reference.jcountry-lib.jar}:\
     ${file.reference.jphone-core.jar}:\
+    ${file.reference.jphone-lib.jar}:\
     ${file.reference.jcontacts-core.jar}:\
     ${file.reference.jcustomer-core.jar}:\
     ${file.reference.jcustomer-lib.jar}:\
@@ -124,6 +126,7 @@ source.reference.jcountry-lib.jar=../jcountry-lib/src/
 source.reference.jcustomer-core.jar=../jcustomer-core/src/
 source.reference.jcustomer-lib.jar=../jcustomer-lib/src/
 source.reference.jphone-core.jar=../jphone-core/src/
+source.reference.jphone-lib.jar=../jphone-lib/src/
 source.reference.jshop-core.jar=../jshop-core/src/
 source.reference.jshop-ee-lib.jar=../jshop-ee-lib/src/
 source.root=src
index f439710b36fa0bf63ce15016e67b56327b6d5be4..73eb585ecc2b091f3db768445c0043b0b94b15a6 100644 (file)
                     <file>${file.reference.jphone-core.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
                 </library>
+                <library dirs="200">
+                    <file>${file.reference.jphone-lib.jar}</file>
+                    <path-in-war>WEB-INF/lib</path-in-war>
+                </library>
                 <library dirs="200">
                     <file>${file.reference.jcontacts-core.jar}</file>
                     <path-in-war>WEB-INF/lib</path-in-war>
index 48cdb27a09160fe039112d7a02a15a74ff164b60..b9fbf685c9430bf0dfae980e04b3480fe565cbef 100644 (file)
@@ -136,4 +136,5 @@ public class PizzaCategoryConverter implements Converter {
                        throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
                }
        }
+
 }
index 8d38921e192e9aa234d57e75fb4cc4b5f94a0ced..c94dc3fadf74c20450605e0549c095b6b567039a 100644 (file)
@@ -227,3 +227,4 @@ ADMIN_MENU_USER_TITLE=Benutzerverwaltung
 PAGE_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen
 #CONTENT_TITLE_ADMIN_ADD_USER
 CONTENT_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen:
+TABLE_SUMMARY_ADMIN_LIST_USERS=Administration, alle Benutzer auflisten
index 8ced41b631006a4e6eab9c2c120c050e72c8d1a0..efc772b39fddab32b8d0eebb7ef381ab0cf927dd 100644 (file)
@@ -218,3 +218,4 @@ CONTENT_TITLE_ADMIN_UNLOCK_USER=Un-/Lock user accounts:
 ADMIN_MENU_USER_TITLE=User management
 PAGE_TITLE_ADMIN_ADD_USER=Add new user account
 CONTENT_TITLE_ADMIN_ADD_USER=Add new user account:
+TABLE_SUMMARY_ADMIN_LIST_USERS=Administration, list all users
index 56bdc6e0a32c6dd2fa6e35ae684646bad7915f2f..be0855123d4e2b9c23b96cc6e5d340d03cf17905 100644 (file)
@@ -480,4 +480,5 @@ public class PizzaBasketWebSessionBean implements PizzaBasketWebSessionControlle
                // Return it
                return foundItem;
        }
+
 }
index 1c20c118b8fd0d11405d1fc442689cb235cfb41a..92673426c8d230f00a14173f001113394bd69f1a 100644 (file)
@@ -167,4 +167,5 @@ public interface PizzaBasketWebSessionController extends Serializable {
         * @return Last added item
         */
        String outputLastAddedItem ();
+
 }
index ef7001924fc088a55c43f02b789efb4133b8f79e..1c7d11ced1b32e0a1d63292e7321d12437d3636a 100644 (file)
@@ -127,4 +127,5 @@ public class PizzaAdminCategoryWebRequestBean implements PizzaAdminCategoryWebRe
        public void setParentCategory (final Category parentCategory) {
                this.parentCategory = parentCategory;
        }
+
 }
index 2e130ba0c25ba13fe9f04f6dcc2cdd720c28fe0b..a71bd3980372f11b33c0af61c184e06f00917170 100644 (file)
@@ -61,4 +61,5 @@ public interface PizzaAdminCategoryWebRequestController {
         * @param categoryTitle the title to set
         */
        void setCategoryTitle (final String categoryTitle);
+
 }
index a1b119605310a793ec346d859665c5a78e15b638..e325da560ed67b6457731101cd91e887b8e83d66 100644 (file)
@@ -227,4 +227,5 @@ public class PizzaCheckoutWebSessionBean implements PizzaCheckoutWebSessionContr
                        throw new FacesException(e);
                }
        }
+
 }
index 2724eecbb9175a978aba2e3882890c85537c065c..3c2d5f5366fb9273d08a2f18a98d6f0c67154a7c 100644 (file)
@@ -46,4 +46,5 @@ public interface PizzaCheckoutWebSessionController extends Serializable {
         * @param customer Customer instance
         */
        void setCustomer (final Customer customer);
+
 }
index c60e7975930ef4d22a65fcb558fdb83d89af61d2..3a761dc9c243f9d6ed52c2e4f526e845fabf7caa 100644 (file)
@@ -83,4 +83,5 @@ public class PizzaCountryWebApplicationBean implements PizzaCountryWebApplicatio
                // "Cache" country list as this will not change so often.
                this.countryList = this.countryBean.allCountries();
        }
+
 }
index 616891d42e6bc75c630c2f81df58577616dc0a8d..70d548704a028c91c72d83d7849acdccc6361591 100644 (file)
@@ -33,4 +33,5 @@ public interface PizzaCountryWebApplicationController extends Serializable {
         * @return All countries
         */
        List<Country> allCountries ();
+
 }
index d0eaa694f0a4e6b8391162cc014ddeffd4a892f8..5a052a7b2228e86a8ef2f05934f71a41c0828fe0 100644 (file)
@@ -293,4 +293,5 @@ public class PizzaCustomerWebSessionBean implements PizzaCustomerWebSessionContr
        public boolean isRequiredPersonalDataSet () {
                return ((this.getGender() != null) && (this.getFirstName() != null) && (this.getFamilyName() != null) && (this.getStreet() != null) && (this.getHouseNumber() != null) && (this.getZipCode() != null) && (this.getCity() != null));
        }
+
 }
index b9674d7e3ce371e0984f82e8e7c84b5d5a6c1164..d7a2e4791403cd4901044688a8e038180dc50c0a 100644 (file)
@@ -212,4 +212,5 @@ public interface PizzaCustomerWebSessionController extends Serializable {
         * @return Whether the required personal data is set
         */
        boolean isRequiredPersonalDataSet ();
+
 }
index b329e098aaa13ec95d9b8a738a41097ae5d82e7f..17d8bd9e1499f6d2626ee10c371429df87b4b25a 100644 (file)
@@ -171,4 +171,5 @@ public class PizzaAdminProductWebRequestBean implements PizzaAdminProductWebRequ
        public void setProductTitle (final String productTitle) {
                this.productTitle = productTitle;
        }
+
 }
index 3a9a67a451f958805a2e360d7d3a106638a07306..db59c24e4ba4b04f6da103f2c7e55202525f78f5 100644 (file)
@@ -100,4 +100,5 @@ public interface PizzaAdminProductWebRequestController {
         * @param title Product's title
         */
        void setProductTitle (final String title);
+
 }
index 28f042f2ef86c5fc2a8ae181f7847b1b25688f4b..662d4f8ecf3dd8457ec5628cae9fe7775ec305a4 100644 (file)
@@ -79,4 +79,5 @@ public class PizzaReceiptWebSessionBean implements PizzaReceiptWebSessionControl
        public void setCustomer (final Customer customer) {
                this.customer = customer;
        }
+
 }
index 63052fd44fb52f8004b5ea7f286a381a2a130062..661817a96cd8d829a84432bd3f550e058889b022 100644 (file)
@@ -46,4 +46,5 @@ public interface PizzaReceiptWebSessionController extends Serializable {
         * @param customer Customer instance
         */
        void setCustomer (final Customer customer);
+
 }
index f85638b81215d8683268075b7c332a6df04f0ce8..1c365165de27e5a089067c6aa95709194182f178 100644 (file)
@@ -119,4 +119,5 @@ public class PizzaShopWebApplicationBean implements PizzaShopWebApplicationContr
                        throw new FacesException(e);
                }
        }
+
 }
index 5cbe8fcc9dd671719f7aa402c05c91fc7e2d5e61..b7ccb5c817017d843db6c3816473241069865748 100644 (file)
@@ -70,4 +70,5 @@ public interface PizzaShopWebApplicationController extends Serializable {
         * @throws javax.faces.view.facelets.FaceletException If anything went wrong
         */
        List<Product> getAvailableProducts () throws FaceletException;
+
 }
diff --git a/src/java/org/mxchange/pizzaservice/converter/country/PizzaCountryConverter.java b/src/java/org/mxchange/pizzaservice/converter/country/PizzaCountryConverter.java
new file mode 100644 (file)
index 0000000..f9eec18
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaservice.converter.country;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Objects;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.jcountry.data.Country;
+import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
+
+/**
+ * Converter for country instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "country")
+public class PizzaCountryConverter implements Converter {
+
+       /**
+        * Country bean
+        */
+       private CountrySingletonBeanRemote countryBean;
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * Initialization of this converter
+        */
+       public PizzaCountryConverter () {
+               // Try to get it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+
+                       // ... and country bean
+                       this.countryBean = (CountrySingletonBeanRemote) context.lookup("java:global/pizza-ejb/country!org.mxchange.jcountry.data.AddressbookCountrySingletonBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw it
+                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+               }
+       }
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2},this.countryBean={3} - CALLED!", context, component, submittedValue, this.countryBean)); //NOI18N
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Trace message
+                       this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Get full list
+               List<Country> countryList = this.countryBean.allCountries();
+
+               // Init value
+               Country country = null;
+
+               // Try this better
+               try {
+                       // Convert it to long
+                       Long countryId = Long.parseLong(submittedValue);
+
+                       // Category id should not be below 1
+                       assert (countryId > 0) : "countryId is smaller than one: " + countryId; //NOI18N
+
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: countryId={0}", countryId)); //NOI18N
+
+                       // Try to find it
+                       for (final Country cntry : countryList) {
+                               // Is the id the same? (null-safe)
+                               if (Objects.equals(cntry.getCountryId(), countryId)) {
+                                       // Found it
+                                       country = cntry;
+                                       break;
+                               }
+                       }
+               } catch (final NumberFormatException ex) {
+                       // Log exception (maybe to much?)
+                       this.loggerBeanLocal.logException(ex);
+               }
+
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: country={0} - EXIT!", country)); //NOI18N
+
+               // Return it
+               return country;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+               // Is the object null?
+               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof Country)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement Country.", value)); //NOI18N
+               }
+
+               // Return category id
+               return String.valueOf(((Country) value).getCountryId());
+       }
+}
diff --git a/src/java/org/mxchange/pizzaservice/converter/smsprovider/PizzaSmsProviderConverter.java b/src/java/org/mxchange/pizzaservice/converter/smsprovider/PizzaSmsProviderConverter.java
new file mode 100644 (file)
index 0000000..bc1c94b
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaservice.converter.smsprovider;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Objects;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
+import org.mxchange.jphone.phonenumbers.smsprovider.SmsProviderSingletonBeanRemote;
+
+/**
+ * Converter for SMS provider instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "cellphoneCarrier")
+public class PizzaSmsProviderConverter implements Converter {
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * SMS provider bean
+        */
+       private SmsProviderSingletonBeanRemote providerController;
+
+       /**
+        * Initialization of this converter
+        */
+       public PizzaSmsProviderConverter () {
+               // Try to get it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+
+                       /// and SMS provider controller
+                       this.providerController = (SmsProviderSingletonBeanRemote) context.lookup("java:global/addressbook-ejb/smsprovider!org.mxchange.jphone.phonenumbers.smsprovider.PizzaSmsProviderSingletonBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw it
+                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+               }
+       }
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Trace message
+                       this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Get full list
+               List<SmsProvider> providerList = this.providerController.allSmsProvider();
+
+               // Init value
+               SmsProvider provider = null;
+
+               // Try this better
+               try {
+                       // Convert it to long
+                       Long providerId = Long.parseLong(submittedValue);
+
+                       // Category id should not be below 1
+                       assert (providerId > 0) : "providerId is smaller than one: " + providerId; //NOI18N
+
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: providerId={0}", providerId)); //NOI18N
+
+                       // Try to find it
+                       for (final SmsProvider prov : providerList) {
+                               // Is the id the same? (null-safe)
+                               if (Objects.equals(prov.getProviderId(), providerId)) {
+                                       // Found it
+                                       provider = prov;
+                                       break;
+                               }
+                       }
+               } catch (final NumberFormatException ex) {
+                       // Log exception (maybe to much?)
+                       this.loggerBeanLocal.logException(ex);
+               }
+
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: provider={0} - EXIT!", provider)); //NOI18N
+
+               // Return it
+               return provider;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+               // Is the object null?
+               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof SmsProvider)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement SmsProvider.", value)); //NOI18N
+               }
+
+               // Return category id
+               return String.valueOf(((SmsProvider) value).getProviderId());
+       }
+}
diff --git a/src/java/org/mxchange/pizzaservice/converter/user/PizzaUserConverter.java b/src/java/org/mxchange/pizzaservice/converter/user/PizzaUserConverter.java
new file mode 100644 (file)
index 0000000..5eb2706
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaservice.converter.user;
+
+import java.text.MessageFormat;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.FacesConverter;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.user.AddressbookUserWebSessionController;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * Converter for user id <-> valid user instance
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesConverter (value = "UserConverter")
+public class PizzaUserConverter implements Converter {
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * User bean
+        */
+       private AddressbookUserWebSessionController userController;
+
+       /**
+        * Initialization of this converter
+        */
+       public PizzaUserConverter () {
+               // Try to get it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+
+                       // ... and user controller
+                       this.userController = (AddressbookUserWebSessionController) context.lookup("java:global/addressbook-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw it
+                       throw new RuntimeException("context.lookup() failed.", ex); //NOI18N
+               }
+       }
+
+       @Override
+       public Object getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: context={0},component={1},submittedValue={2} - CALLED!", context, component, submittedValue)); //NOI18N
+
+               // Is the value null or empty?
+               if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
+                       // Trace message
+                       this.loggerBeanLocal.logTrace("getAsObject: submittedValue is null or empty - EXIT!"); //NOI18N
+
+                       // Return null
+                       return null;
+               }
+
+               // Init instance
+               User user = null;
+
+               try {
+                       // Try to parse the value as long
+                       Long userId = Long.valueOf(submittedValue);
+
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: userId{0}", userId));
+
+                       // Try to get user instance from it
+                       user = this.userController.lookupUserById(userId);
+
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: user={0}", user));
+               } catch (final NumberFormatException ex) {
+                       // Throw again
+                       throw new ConverterException(ex);
+               } catch (final UserNotFoundException ex) {
+                       // Debug message
+                       this.loggerBeanLocal.logDebug(MessageFormat.format("getAsObject: Exception: {0} - Returning null ...", ex));
+
+                       // Return null
+                       return null;
+               }
+
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("getAsObject: user={0} - EXIT!", user));
+
+               // Return it
+               return user;
+       }
+
+       @Override
+       public String getAsString (final FacesContext context, final UIComponent component, final Object value) {
+               // Is the object null?
+               if ((null == value) || ((String.valueOf(value)).isEmpty())) {
+                       // Is null
+                       return ""; //NOI18N
+               } else if (!(value instanceof User)) {
+                       // Not same interface
+                       throw new IllegalArgumentException(MessageFormat.format("value {0} does not implement User.", value)); //NOI18N
+               }
+
+               // Return category id
+               return String.valueOf(((User) value).getUserId());
+       }
+
+}
index 96b05e2155f378099ef8a788e0e32f9b8e1e7ba1..4dad5f8c0c85c5048fb272147f5e2a7a669d3a64 100644 (file)
@@ -12,8 +12,8 @@
 
                        <f:loadBundle var="msg" basename="org.mxchange.localization.bundle" />
 
-                       <h:outputStylesheet name="./css/default.css" />
-                       <h:outputStylesheet name="./css/cssLayout.css" />
+                       <h:outputStylesheet name="/css/default.css" />
+                       <h:outputStylesheet name="/css/cssLayout.css" />
 
                        <title>Pizza-Service - <ui:insert name="title">Default title</ui:insert></title>
                </h:head>
index 02340ff6a86025fe2628f76358ef9810b7375abb..d25422b774539b15c0b187f401346e5f6597070e 100644 (file)
@@ -29,9 +29,6 @@
         <session-timeout>
             30
         </session-timeout>
-        <cookie-config>
-            <http-only>true</http-only>
-        </cookie-config>
     </session-config>
     <welcome-file-list>
         <welcome-file>faces/index.xhtml</welcome-file>
index 63f75e2cad6f70b9de56722992056c7e76a4d19e..4f336b360436650c423af90e9f7cfc7401fd0890 100644 (file)
@@ -14,7 +14,8 @@
                </ui:define>
 
                <ui:define name="content">
-                       Here goes your content.
+                       <h:dataTable id="table_list_users" var="user" value="#{userController.allUsers()}" styleClass="table" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_USERS}" rendered="#{userController.hasUsers()}">
+                       </h:dataTable>
                </ui:define>
        </ui:composition>
 </html>