]> git.mxchange.org Git - jjobs-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 18:20:14 +0000 (20:20 +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/jjobs/beans/contact/JobsContactWebSessionBean.java
src/java/org/mxchange/jjobs/beans/country/JobsCountryWebApplicationBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestController.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java
src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestController.java
src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java
web/WEB-INF/templates/generic/mobile_selection_box.tpl
web/admin/mobile_provider/admin_mobile_provider_list.xhtml

index 034afc6a307a5f3dc7f95dc29c9bf1c98068a755..c5b011c879a765f2b98c71f3c1fbb9461d9cdae7 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.beans.contact;
 
 import java.text.MessageFormat;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
@@ -381,13 +382,12 @@ public class JobsContactWebSessionBean implements JobsContactWebSessionControlle
        }
 
        @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
@@ -741,7 +741,7 @@ public class JobsContactWebSessionBean implements JobsContactWebSessionControlle
 
        @Override
        public boolean hasContacts () {
-               return (!this.allContacts().isEmpty());
+               return (!this.contactList.isEmpty());
        }
 
        /**
index 93cd4fdc1afcb82b09d23de62cd45921db4ea6f8..d52d26850cdb201405e0d9bf920d5c63df56a20f 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.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 JobsCountryWebApplicationBean implements JobsCountryWebApplicationC
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Country> allCountries () {
                // Return "cached" version
-               return this.countryList;
+               return Collections.unmodifiableList(this.countryList);
        }
 
        /**
index a432548bf9bf7163e2692f2694ff7c00f3470279..bba213d5e1bd83af8d9d84d273930c7d78ad478a 100644 (file)
@@ -134,11 +134,6 @@ public class JobsAdminMobileProviderWebRequestBean implements JobsAdminMobilePro
                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 JobsAdminMobileProviderWebRequestBean implements JobsAdminMobilePro
                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 JobsAdminMobileProviderWebRequestBean implements JobsAdminMobilePro
                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 7e380bdc9a7329a6dd3e001931c58f935be51f2f..3eb383cc7c2d32f6293fdac675ad112d33fe544d 100644 (file)
@@ -17,9 +17,7 @@
 package org.mxchange.jjobs.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 JobsAdminMobileProviderWebRequestController extends Serializabl
         */
        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 147fac45e304b265c6789b46757eb2b62b279a78..affcf1fe6b36194f14a69e99720b22bb31979e78 100644 (file)
@@ -17,6 +17,7 @@
 package org.mxchange.jjobs.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 JobsMobileProviderWebRequestBean implements JobsMobileProviderWebRequestController {
 
@@ -93,9 +94,13 @@ public class JobsMobileProviderWebRequestBean implements JobsMobileProviderWebRe
        }
 
        @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<MobileProvider> allMobileProvider () {
-               return this.mobileProviders;
+               return Collections.unmodifiableList(this.mobileProviders);
+       }
+
+       @Override
+       public boolean hasMobileProvider () {
+               return (!this.mobileProviders.isEmpty());
        }
 
        /**
index 77d1d59a49ef7a0e62912f2834666b6daa685da2..e4bfd8a7d0bd65877f95f015a473ea7c9795d5ce 100644 (file)
@@ -35,6 +35,13 @@ public interface JobsMobileProviderWebRequestController 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 e456737c0e174b4bc92daf59bc2dfe7b08575f92..64bc0049f71aa8327a54541dabc1445a5b929776 100644 (file)
@@ -507,7 +507,7 @@ public class JobsUserWebSessionBean implements JobsUserWebSessionController {
                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>