From 8211274030d3b7997be6b6de154a9c7f01a01cf5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 11 May 2016 16:07:42 +0200 Subject: [PATCH] Fixed country controller: - renamed controller name to not have confusion to - moved hasCountries/allCountries to session-scoped bean to have full caching --- .../AddressbookAdminCountryWebRequestBean.java | 11 ----------- ...ressbookAdminCountryWebRequestController.java | 16 ---------------- .../AddressbookCountryWebApplicationBean.java | 7 ++++++- ...dressbookCountryWebApplicationController.java | 7 +++++++ web/admin/country/admin_country_list.xhtml | 2 +- 5 files changed, 14 insertions(+), 29 deletions(-) diff --git a/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestBean.java b/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestBean.java index 7ca34721..1cb88004 100644 --- a/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestBean.java +++ b/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestBean.java @@ -151,12 +151,6 @@ public class AddressbookAdminCountryWebRequestBean implements AddressbookAdminCo return "admin_list_country"; //NOI18N } - @Override - public List allCountries () { - // Return "cached" version - return this.countryController.allCountries(); - } - @Override public String getCountryAbroadDialPrefix () { return this.countryAbroadDialPrefix; @@ -217,11 +211,6 @@ public class AddressbookAdminCountryWebRequestBean implements AddressbookAdminCo this.countryPhoneCode = countryPhoneCode; } - @Override - public boolean hasCountries () { - return (!this.allCountries().isEmpty()); - } - /** * Checks if given country is already added by iterating over the whole list * and try to find it. diff --git a/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestController.java b/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestController.java index 56607fbe..a2a26b45 100644 --- a/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestController.java +++ b/src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestController.java @@ -17,8 +17,6 @@ package org.mxchange.addressbook.beans.country; import java.io.Serializable; -import java.util.List; -import org.mxchange.jcountry.data.Country; /** * An interface for administrative country beans @@ -27,13 +25,6 @@ import org.mxchange.jcountry.data.Country; */ public interface AddressbookAdminCountryWebRequestController extends Serializable { - /** - * A list of all countries - *

- * @return All countries - */ - List allCountries (); - /** * Adds country to all relevant beans and sends it to the EJB. A redirect * should happen after successfull creation. @@ -42,13 +33,6 @@ public interface AddressbookAdminCountryWebRequestController extends Serializabl */ String addCountry (); - /** - * Checks whether countries has been registered - *

- * @return Whether countries has been registered - */ - boolean hasCountries (); - /** * Getter for abroad dial prefix *

diff --git a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java index e87eddda..ada0bb61 100644 --- a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java +++ b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java @@ -36,7 +36,7 @@ import org.mxchange.jcountry.events.AdminAddedCountryEvent; *

* @author Roland Haeder */ -@Named ("country") +@Named ("countryController") @ApplicationScoped public class AddressbookCountryWebApplicationBean implements AddressbookCountryWebApplicationController { @@ -99,6 +99,11 @@ public class AddressbookCountryWebApplicationBean implements AddressbookCountryW return Collections.unmodifiableList(this.countryList); } + @Override + public boolean hasCountries () { + return (!this.countryList.isEmpty()); + } + /** * Post-initialization of this class */ diff --git a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java index a81d6e46..ae6e394a 100644 --- a/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java +++ b/src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java @@ -35,6 +35,13 @@ public interface AddressbookCountryWebApplicationController extends Serializable */ List allCountries (); + /** + * Checks whether countries has been registered + *

+ * @return Whether countries has been registered + */ + boolean hasCountries (); + /** * Observing method when the event is fired that an administrator added a * new country diff --git a/web/admin/country/admin_country_list.xhtml b/web/admin/country/admin_country_list.xhtml index 63cda07c..2d172240 100644 --- a/web/admin/country/admin_country_list.xhtml +++ b/web/admin/country/admin_country_list.xhtml @@ -16,7 +16,7 @@ - + #{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_ID} -- 2.39.5