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

Signed-off-by: Roland Häder <roland@haeder.net>
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/beans/country/PizzaAdminCountryWebRequestBean.java
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationBean.java
src/java/org/mxchange/pizzaapplication/beans/country/PizzaCountryWebApplicationController.java
web/admin/country/admin_country_list.xhtml

index 10ce8b88f66f944104605578bc4da908b3fe9197..8690f7d201f0f0567c64420fce6b1db4fd37968e 100644 (file)
@@ -36,7 +36,7 @@ import org.mxchange.jcountry.events.AdminEventCountryAdded;
 import org.mxchange.jcountry.exceptions.CountryAlreadyAddedException;
 
 /**
- * Administrative country bean
+ * An administrative country bean
  * <p>
  * @author Roland Haeder<roland@mxchange.org>
  */
index 623ced5195255b5d4e381f1c5e3eb69e856b0897..1e1bc4ac87597c815512563e8f44950b85bd3d90 100644 (file)
@@ -99,6 +99,11 @@ public class PizzaCountryWebApplicationBean implements PizzaCountryWebApplicatio
                return Collections.unmodifiableList(this.countryList);
        }
 
+       @Override
+       public boolean hasCountries () {
+               return (!this.countryList.isEmpty());
+       }
+
        /**
         * Post-initialization of this class
         */
index cb9d267f23a8583ff950814e2c9f23681c22391c..ef787e6f41ac3cf62b952c7fb6aa4e11de4825eb 100644 (file)
@@ -35,6 +35,13 @@ public interface PizzaCountryWebApplicationController 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
@@ -42,4 +49,5 @@ public interface PizzaCountryWebApplicationController extends Serializable {
         * @param event Event instance
         */
        void afterAdminAddedCountry (final AdminAddedCountryEvent event);
+
 }
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>