]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Tue, 10 May 2016 12:16:41 +0000 (14:16 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 10 May 2016 17:22:15 +0000 (19:22 +0200)
- don't return full list as the JSF seems to modify it ???
- always use this.someList and not allFoos()
- moved allMobileProviders() and hasMobileProviders() to regular controller as this one holds the cached list anyway
- renamed mobileController -> mobileProviderController
- call bean again instead of getting same (!) list: this fixes a bug that a lot contacts has been removed from the list
- careful cherry-picking this: recruiter-related changes are included and contact EJB added!

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/beans/contact/PizzaContactWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaAdminMobileProviderWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/mobileprovider/PizzaMobileProviderWebRequestController.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java
web/WEB-INF/templates/generic/mobile_selection_box.tpl
web/admin/mobile_provider/admin_mobile_provider_list.xhtml

index dc5d524c5aecf6b52463c834ee6fef213049a4c1..fae504f338b58826be6cbfb29093d230a73cef44 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.pizzaapplication.beans.contact;
 
 import java.text.MessageFormat;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -407,13 +408,12 @@ public class PizzaContactWebSessionBean implements PizzaContactWebSessionControl
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Contact> allContacts () {
                // Debug message
                /* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ContactController.allContacts: contactList.size()={0} - EXIT!", this.contactList.size()));
 
                // Return un-modified list
-               return this.contactList;
+               return Collections.unmodifiableList(this.contactList);
        }
 
        @Override
@@ -764,7 +764,7 @@ public class PizzaContactWebSessionBean implements PizzaContactWebSessionControl
 
        @Override
        public boolean hasContacts () {
-               return (!this.allContacts().isEmpty());
+               return (!this.contactList.isEmpty());
        }
 
        /**
index 78be1b4d7ea0af52fde791573f5fd0ed789d6c50..623ced5195255b5d4e381f1c5e3eb69e856b0897 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.pizzaapplication.beans.country;
 
 import java.text.MessageFormat;
+import java.util.Collections;
 import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.ApplicationScoped;
@@ -93,10 +94,9 @@ public class PizzaCountryWebApplicationBean implements PizzaCountryWebApplicatio
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Country> allCountries () {
                // Return "cached" version
-               return this.countryList;
+               return Collections.unmodifiableList(this.countryList);
        }
 
        /**
index 056de736e5ba39d797e8d81f222f4a6f5c50f571..4c2c3f47ff8c666fd29c24a7a072a8c79c569e8e 100644 (file)
@@ -137,11 +137,6 @@ public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileP
                return "admin_list_mobile_provider"; //NOI18N
        }
 
-       @Override
-       public List<MobileProvider> allMobileProvider () {
-               return this.mobileController.allMobileProvider();
-       }
-
        @Override
        public Country getProviderCountry () {
                return this.providerCountry;
@@ -182,11 +177,6 @@ public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileP
                this.providerName = providerName;
        }
 
-       @Override
-       public boolean hasMobileProvider () {
-               return (!this.allMobileProvider().isEmpty());
-       }
-
        /**
         * Clears this bean
         */
@@ -211,7 +201,7 @@ public class PizzaAdminMobileProviderWebRequestBean implements PizzaAdminMobileP
                boolean isFound = false;
 
                // Get list of all providers
-               List<MobileProvider> providers = this.allMobileProvider();
+               List<MobileProvider> providers = this.mobileController.allMobileProvider();
 
                // Get iterator from it
                Iterator<MobileProvider> iterator = providers.iterator();
index 14e74bab19377c487315f51a999a8db0b2e3540f..65e2aa7a7ae223f4aa617d0a6cb839ce59234699 100644 (file)
@@ -17,9 +17,7 @@
 package org.mxchange.pizzaapplication.beans.mobileprovider;
 
 import java.io.Serializable;
-import java.util.List;
 import org.mxchange.jcountry.data.Country;
-import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider;
 
 /**
  * An interface for a request web controller (bean) for administrative mobile
@@ -38,20 +36,6 @@ public interface PizzaAdminMobileProviderWebRequestController extends Serializab
         */
        String addMobileProvider ();
 
-       /**
-        * Returns a list of all mobile providers
-        * <p>
-        * @return A list of all mobile providers
-        */
-       List<MobileProvider> allMobileProvider ();
-
-       /**
-        * Checks whether mobile providers are registered
-        * <p>
-        * @return Whether mobile providers are registered
-        */
-       boolean hasMobileProvider ();
-
        /**
         * Getter for provider dial prefix
         * <p>
index 9c77a095bf407420fc6d68d2e7c7ffb3d26105cd..ce478f68e6d5340b479962b746a50b09a4bfb7aa 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.pizzaapplication.beans.mobileprovider;
 
 import java.text.MessageFormat;
+import java.util.Collections;
 import java.util.List;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
@@ -35,7 +36,7 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBe
  * <p>
  * @author Roland Haeder<roland@mxchange.org>
  */
-@Named ("mobileController")
+@Named ("mobileProviderController")
 @SessionScoped
 public class PizzaMobileProviderWebRequestBean implements PizzaMobileProviderWebRequestController {
 
@@ -93,9 +94,13 @@ public class PizzaMobileProviderWebRequestBean implements PizzaMobileProviderWeb
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<MobileProvider> allMobileProvider () {
-               return this.mobileProviders;
+               return Collections.unmodifiableList(this.mobileProviders);
+       }
+
+       @Override
+       public boolean hasMobileProvider () {
+               return (!this.mobileProviders.isEmpty());
        }
 
        /**
index 29fe878ace88feaaebb40e7288a3f027adc536d1..d1e1581143294d2c07f920e2b0871fe8ed867d2b 100644 (file)
@@ -35,6 +35,13 @@ public interface PizzaMobileProviderWebRequestController extends Serializable {
         */
        List<MobileProvider> allMobileProvider ();
 
+       /**
+        * Checks whether mobile providers are registered
+        * <p>
+        * @return Whether mobile providers are registered
+        */
+       boolean hasMobileProvider ();
+
        /**
         * Observes events being fired after the administrator has added a new
         * mobile provider
index fda56cd5c8572301411f695445737b1e68d42d30..d1eb853cebff4ff4e2c8f0d64d32ec09fb69d5e9 100644 (file)
@@ -513,7 +513,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                List<User> allUsers = this.allUsers();
 
                // Get all contacts
-               List<Contact> allContacts = this.contactController.allContacts();
+               List<Contact> allContacts = this.contactBean.getAllContacts();
 
                // Get iterator
                Iterator<Contact> iterator = allContacts.iterator();
index 14515170c01c4c125cb877040722f4e98b383049..a76aafebcedb15d2b9dcf06842a47751b9ea7759 100644 (file)
@@ -8,7 +8,7 @@
        <ui:fragment rendered="#{not empty targetController}">
                <h:selectOneMenu styleClass="select" id="cellphoneCarrier" value="#{targetController.cellphoneCarrier}" converter="MobileProviderConverter">
                        <f:selectItem itemValue="" itemLabel="#{msg.NONE_SELECTED}" />
-                       <f:selectItems value="#{mobileController.allMobileProvider()}" var="p" itemValue="#{p}" itemLabel="#{p.providerCountry.countryExternalDialPrefix}#{p.providerDialPrefix} (#{p.providerName})" />
+                       <f:selectItems value="#{mobileProviderController.allMobileProvider()}" var="p" itemValue="#{p}" itemLabel="#{p.providerCountry.countryExternalDialPrefix}#{p.providerDialPrefix} (#{p.providerName})" />
                </h:selectOneMenu>
 
                <h:inputText styleClass="input" id="cellphoneNumber" size="10" maxlength="20" value="#{targetController.cellphoneNumber}">
index 9d03373c352a80d399e0f5b61f8fc80a424b40d9..bf450a76fc0ebf60ecde4f59dc2238e7a003da5f 100644 (file)
@@ -16,7 +16,7 @@
                </ui:define>
 
                <ui:define name="content">
-                       <h:dataTable id="table_list_mobile" var="mobile" value="#{adminMobileProviderController.allMobileProvider()}" styleClass="table_medium" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_MOBILE_PROVIDERS}" rendered="#{adminMobileProviderController.hasMobileProvider()}">
+                       <h:dataTable id="table_list_mobile" var="mobile" value="#{mobileProviderController.allMobileProvider()}" styleClass="table_medium" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_MOBILE_PROVIDERS}" rendered="#{mobileProviderController.hasMobileProvider()}">
                                <h:column>
                                        <f:facet name="header">#{msg.ADMIN_LIST_MOBILE_PROVIDER_ID}</f:facet>