]> git.mxchange.org Git - jfinancials-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:29:03 +0000 (19:29 +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/addressbook/beans/contact/AddressbookContactWebSessionBean.java
src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookAdminMobileProviderWebRequestController.java
src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestBean.java
src/java/org/mxchange/addressbook/beans/mobileprovider/AddressbookMobileProviderWebRequestController.java
src/java/org/mxchange/addressbook/beans/user/AddressbookUserWebSessionBean.java
web/WEB-INF/templates/generic/mobile_selection_box.tpl
web/admin/mobile_provider/admin_mobile_provider_list.xhtml

index d8611e094a934a2032357c9b81d2f7e8dacbe0fe..725b928f256934253f9b79ee070131d176cd1a83 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.beans.contact;
 
 import java.text.MessageFormat;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -382,13 +383,12 @@ public class AddressbookContactWebSessionBean implements AddressbookContactWebSe
        }
 
        @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
@@ -742,7 +742,7 @@ public class AddressbookContactWebSessionBean implements AddressbookContactWebSe
 
        @Override
        public boolean hasContacts () {
-               return (!this.allContacts().isEmpty());
+               return (!this.contactList.isEmpty());
        }
 
        /**
index 6b3668cf188751784efe25248df9cf266cf7b8de..e87eddda1a2a5acf37944bbe6f8aa8362061bae6 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.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 AddressbookCountryWebApplicationBean implements AddressbookCountryW
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Country> allCountries () {
                // Return "cached" version
-               return this.countryList;
+               return Collections.unmodifiableList(this.countryList);
        }
 
        /**
index 5b052c515e3e7fa9f60529b45a9ba924e250fbaf..b6d511b934c08dc701520f7f2b7b495e307d8596 100644 (file)
@@ -134,11 +134,6 @@ public class AddressbookAdminMobileProviderWebRequestBean implements Addressbook
                return "admin_list_mobile_provider"; //NOI18N
        }
 
-       @Override
-       public List<MobileProvider> allMobileProvider () {
-               return this.mobileController.allMobileProvider();
-       }
-
        @Override
        public Country getProviderCountry () {
                return this.providerCountry;
@@ -179,11 +174,6 @@ public class AddressbookAdminMobileProviderWebRequestBean implements Addressbook
                this.providerName = providerName;
        }
 
-       @Override
-       public boolean hasMobileProvider () {
-               return (!this.allMobileProvider().isEmpty());
-       }
-
        /**
         * Checks whether if the given mobile provider is already created by
         * checking both dial prefix and country.
@@ -197,7 +187,7 @@ public class AddressbookAdminMobileProviderWebRequestBean implements Addressbook
                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 d287dd2b7dc64e23ea103a5e2e1202970f9ead2e..e3dd484ca7700fa28fab0eff0da998aad2f7b8ad 100644 (file)
@@ -17,9 +17,7 @@
 package org.mxchange.addressbook.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 AddressbookAdminMobileProviderWebRequestController extends Seri
         */
        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 8a4a356bf41e7f825b6a0ff6bbd173f4fa9b1b12..408accfd4109658e4374c624d150a90fd4c23b5f 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.addressbook.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 AddressbookMobileProviderWebRequestBean implements AddressbookMobileProviderWebRequestController {
 
@@ -93,9 +94,13 @@ public class AddressbookMobileProviderWebRequestBean implements AddressbookMobil
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<MobileProvider> allMobileProvider () {
-               return this.mobileProviders;
+               return Collections.unmodifiableList(this.mobileProviders);
+       }
+
+       @Override
+       public boolean hasMobileProvider () {
+               return (!this.mobileProviders.isEmpty());
        }
 
        /**
index 4092913192a0c38f9634f740664c1eced58e1466..490914115c6191056d68cd2e02764d76f638af9f 100644 (file)
@@ -35,6 +35,13 @@ public interface AddressbookMobileProviderWebRequestController extends Serializa
         */
        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 74a8975c88f71d4c4b9a6efadc7af378a19e98a7..2d13c89d9cdf9e6c80c70a1f493f839f1dca2821 100644 (file)
@@ -512,7 +512,7 @@ public class AddressbookUserWebSessionBean implements AddressbookUserWebSessionC
                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>