From: Roland Häder Date: Tue, 10 May 2016 12:16:41 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=90e3b0a12c34570df6b3dac266125d30fc7cec3c;p=jjobs-war.git Continued a bit: - 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 --- diff --git a/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java index 034afc6a..c5b011c8 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/JobsContactWebSessionBean.java @@ -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 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()); } /** diff --git a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebApplicationBean.java b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebApplicationBean.java index 93cd4fdc..d52d2685 100644 --- a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebApplicationBean.java +++ b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebApplicationBean.java @@ -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 allCountries () { // Return "cached" version - return this.countryList; + return Collections.unmodifiableList(this.countryList); } /** diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java index a432548b..bba213d5 100644 --- a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestBean.java @@ -134,11 +134,6 @@ public class JobsAdminMobileProviderWebRequestBean implements JobsAdminMobilePro return "admin_list_mobile_provider"; //NOI18N } - @Override - public List 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 providers = this.allMobileProvider(); + List providers = this.mobileController.allMobileProvider(); // Get iterator from it Iterator iterator = providers.iterator(); diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestController.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestController.java index 7e380bdc..3eb383cc 100644 --- a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestController.java +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsAdminMobileProviderWebRequestController.java @@ -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 - *

- * @return A list of all mobile providers - */ - List allMobileProvider (); - - /** - * Checks whether mobile providers are registered - *

- * @return Whether mobile providers are registered - */ - boolean hasMobileProvider (); - /** * Getter for provider dial prefix *

diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java index 147fac45..affcf1fe 100644 --- a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java @@ -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 *

* @author Roland Haeder */ -@Named ("mobileController") +@Named ("mobileProviderController") @SessionScoped public class JobsMobileProviderWebRequestBean implements JobsMobileProviderWebRequestController { @@ -93,9 +94,13 @@ public class JobsMobileProviderWebRequestBean implements JobsMobileProviderWebRe } @Override - @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allMobileProvider () { - return this.mobileProviders; + return Collections.unmodifiableList(this.mobileProviders); + } + + @Override + public boolean hasMobileProvider () { + return (!this.mobileProviders.isEmpty()); } /** diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestController.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestController.java index 77d1d59a..e4bfd8a7 100644 --- a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestController.java +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestController.java @@ -35,6 +35,13 @@ public interface JobsMobileProviderWebRequestController extends Serializable { */ List allMobileProvider (); + /** + * Checks whether mobile providers are registered + *

+ * @return Whether mobile providers are registered + */ + boolean hasMobileProvider (); + /** * Observes events being fired after the administrator has added a new * mobile provider diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java index e456737c..64bc0049 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebSessionBean.java @@ -507,7 +507,7 @@ public class JobsUserWebSessionBean implements JobsUserWebSessionController { List allUsers = this.allUsers(); // Get all contacts - List allContacts = this.contactController.allContacts(); + List allContacts = this.contactBean.getAllContacts(); // Get iterator Iterator iterator = allContacts.iterator(); diff --git a/web/WEB-INF/templates/generic/mobile_selection_box.tpl b/web/WEB-INF/templates/generic/mobile_selection_box.tpl index 14515170..a76aafeb 100644 --- a/web/WEB-INF/templates/generic/mobile_selection_box.tpl +++ b/web/WEB-INF/templates/generic/mobile_selection_box.tpl @@ -8,7 +8,7 @@ - + diff --git a/web/admin/mobile_provider/admin_mobile_provider_list.xhtml b/web/admin/mobile_provider/admin_mobile_provider_list.xhtml index 9d03373c..bf450a76 100644 --- a/web/admin/mobile_provider/admin_mobile_provider_list.xhtml +++ b/web/admin/mobile_provider/admin_mobile_provider_list.xhtml @@ -16,7 +16,7 @@ - + #{msg.ADMIN_LIST_MOBILE_PROVIDER_ID}