]> git.mxchange.org Git - addressbook-war.git/commitdiff
Fixed country controller:
authorRoland Häder <roland@mxchange.org>
Wed, 11 May 2016 14:07:42 +0000 (16:07 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 11 May 2016 14:07:42 +0000 (16:07 +0200)
- renamed controller name to not have confusion to
- moved hasCountries/allCountries to session-scoped bean to have full caching

src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestBean.java
src/java/org/mxchange/addressbook/beans/country/AddressbookAdminCountryWebRequestController.java
src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationBean.java
src/java/org/mxchange/addressbook/beans/country/AddressbookCountryWebApplicationController.java
web/admin/country/admin_country_list.xhtml

index 7ca3472141ed1c597c33a78256c8f54891a711f5..1cb88004b69b9afab95e6319575f6dd6a7d2ac2b 100644 (file)
@@ -151,12 +151,6 @@ public class AddressbookAdminCountryWebRequestBean implements AddressbookAdminCo
                return "admin_list_country"; //NOI18N
        }
 
-       @Override
-       public List<Country> 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.
index 56607fbec9b7b6e733a6a26649ce8c3b528ac3ce..a2a26b45763ca7fa3db3e2cdf5f003d158f3a95e 100644 (file)
@@ -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
-        * <p>
-        * @return All countries
-        */
-       List<Country> 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
-        * <p>
-        * @return Whether countries has been registered
-        */
-       boolean hasCountries ();
-
        /**
         * Getter for abroad dial prefix
         * <p>
index e87eddda1a2a5acf37944bbe6f8aa8362061bae6..ada0bb616b9568ab3ad6b1f60d11412bb2f4050d 100644 (file)
@@ -36,7 +36,7 @@ import org.mxchange.jcountry.events.AdminAddedCountryEvent;
  * <p>
  * @author Roland Haeder<roland@mxchange.org>
  */
-@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
         */
index a81d6e46fa16dcfdc07a1afd90e9e53fbd9821ce..ae6e394af40d57097ed07dd557c18008b8d4c62c 100644 (file)
@@ -35,6 +35,13 @@ public interface AddressbookCountryWebApplicationController extends Serializable
         */
        List<Country> allCountries ();
 
+       /**
+        * Checks whether countries has been registered
+        * <p>
+        * @return Whether countries has been registered
+        */
+       boolean hasCountries ();
+
        /**
         * Observing method when the event is fired that an administrator added a
         * new country
index 63cda07cfbbb75022dff30ccba641a3dc61f14f5..2d1722402f5227fee2059c4b9e0d4aaa1827d471 100644 (file)
@@ -16,7 +16,7 @@
                </ui:define>
 
                <ui:define name="content">
-                       <h:dataTable id="table_list_countries" var="country" value="#{adminCountryController.allCountries()}" styleClass="table_medium" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRIES}" rendered="#{adminCountryController.hasCountries()}">
+                       <h:dataTable id="table_list_countries" var="country" value="#{countryController.allCountries()}" styleClass="table_medium" headerClass="table_header_column" summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRIES}" rendered="#{countryController.hasCountries()}">
                                <h:column>
                                        <f:facet name="header">#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_ID}</f:facet>