]> git.mxchange.org Git - jjobs-war.git/blobdiff - src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / country / JobsCountryWebRequestBean.java
index a580d442046bf12c4ae220bdeb68cd08ea4d87c5..112a1b62538f566f245144b5d5f7bcf563222aa6 100644 (file)
@@ -22,15 +22,16 @@ import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import javax.annotation.PostConstruct;
+import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcountry.data.Country;
-import org.mxchange.jcountry.data.CountrySingletonBeanRemote;
 import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent;
-import org.mxchange.jjobs.beans.BaseJobsController;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
+import org.mxchange.jjobs.beans.BaseJobsBean;
 
 /**
  * A country bean
@@ -39,7 +40,7 @@ import org.mxchange.jjobs.beans.BaseJobsController;
  */
 @Named ("countryController")
 @RequestScoped
-public class JobsCountryWebRequestBean extends BaseJobsController implements JobsCountryWebRequestController {
+public class JobsCountryWebRequestBean extends BaseJobsBean implements JobsCountryWebRequestController {
 
        /**
         * Serial number
@@ -49,7 +50,7 @@ public class JobsCountryWebRequestBean extends BaseJobsController implements Job
        /**
         * Remote country EJB
         */
-       @EJB (lookup = "java:global/jjobs-ejb/country!org.mxchange.jcountry.data.CountrySingletonBeanRemote")
+       @EJB (lookup = "java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
        private CountrySingletonBeanRemote countryBean;
 
        /**
@@ -97,10 +98,10 @@ public class JobsCountryWebRequestBean extends BaseJobsController implements Job
        @SuppressWarnings ("ReturnOfCollectionOrArrayField")
        public List<Country> allCountries () {
                // Init list
-               List<Country> list = new LinkedList<>();
+               final List<Country> list = new LinkedList<>();
 
                // Get iterator
-               Iterator<Cache.Entry<Long, Country>> iterator = this.countryCache.iterator();
+               final Iterator<Cache.Entry<Long, Country>> iterator = this.countryCache.iterator();
 
                // Loop over all
                while (iterator.hasNext()) {
@@ -123,15 +124,12 @@ public class JobsCountryWebRequestBean extends BaseJobsController implements Job
                // Is cache there?
                if (!this.countryCache.iterator().hasNext()) {
                        // Get whole list
-                       List<Country> list = this.countryBean.allCountries();
+                       final List<Country> countries = this.countryBean.allCountries();
 
                        // Add all
-                       for (final Iterator<Country> iterator = list.iterator(); iterator.hasNext();) {
-                               // Get next element
-                               final Country next = iterator.next();
-
+                       for (final Country country : countries) {
                                // Add it to cache
-                               this.countryCache.put(next.getCountryId(), next);
+                               this.countryCache.put(country.getCountryId(), country);
                        }
                }
        }