]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 1 Apr 2020 18:24:20 +0000 (20:24 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 1 Apr 2020 18:24:20 +0000 (20:24 +0200)
- rewrote admin-countries-list view to more modern approach with filters and
  sorting
- rewrote many while(iterator) implementations to use for(item:List/Map.Entry)
  instead
- added some missing i18n keys

Signed-off-by: Roland Häder <roland@mxchange.org>
24 files changed:
src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java
src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java
src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java
src/java/org/mxchange/localization/generic_de_DE.properties
src/java/org/mxchange/localization/generic_en_US.properties
web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl
web/WEB-INF/templates/contact/form_contact_data.tpl
web/admin/basic_data/admin_basic_data_list.xhtml
web/admin/country/admin_country_list.xhtml

index 3205d0981942a9da6316c7f2a8cfcfce37dbaee1..41184b88aba4adcf18a6dc3c5dbc163ae3c44a1b 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.business.basicdata.list;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -210,23 +209,17 @@ public class FinancialsBasicDataListWebViewBean extends BaseFinancialsBean imple
 
                // Is cache there and list is not full?
                if ((this.getAllBasicData().isEmpty()) && (this.basicDataCache.iterator().hasNext())) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, BasicData>> iterator = this.basicDataCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, BasicData> next = iterator.next();
-
+                       for (final Cache.Entry<Long, BasicData> currentEntry : this.basicDataCache) {
                                // Add to list
-                               this.getAllBasicData().add(next.getValue());
+                               this.getAllBasicData().add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.getAllBasicData().sort(new Comparator<BasicData>() {
                                @Override
-                               public int compare (final BasicData o1, final BasicData o2) {
-                                       return o1.getBasicDataId() > o2.getBasicDataId() ? 1 : o1.getBasicDataId() < o2.getBasicDataId() ? -1 : 0;
+                               public int compare (final BasicData basicData1, final BasicData basicData2) {
+                                       return basicData1.getBasicDataId() > basicData2.getBasicDataId() ? 1 : basicData1.getBasicDataId() < basicData2.getBasicDataId() ? -1 : 0;
                                }
                        });
 
index 138c0b1fe2f11bfcd797e157b86c342505808814..7a7fbc17c2aaec5f0d1abbf9287178ad149654ba 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.business.branchoffice.list;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -203,23 +202,17 @@ public class FinancialsBranchOfficeListWebViewBean extends BaseFinancialsBean im
 
                // Is the list empty, but filled cache?
                if (this.allBranchOffices.isEmpty() && this.branchOfficeCache.iterator().hasNext()) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, BranchOffice>> iterator = this.branchOfficeCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, BranchOffice> next = iterator.next();
-
+                       for (final Cache.Entry<Long, BranchOffice> currentEntry : this.branchOfficeCache) {
                                // Add to list
-                               this.allBranchOffices.add(next.getValue());
+                               this.allBranchOffices.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allBranchOffices.sort(new Comparator<BranchOffice>() {
                                @Override
-                               public int compare (final BranchOffice o1, final BranchOffice o2) {
-                                       return o1.getBranchId() > o2.getBranchId() ? 1 : o1.getBranchId() < o2.getBranchId() ? -1 : 0;
+                               public int compare (final BranchOffice branchOffice1, final BranchOffice branchOffice2) {
+                                       return branchOffice1.getBranchId() > branchOffice2.getBranchId() ? 1 : branchOffice1.getBranchId() < branchOffice2.getBranchId() ? -1 : 0;
                                }
                        });
                }
index 426323f881502b942bdba53566f84d071e1f0799..35884c8a87d1706c33d2c7fd00b386593a0fdfc7 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.business.department;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import javax.annotation.PostConstruct;
@@ -179,23 +178,17 @@ public class FinancialsDepartmentWebRequestBean extends BaseFinancialsBean imple
 
                // Is the list empty, but filled cache?
                if (this.allDepartments.isEmpty() && this.departmentCache.iterator().hasNext()) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, Department>> iterator = this.departmentCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, Department> next = iterator.next();
-
+                       for (final Cache.Entry<Long, Department> currentEntry : this.departmentCache) {
                                // Add to list
-                               this.allDepartments.add(next.getValue());
+                               this.allDepartments.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allDepartments.sort(new Comparator<Department>() {
                                @Override
-                               public int compare (final Department o1, final Department o2) {
-                                       return o1.getDepartmentId() > o2.getDepartmentId() ? 1 : o1.getDepartmentId() < o2.getDepartmentId() ? -1 : 0;
+                               public int compare (final Department department1, final Department department2) {
+                                       return department1.getDepartmentId() > department2.getDepartmentId() ? 1 : department1.getDepartmentId() < department2.getDepartmentId() ? -1 : 0;
                                }
                        });
                }
index 4053fec442e39ca01d70df801bb511441cc9c0ac..84b6a29d863570a8ea4c64cd576b5be18720d296 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.business.employee;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -176,23 +175,17 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme
 
                // Is cache filled and list is empty
                if ((this.employeeCache.iterator().hasNext()) && (this.allEmployees.isEmpty())) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, Employable>> iterator = this.employeeCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, Employable> next = iterator.next();
-
+                       for (final Cache.Entry<Long, Employable> currentEntry : this.employeeCache) {
                                // Add to list
-                               this.allEmployees.add(next.getValue());
+                               this.allEmployees.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allEmployees.sort(new Comparator<Employable>() {
                                @Override
-                               public int compare (final Employable o1, final Employable o2) {
-                                       return o1.getEmployeeId() > o2.getEmployeeId() ? 1 : o1.getEmployeeId() < o2.getEmployeeId() ? -1 : 0;
+                               public int compare (final Employable employee1, final Employable employee2) {
+                                       return employee1.getEmployeeId() > employee2.getEmployeeId() ? 1 : employee1.getEmployeeId() < employee2.getEmployeeId() ? -1 : 0;
                                }
                        });
                }
index 0e6cd13c71f16e47a4dfa6c0ce4cdf4bdcf0a907..15c9d8ffb733b2667d39e69a5f97481f0bdbf8ee 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.business.headquarter;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -180,23 +179,17 @@ public class FinancialsHeadquarterWebRequestBean extends BaseFinancialsBean impl
 
                // Is the list empty, but filled cache?
                if (this.allHeadquarter.isEmpty() && this.headquarterCache.iterator().hasNext()) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, Headquarter>> iterator = this.headquarterCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, Headquarter> next = iterator.next();
-
+                       for (final Cache.Entry<Long, Headquarter> currentEntry : this.headquarterCache) {
                                // Add to list
-                               this.allHeadquarter.add(next.getValue());
+                               this.allHeadquarter.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allHeadquarter.sort(new Comparator<Headquarter>() {
                                @Override
-                               public int compare (final Headquarter o1, final Headquarter o2) {
-                                       return o1.getHeadquarterId() > o2.getHeadquarterId() ? 1 : o1.getHeadquarterId() < o2.getHeadquarterId() ? -1 : 0;
+                               public int compare (final Headquarter headquarter1, final Headquarter headquarter2) {
+                                       return headquarter1.getHeadquarterId() > headquarter2.getHeadquarterId() ? 1 : headquarter1.getHeadquarterId() < headquarter2.getHeadquarterId() ? -1 : 0;
                                }
                        });
                }
index b0972b13beda63a664e08963b3efbcfddcf54c31..7577eec10c51c3d5a88cddcc92db0722eb0b324a 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.business.opening_time;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import javax.annotation.PostConstruct;
@@ -175,23 +174,17 @@ public class FinancialsOpeningTimeWebRequestBean extends BaseFinancialsBean impl
 
                // Is the list empty, but filled cache?
                if (this.allOpeningTimes.isEmpty() && this.openingTimesCache.iterator().hasNext()) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, OpeningTime>> iterator = this.openingTimesCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, OpeningTime> next = iterator.next();
-
+                       for (final Cache.Entry<Long, OpeningTime> currentEntry : this.openingTimesCache) {
                                // Add to list
-                               this.allOpeningTimes.add(next.getValue());
+                               this.allOpeningTimes.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allOpeningTimes.sort(new Comparator<OpeningTime>() {
                                @Override
-                               public int compare (final OpeningTime o1, final OpeningTime o2) {
-                                       return o1.getOpeningId() > o2.getOpeningId() ? 1 : o1.getOpeningId() < o2.getOpeningId() ? -1 : 0;
+                               public int compare (final OpeningTime openingTime1, final OpeningTime openingTime2) {
+                                       return openingTime1.getOpeningId() > openingTime2.getOpeningId() ? 1 : openingTime1.getOpeningId() < openingTime2.getOpeningId() ? -1 : 0;
                                }
                        }
                        );
index d4edde221ae2f538457689cb669fc00035dc99e7..83f001cd92e0a07cb2ce81187663206330546f94 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.contact.list;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -321,7 +320,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
         * Post-construction method
         */
        @PostConstruct
-       public void init () {
+       public void initializeList () {
                // Is cache there?
                if (!this.contactCache.iterator().hasNext()) {
                        // Get whole list from EJB
@@ -336,23 +335,17 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
 
                // Is cache there and list is not full?
                if ((this.getAllContacts().isEmpty()) && (this.contactCache.iterator().hasNext())) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, Contact> next = iterator.next();
-
+                       for (final Cache.Entry<Long, Contact> currentEntry : this.contactCache) {
                                // Add to list
-                               this.getAllContacts().add(next.getValue());
+                               this.getAllContacts().add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.getAllContacts().sort(new Comparator<Contact>() {
                                @Override
-                               public int compare (final Contact o1, final Contact o2) {
-                                       return o1.getContactId() > o2.getContactId() ? 1 : o1.getContactId() < o2.getContactId() ? -1 : 0;
+                               public int compare (final Contact contact1, final Contact contact2) {
+                                       return contact1.getContactId() > contact2.getContactId() ? 1 : contact1.getContactId() < contact2.getContactId() ? -1 : 0;
                                }
                        });
 
@@ -366,16 +359,10 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
                // Default is not found
                boolean IsFound = false;
 
-               // Get iterator
-               final Iterator<Contact> iterator = this.getAllContacts().iterator();
-
                // Loop through all
-               while (iterator.hasNext()) {
-                       // Get next contact
-                       final Contact next = iterator.next();
-
+               for (final Contact currentContact : this.getAllContacts()) {
                        // Is the same?
-                       if (Contacts.isSameContact(contact, next)) {
+                       if (Contacts.isSameContact(contact, currentContact)) {
                                // Yes, then abort loop
                                IsFound = false;
                                break;
@@ -393,10 +380,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
         */
        private void removeContact (final Contact contact) {
                // Remove from general list
-               if (!this.contactCache.remove(contact.getContactId())) {
-                       // Did not remove contact
-                       throw new IllegalStateException(MessageFormat.format("contact {0} was not removed.", contact.getContactId())); //NOI18N
-               }
+               this.contactCache.remove(contact.getContactId());
        }
 
        /**
@@ -406,18 +390,12 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
         * @param contact Contact instance to add uniquely
         */
        private void uniqueAddContact (final Contact contact) {
-               // Get iterator from list
-               final Iterator<Cache.Entry<Long, Contact>> iterator = this.contactCache.iterator();
-
                // "Walk" through all entries
-               while (iterator.hasNext()) {
-                       // Get next element
-                       final Cache.Entry<Long, Contact> next = iterator.next();
-
+               for (final Cache.Entry<Long, Contact> currentEntry : this.contactCache) {
                        // Is id number the same?
-                       if (Objects.equals(contact.getContactId(), next.getKey())) {
+                       if (Objects.equals(contact.getContactId(), currentEntry.getKey())) {
                                // Found entry, so remove it and abort
-                               this.removeContact(next.getValue());
+                               this.removeContact(currentEntry.getValue());
                                break;
                        }
                }
index d83d3b6aa5a1762a25f3f504603a4c47cbd4655b..3f646f1427d04e5db8fc04e3b9b3f83c3e2e92ca 100644 (file)
@@ -16,8 +16,6 @@
  */
 package org.mxchange.jfinancials.beans.country;
 
-import java.util.Iterator;
-import java.util.List;
 import java.util.Objects;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
@@ -33,6 +31,7 @@ import org.mxchange.jcountry.model.data.AdminCountrySessionBeanRemote;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountryData;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.country.list.FinancialsCountryListWebViewController;
 
 /**
  * An administrative country bean
@@ -71,12 +70,6 @@ public class FinancialsAdminCountryWebRequestBean extends BaseFinancialsBean imp
         */
        private String countryCode;
 
-       /**
-        * Regular country controller
-        */
-       @Inject
-       private FinancialsCountryWebRequestController countryController;
-
        /**
         * Local dial prefix
         */
@@ -92,6 +85,12 @@ public class FinancialsAdminCountryWebRequestBean extends BaseFinancialsBean imp
         */
        private Boolean countryIsLocalPrefixRequired;
 
+       /**
+        * Regular country controller
+        */
+       @Inject
+       private FinancialsCountryListWebViewController countryListController;
+
        /**
         * Phone code
         */
@@ -282,19 +281,10 @@ public class FinancialsAdminCountryWebRequestBean extends BaseFinancialsBean imp
                // Default is not found
                boolean isAdded = false;
 
-               // Now get whole ist
-               final List<Country> countries = this.countryController.allCountries();
-
-               // Get iterator from it
-               final Iterator<Country> iterator = countries.iterator();
-
                // Check whole list
-               while (iterator.hasNext()) {
-                       // Get next country
-                       final Country next = iterator.next();
-
+               for (final Country currentCountry : this.countryListController.getAllCountries()) {
                        // Is country code or i18n the same?
-                       if ((Objects.equals(country.getCountryCode(), next.getCountryCode())) || (Objects.equals(country.getCountryI18nKey(), next.getCountryI18nKey()))) {
+                       if ((Objects.equals(country.getCountryCode(), currentCountry.getCountryCode())) || (Objects.equals(country.getCountryI18nKey(), currentCountry.getCountryI18nKey()))) {
                                // Yes, then abort search
                                isAdded = true;
                                break;
index af457b88a5831337e00b3c7a2d7e780c9d907419..ad40628e6cd3ddb5628414ebaa8400e45eea2d34 100644 (file)
  */
 package org.mxchange.jfinancials.beans.country;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-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.events.added.ObservableAdminAddedCountryEvent;
-import org.mxchange.jcountry.exceptions.CountryNotFoundException;
-import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 
@@ -54,13 +42,6 @@ public class FinancialsCountryWebRequestBean extends BaseFinancialsBean implemen
        @EJB (lookup = "java:global/jfinancials-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
        private CountrySingletonBeanRemote countryBean;
 
-       /**
-        * List of all countries
-        */
-       @Inject
-       @NamedCache (cacheName = "countryCache")
-       private Cache<Long, Country> countryCache;
-
        /**
         * Default constructor
         */
@@ -69,91 +50,4 @@ public class FinancialsCountryWebRequestBean extends BaseFinancialsBean implemen
                super();
        }
 
-       /**
-        * Observing method when the event is fired that an administrator added a
-        * new country
-        * <p>
-        * @param event Event instance
-        */
-       public void afterAdminAddedCountryEvent (@Observes final ObservableAdminAddedCountryEvent event) {
-               // Is all valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedCountry() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.addedCountry is null"); //NOI18N
-               } else if (event.getAddedCountry().getCountryId() == null) {
-                       // And again ...
-                       throw new NullPointerException("event.addedCountry.countryId is null"); //NOI18N
-               } else if (event.getAddedCountry().getCountryId() < 1) {
-                       // Id is invalid
-                       throw new IllegalArgumentException(MessageFormat.format("event.addedCountry.countryId={0} is not valid.", event.getAddedCountry().getCountryId())); //NOI18N
-               }
-
-               // Add the event
-               this.countryCache.put(event.getAddedCountry().getCountryId(), event.getAddedCountry());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Country> allCountries () {
-               // Init list
-               final List<Country> list = new LinkedList<>();
-
-               // Get iterator
-               final Iterator<Cache.Entry<Long, Country>> iterator = this.countryCache.iterator();
-
-               // Loop over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       final Cache.Entry<Long, Country> next = iterator.next();
-
-                       // Add value to list
-                       list.add(next.getValue());
-               }
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       public Country findCountryById (final Long countryId) throws CountryNotFoundException {
-               // Validate parameter
-               if (null == countryId) {
-                       // Throw NPE
-                       throw new NullPointerException("countryId is null"); //NOI18N
-               } else if (countryId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("countryId=" + countryId + " is invalid"); //NOI18N
-               } else if (!this.countryCache.containsKey(countryId)) {
-                       // Not found
-                       throw new CountryNotFoundException(countryId);
-               }
-
-               // Get it from cache
-               final Country country = this.countryCache.get(countryId);
-
-               // Return it
-               return country;
-       }
-
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void init () {
-               // Is cache there?
-               if (!this.countryCache.iterator().hasNext()) {
-                       // Get whole list from EJB
-                       final List<Country> countries = this.countryBean.allCountries();
-
-                       // Add all
-                       for (final Country country : countries) {
-                               // Add it to cache
-                               this.countryCache.put(country.getCountryId(), country);
-                       }
-               }
-       }
-
 }
index 779d84e8170f871d02a7bfb7329b8ae93a09f471..d6246a26a75b01e77d4a1c88579104d8df8bbe87 100644 (file)
@@ -17,9 +17,6 @@
 package org.mxchange.jfinancials.beans.country;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcountry.exceptions.CountryNotFoundException;
-import org.mxchange.jcountry.model.data.Country;
 
 /**
  * An interface for country beans
@@ -28,23 +25,4 @@ import org.mxchange.jcountry.model.data.Country;
  */
 public interface FinancialsCountryWebRequestController extends Serializable {
 
-       /**
-        * A list of all countries
-        * <p>
-        * @return All countries
-        */
-       List<Country> allCountries ();
-
-       /**
-        * Returns a country instance found by given primary key. If not found, a
-        * proper exception is thrown.
-        * <p>
-        * @param countryId Primary key
-        * <p>
-        * @return Country data instance
-        * <p>
-        * @throws CountryNotFoundException If the primary key was not found
-        */
-       public Country findCountryById (final Long countryId) throws CountryNotFoundException;
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java
new file mode 100644 (file)
index 0000000..19e0059
--- /dev/null
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.country.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcountry.events.added.ObservableAdminAddedCountryEvent;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
+import org.mxchange.jcountry.model.data.Country;
+import org.mxchange.jcountry.model.data.CountrySingletonBeanRemote;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+
+/**
+ * A country-list bean
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("countryListController")
+@ViewScoped
+public class FinancialsCountryListWebViewBean extends BaseFinancialsBean implements FinancialsCountryListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 176_985_298_681_742_961L;
+
+       /**
+        * A list of all countries
+        */
+       private final List<Country> allCountries;
+
+       /**
+        * Remote country EJB
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote")
+       private CountrySingletonBeanRemote countryBean;
+
+       /**
+        * List of all countries
+        */
+       @Inject
+       @NamedCache (cacheName = "countryCache")
+       private transient Cache<Long, Country> countryCache;
+
+       /**
+        * A list of filtered countries
+        */
+       private List<Country> filteredCountries;
+
+       /**
+        * Selected country
+        */
+       private Country selectedCountry;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsCountryListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allCountries = new LinkedList<>();
+       }
+
+       /**
+        * Observing method when the event is fired that an administrator added a
+        * new country
+        * <p>
+        * @param event Event instance
+        */
+       public void afterAdminAddedCountryEvent (@Observes final ObservableAdminAddedCountryEvent event) {
+               // Is all valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedCountry() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedCountry is null"); //NOI18N
+               } else if (event.getAddedCountry().getCountryId() == null) {
+                       // And again ...
+                       throw new NullPointerException("event.addedCountry.countryId is null"); //NOI18N
+               } else if (event.getAddedCountry().getCountryId() < 1) {
+                       // Id is invalid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedCountry.countryId={0} is not valid.", event.getAddedCountry().getCountryId())); //NOI18N
+               }
+
+               // Add the event
+               this.countryCache.put(event.getAddedCountry().getCountryId(), event.getAddedCountry());
+       }
+
+       @Override
+       public Country findCountryById (final Long countryId) throws CountryNotFoundException {
+               // Validate parameter
+               if (null == countryId) {
+                       // Throw NPE
+                       throw new NullPointerException("countryId is null"); //NOI18N
+               } else if (countryId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("countryId=" + countryId + " is invalid"); //NOI18N
+               } else if (!this.countryCache.containsKey(countryId)) {
+                       // Not found
+                       throw new CountryNotFoundException(countryId);
+               }
+
+               // Get it from cache
+               final Country country = this.countryCache.get(countryId);
+
+               // Return it
+               return country;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Country> getAllCountries () {
+               return this.allCountries;
+       }
+
+       /**
+        * Getter for filtered country list
+        * <p>
+        * @return Filtered country list
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Country> getFilteredCountries () {
+               return this.filteredCountries;
+       }
+
+       /**
+        * Setter for filtered countries list
+        * <p>
+        * @param filteredCountries Filtered countries list
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredCountries (final List<Country> filteredCountries) {
+               this.filteredCountries = filteredCountries;
+       }
+
+       /**
+        * Getter for selected country
+        * <p>
+        * @return Selected country
+        */
+       public Country getSelectedCountry () {
+               return this.selectedCountry;
+       }
+
+       /**
+        * Setter for selected country
+        * <p>
+        * @param selectedCountry Selected country
+        */
+       public void setSelectedCountry (final Country selectedCountry) {
+               this.selectedCountry = selectedCountry;
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.countryCache.iterator().hasNext()) {
+                       // Get whole list from EJB
+                       final List<Country> countrys = this.countryBean.allCountries();
+
+                       // Add all
+                       for (final Country country : countrys) {
+                               // Add it to cache
+                               this.countryCache.put(country.getCountryId(), country);
+                       }
+               }
+
+               // Is cache there and list is not full?
+               if ((this.getAllCountries().isEmpty()) && (this.countryCache.iterator().hasNext())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, Country> currentEntry : this.countryCache) {
+                               // Add to list
+                               this.getAllCountries().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllCountries().sort(new Comparator<Country>() {
+                               @Override
+                               public int compare (final Country country1, final Country country2) {
+                                       return country1.getCountryId() > country2.getCountryId() ? 1 : country1.getCountryId() < country2.getCountryId() ? -1 : 0;
+                               }
+                       });
+
+                       // Set full list
+                       this.setFilteredCountries(this.getAllCountries());
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewController.java
new file mode 100644 (file)
index 0000000..e8197fb
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.country.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcountry.exceptions.CountryNotFoundException;
+import org.mxchange.jcountry.model.data.Country;
+
+/**
+ * An interface for country-list beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsCountryListWebViewController extends Serializable {
+
+       /**
+        * A list of all countries
+        * <p>
+        * @return All countries
+        */
+       List<Country> getAllCountries ();
+
+       /**
+        * Returns a country instance found by given primary key. If not found, a
+        * proper exception is thrown.
+        * <p>
+        * @param countryId Primary key
+        * <p>
+        * @return Country data instance
+        * <p>
+        * @throws CountryNotFoundException If the primary key was not found
+        */
+       public Country findCountryById (final Long countryId) throws CountryNotFoundException;
+
+}
index bdab3a7a406eb73f42fe3e573985336acf9253ed..7d86d788842f73e64d952068e0773913719a08c7 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.mobileprovider;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import javax.annotation.PostConstruct;
@@ -177,23 +176,17 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsBean i
 
                // Is the list empty, but filled cache?
                if (this.allMobileProviders.isEmpty() && this.mobileProviderCache.iterator().hasNext()) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, MobileProvider>> iterator = this.mobileProviderCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, MobileProvider> next = iterator.next();
-
+                       for (final Cache.Entry<Long, MobileProvider> currentEntry : this.mobileProviderCache) {
                                // Add to list
-                               this.allMobileProviders.add(next.getValue());
+                               this.allMobileProviders.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allMobileProviders.sort(new Comparator<MobileProvider>() {
                                @Override
-                               public int compare (final MobileProvider o1, final MobileProvider o2) {
-                                       return o1.getProviderId() > o2.getProviderId() ? 1 : o1.getProviderId() < o2.getProviderId() ? -1 : 0;
+                               public int compare (final MobileProvider mobileProvider1, final MobileProvider mobileProvider2) {
+                                       return mobileProvider1.getProviderId() > mobileProvider2.getProviderId() ? 1 : mobileProvider1.getProviderId() < mobileProvider2.getProviderId() ? -1 : 0;
                                }
                        });
                }
index d54463e8ce8e3cd15ef74659b6d4a8721f5fa123..70a20c914e988581505158272ed112e1575b3c5e 100644 (file)
@@ -18,7 +18,6 @@ package org.mxchange.jfinancials.beans.phone;
 
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
@@ -487,16 +486,10 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements
                // Init list
                final List<DialableFaxNumber> list = new LinkedList<>();
 
-               // Get iterator
-               final Iterator<Cache.Entry<Long, DialableFaxNumber>> iterator = this.faxNumberCache.iterator();
-
                // Loop over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       final Cache.Entry<Long, DialableFaxNumber> next = iterator.next();
-
+               for (final Cache.Entry<Long, DialableFaxNumber> currentEntry : this.faxNumberCache) {
                        // Add value to list
-                       list.add(next.getValue());
+                       list.add(currentEntry.getValue());
                }
 
                // Return it
@@ -509,16 +502,10 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements
                // Init list
                final List<DialableLandLineNumber> list = new LinkedList<>();
 
-               // Get iterator
-               final Iterator<Cache.Entry<Long, DialableLandLineNumber>> iterator = this.landLineNumberCache.iterator();
-
                // Loop over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       final Cache.Entry<Long, DialableLandLineNumber> next = iterator.next();
-
+               for (final Cache.Entry<Long, DialableLandLineNumber> currentEntry : this.landLineNumberCache) {
                        // Add value to list
-                       list.add(next.getValue());
+                       list.add(currentEntry.getValue());
                }
 
                // Return it
@@ -531,16 +518,10 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements
                // Init list
                final List<DialableMobileNumber> list = new LinkedList<>();
 
-               // Get iterator
-               final Iterator<Cache.Entry<Long, DialableMobileNumber>> iterator = this.mobileNumberCache.iterator();
-
                // Loop over all
-               while (iterator.hasNext()) {
-                       // Get next entry
-                       final Cache.Entry<Long, DialableMobileNumber> next = iterator.next();
-
+               for (final Cache.Entry<Long, DialableMobileNumber> currentEntry : this.mobileNumberCache) {
                        // Add value to list
-                       list.add(next.getValue());
+                       list.add(currentEntry.getValue());
                }
 
                // Return it
index 158a2261bec49d87b26196ed4c0368f1add79c52..96916310be601a415717b81470e6220c9119eb38 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.jfinancials.beans.user;
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Comparator;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
@@ -142,13 +141,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
         */
        private String userName;
 
-       /**
-        * User name list
-        */
-       @Inject
-       @NamedCache (cacheName = "userNameCache")
-       private Cache<Long, String> userNameCache;
-
        /**
         * User password (clear-text from web form)
         */
@@ -502,9 +494,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                // Update user list
                this.updateList(registeredUser);
 
-               // Add user name
-               this.addUserName(registeredUser);
-
                // Set user id again
                this.setUserId(registeredUser.getUserId());
        }
@@ -874,29 +863,22 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                        for (final User user : users) {
                                // Add it to cache
                                this.userCache.put(user.getUserId(), user);
-                               this.userNameCache.put(user.getUserId(), user.getUserName());
                        }
                }
 
                // Is cache filled and list is empty
                if ((this.userCache.iterator().hasNext()) && (this.allUsers.isEmpty())) {
-                       // Get iterator
-                       final Iterator<Cache.Entry<Long, User>> iterator = this.userCache.iterator();
-
                        // Build up list
-                       while (iterator.hasNext()) {
-                               // GEt next element
-                               final Cache.Entry<Long, User> next = iterator.next();
-
+                       for (final Cache.Entry<Long, User> currentEntry : this.userCache) {
                                // Add to list
-                               this.allUsers.add(next.getValue());
+                               this.allUsers.add(currentEntry.getValue());
                        }
 
                        // Sort list
                        this.allUsers.sort(new Comparator<User>() {
                                @Override
-                               public int compare (final User o1, final User o2) {
-                                       return o1.getUserId() > o2.getUserId() ? 1 : o1.getUserId() < o2.getUserId() ? -1 : 0;
+                               public int compare (final User user1, final User user2) {
+                                       return user1.getUserId() > user2.getUserId() ? 1 : user1.getUserId() < user2.getUserId() ? -1 : 0;
                                }
                        });
                }
@@ -919,16 +901,10 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                // Default is not found
                boolean isFound = false;
 
-               // Get iterator
-               final Iterator<User> iterator = this.allUsers().iterator();
-
                // Loop through all entries
-               while (iterator.hasNext()) {
-                       // Get user
-                       final User next = iterator.next();
-
+               for (final User currentUser : this.allUsers()) {
                        // Compare both objects
-                       if (Objects.equals(contact, next.getUserContact())) {
+                       if (Objects.equals(contact, currentUser.getUserContact())) {
                                // Found it
                                isFound = true;
                                break;
@@ -973,7 +949,21 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
 
        @Override
        public boolean isUserNameRegistered (final User user) {
-               return ((this.userNameCache instanceof List) && (this.userNameCache.containsKey(user.getUserId())));
+               // Default is not found
+               boolean isFound = false;
+
+               // Determine it
+               for (final User currentUser : this.allUsers()) {
+                       // Is same name found?
+                       if (Objects.equals(user.getUserName(), currentUser.getUserName())) {
+                               // Yes, then set flag and abort loop
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
        }
 
        @Override
@@ -1003,23 +993,20 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                User user = null;
 
                // Try to lookup it in visible user list
-               for (final Iterator<Cache.Entry<Long, User>> iterator = this.userCache.iterator(); iterator.hasNext();) {
-                       // Get next user
-                       final Cache.Entry<Long, User> next = iterator.next();
-
+               for (final Cache.Entry<Long, User> currentUser : this.userCache) {
                        // Contact should be set
-                       if (next.getValue().getUserContact() == null) {
+                       if (currentUser.getValue().getUserContact() == null) {
                                // Contact is null
-                               throw new NullPointerException(MessageFormat.format("next.userContact is null for user id {0}", next.getKey())); //NOI18N
-                       } else if (next.getValue().getUserContact().getContactEmailAddress() == null) {
+                               throw new NullPointerException(MessageFormat.format("currentUser.userContact is null for user id {0}", currentUser.getKey())); //NOI18N
+                       } else if (currentUser.getValue().getUserContact().getContactEmailAddress() == null) {
                                // Email address should be set
-                               throw new NullPointerException(MessageFormat.format("next.userContact.contactEmailAddress is null for user id {0}", next.getKey())); //NOI18N
+                               throw new NullPointerException(MessageFormat.format("currentUser.userContact.contactEmailAddress is null for user id {0}", currentUser.getKey())); //NOI18N
                        }
 
                        // Is the email address found?
-                       if (Objects.equals(next.getValue().getUserContact().getContactEmailAddress(), emailAddress)) {
+                       if (Objects.equals(currentUser.getValue().getUserContact().getContactEmailAddress(), emailAddress)) {
                                // Copy to other variable
-                               user = next.getValue();
+                               user = currentUser.getValue();
                                break;
                        }
                }
@@ -1049,14 +1036,11 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                User user = null;
 
                // Try to lookup it in visible user list
-               for (final Iterator<Cache.Entry<Long, User>> iterator = this.userCache.iterator(); iterator.hasNext();) {
-                       // Get next user
-                       final Cache.Entry<Long, User> next = iterator.next();
-
+               for (final Cache.Entry<Long, User> currentUser : this.userCache) {
                        // Is the user id found?
-                       if (Objects.equals(next.getKey(), userId)) {
+                       if (Objects.equals(currentUser.getKey(), userId)) {
                                // Copy to other variable
-                               user = next.getValue();
+                               user = currentUser.getValue();
                                break;
                        }
                }
@@ -1071,23 +1055,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                return user;
        }
 
-       /**
-        * Adds user's name to bean's internal list. It also updates the public user
-        * list if the user has decided to have a public account,
-        * <p>
-        * @param user User instance
-        */
-       private void addUserName (final User user) {
-               // Make sure the entry is not added yet
-               if (this.userNameCache.containsKey(user.getUserId())) {
-                       // Abort here
-                       throw new IllegalArgumentException(MessageFormat.format("User name {0} already added.", user.getUserName())); //NOI18N
-               }
-
-               // Add user name
-               this.userNameCache.put(user.getUserId(), user.getUserName());
-       }
-
        /**
         * Clears this bean
         */
@@ -1178,11 +1145,8 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                }
 
                // Remove it from lists
+               this.allUsers().remove(user);
                this.userCache.remove(user.getUserId());
-               this.allUsers.remove(user);
-
-               // Remove name from list
-               this.userNameCache.remove(user.getUserId());
        }
 
        /**
index 360389e0fff1596ada15bdec43b618cd0c62c930..fdbd7ddb23593100645bb46f42bbab7d3facd449 100644 (file)
@@ -17,8 +17,6 @@
 package org.mxchange.jfinancials.beans.user.confirmlink;
 
 import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Objects;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
@@ -123,24 +121,15 @@ public class FinancialsConfirmationLinkWebRequestBean extends BaseFinancialsBean
                        return;
                }
 
-               // Now try to find the user in user list, first get the whole list
-               final List<User> users = this.userController.allUsers();
-
-               // Get iterator from it
-               final Iterator<User> iterator = users.iterator();
-
                // Init instance
                User user = null;
 
                // Then loop through all
-               while (iterator.hasNext()) {
-                       // Get next user
-                       final User next = iterator.next();
-
+               for (final User currentUser : this.userController.allUsers()) {
                        // Same confirmation key?
-                       if (Objects.equals(this.getConfirmationKey(), next.getUserConfirmKey())) {
+                       if (Objects.equals(this.getConfirmationKey(), currentUser.getUserConfirmKey())) {
                                // Found it, then set it and abort loop
-                               user = next;
+                               user = currentUser;
                                break;
                        }
                }
index 7ba89f45806ea61ff5d0287836058fadb8e967a9..c22c0863e48e991c98d2e5c042ec48edc69b1c4c 100644 (file)
@@ -18,8 +18,6 @@ package org.mxchange.jfinancials.beans.user.email_address;
 
 import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Objects;
 import javax.annotation.PostConstruct;
 import javax.cache.Cache;
@@ -203,16 +201,10 @@ public class FinancialsEmailChangeWebRequestBean extends BaseFinancialsBean impl
        public void init () {
                // Is cache there?
                if (!this.queuedEmailCache.iterator().hasNext()) {
-                       // Get whole list from EJB
-                       final List<String> list = this.emailChangeBean.allQueuedAddresses();
-
                        // Add all
-                       for (final Iterator<String> iterator = list.iterator(); iterator.hasNext();) {
-                               // Get next element
-                               final String next = iterator.next();
-
+                       for (final String currentEmailAddress : this.emailChangeBean.allQueuedAddresses()) {
                                // Add it to cache
-                               this.queuedEmailCache.put(next, Boolean.TRUE);
+                               this.queuedEmailCache.put(currentEmailAddress, Boolean.TRUE);
                        }
                }
        }
index 2c9f2ad44f6acc45008264edc40d11a6c7523603..680c31fbfecf06e9779b1755bfb61d7055615c5e 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcountry.exceptions.CountryNotFoundException;
 import org.mxchange.jcountry.model.data.Country;
-import org.mxchange.jfinancials.beans.country.FinancialsCountryWebRequestBean;
-import org.mxchange.jfinancials.beans.country.FinancialsCountryWebRequestController;
+import org.mxchange.jfinancials.beans.country.list.FinancialsCountryListWebViewBean;
+import org.mxchange.jfinancials.beans.country.list.FinancialsCountryListWebViewController;
 
 /**
  * Converter for country instance
@@ -38,16 +38,10 @@ public class FinancialsCountryConverter implements Converter<Country> {
        /**
         * Country backing bean
         */
-       private static FinancialsCountryWebRequestController COUNTRY_CONTROLLER;
+       private static FinancialsCountryListWebViewController COUNTRY_LIST_CONTROLLER;
 
        @Override
        public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == COUNTRY_CONTROLLER) {
-                       // Get bean from CDI directly
-                       COUNTRY_CONTROLLER = CDI.current().select(FinancialsCountryWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
                        // Warning message
@@ -65,8 +59,14 @@ public class FinancialsCountryConverter implements Converter<Country> {
                        // Convert it to long
                        final Long countryId = Long.parseLong(submittedValue);
 
+                       // Is the instance there?
+                       if (null == COUNTRY_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               COUNTRY_LIST_CONTROLLER = CDI.current().select(FinancialsCountryListWebViewBean.class).get();
+                       }
+
                        // Try to find it
-                       country = COUNTRY_CONTROLLER.findCountryById(countryId);
+                       country = COUNTRY_LIST_CONTROLLER.findCountryById(countryId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index ddfc9ef01220557c5aebdafb2a11849acc1c7bf3..cea7dd9c46dc5fa251a073f4660a57e0a9d79a26 100644 (file)
@@ -110,7 +110,6 @@ GUEST_REGISTRATION_ENTER_USER_NAME=Benutzernamen eingeben:
 GUEST_REGISTRATION_USER_NAME_NOTICE=Der Benutzername darf nur einmal vorkommen.
 GUEST_LINK_RESENT_CONFIRMATION_LINK=Nochmals den Best\u00e4tigungslink aussenden?
 GUEST_USER_REGISTRATION_COMPLETED=Die Anmeldung ist abgeschlossen und Ihr Account wartet auf Freischaltung. Es ist eine Email mit einem entsprechenden Best\u00e4tigungslink zu Ihnen unterwegs. Diesen m\u00fcssen Sie einmal anklicken oder in die Adresszeile des Browsers kopieren und dann aufrufen lassen. Danach ist Ihr Account freigegeben.
-PERSONAL_DATA_COUNTRY_CODE=L\u00e4ndercode:
 PAGE_TITLE_USER_REGISTER_DONE=Anmeldung abgeschlossen
 CONTENT_TITLE_USER_REGISTER_DONE=Die Anmeldung ist abgeschlossen:
 PAGE_TITLE_INDEX_RESEND_LINK=Best\u00e4tigungslink erneut aussenden
@@ -294,11 +293,13 @@ ADMIN_ENTER_COUNTRY_PHONE_CODE=Vorwahl f\u00fcr das Land:
 ADMIN_ENTER_COUNTRY_PHONE_CODE_EXAMPLE=(Beispiel: 49 f\u00fcr Deutschland)
 BUTTON_ADMIN_ADD_COUNTRY=L\u00e4nderdaten hinzuf\u00fcgen
 ID_HEADER=Id:
-ADMIN_LIST_COUNTRY_DATA_COUNTRY_CODE=L\u00e4ndercode:
-ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX=Vorwahl ausserorts:
-ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME=Land:
+DATA_COUNTRY_EXTERNAL_DIAL_PREFIX=Vorwahl ausserorts:
+DATA_COUNTRY_ABROAD_DIAL_PREFIX=Vorwahl in's Ausland:
+DATA_COUNTRY_PHONE_CODE=Vorwahl vom Land:
+DATA_COUNTRY_NAME=Land:
+DATA_IS_REQUIRED=Wird ben\u00f6tigt?
 ADMIN_LINK_EDIT_DELETE_COUNTRY_TITLE=Editieren oder l\u00f6schen der L\u00e4nderdaten
-TABLE_SUMMARY_ADMIN_LIST_COUNTRIES=Diese Tabelle listet alle bereits angelegten L\u00e4nderdaten auf.
+TABLE_SUMMARY_ADMIN_LIST_COUNTRY=Diese Tabelle listet alle bereits angelegten L\u00e4nderdaten auf.
 ADMIN_MENU_MOBILE_PROVIDER_TITLE=Handyanbieter
 ADMIN_LINK_LIST_MOBILE_PROVIDER_TITLE=Hinzuf\u00fcgen, auflisten, \u00e4ndern und l\u00f6schen von Handyanbietern.
 PAGE_TITLE_ADMIN_MOBILE_PROVIDER_LIST=Handyanbieter verwalten
@@ -480,7 +481,7 @@ BUTTON_GUEST_CONFIRM_USER_ACCOUNT=Account best\u00e4tigen
 ADMIN_MENU_CONTACT_TITLE=Kontaktdaten
 ADMIN_LINK_LIST_CONTACT=Kontaktdaten
 ADMIN_LINK_LIST_CONTACT_TITLE=Listet alle Kontaktdaten auf, egal wo her sie angelegt wurden.
-ADMIN_CONTACT_COUNTRY_CODE=L\u00e4ndercode:
+DATA_COUNTRY_CODE=L\u00e4ndercode:
 ADMIN_CONTACT_MOBILE_NUMBER=Handynummer:
 ADMIN_CONTACT_LAND_LINE_NUMBER=Telefonnummer:
 ADMIN_CONTACT_FAX_NUMBER=Faxnummer:
index b5233dfd344a483f2b7ea709e203b0ced38e47ec..4dbf9617627495b3ec9d328df861734179f8b8c5 100644 (file)
@@ -109,7 +109,6 @@ GUEST_REGISTRATION_ENTER_USER_NAME=Enter user name:
 GUEST_REGISTRATION_USER_NAME_NOTICE=The user name must only exist once.
 GUEST_LINK_RESENT_CONFIRMATION_LINK=Resend again the confirmation link?
 GUEST_USER_REGISTRATION_COMPLETED=The registration is completed and your account is pending confirmation. An email has been sent to you. There you will find a confirmation link which you have to click once or copy it into your browser's address bar and call it.
-PERSONAL_DATA_COUNTRY_CODE=Country code:
 PAGE_TITLE_USER_REGISTER_DONE=Registration completed
 CONTENT_TITLE_USER_REGISTER_DONE=Registration is completed:
 PAGE_TITLE_INDEX_RESEND_LINK=Resend confirmation link
@@ -277,11 +276,13 @@ ADMIN_ENTER_COUNTRY_PHONE_CODE=Dial prefix for this country:
 ADMIN_ENTER_COUNTRY_PHONE_CODE_EXAMPLE=(Example: 1 for U.S.A.)
 BUTTON_ADMIN_ADD_COUNTRY=Add country data
 ID_HEADER=Id:
-ADMIN_LIST_COUNTRY_DATA_COUNTRY_CODE=Country code:
-ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX=Dial prefix outside:
-ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME=Country:
+DATA_COUNTRY_EXTERNAL_DIAL_PREFIX=Dial prefix outside:
+DATA_COUNTRY_ABROAD_DIAL_PREFIX=Dial prefix abroad:
+DATA_COUNTRY_PHONE_CODE=Dial prefix this country:
+DATA_COUNTRY_NAME=Country:
+DATA_IS_REQUIRED=Is required?
 ADMIN_LINK_EDIT_DELETE_COUNTRY_TITLE=Edit or delete country
-TABLE_SUMMARY_ADMIN_LIST_COUNTRIES=This table lists all countries.
+TABLE_SUMMARY_ADMIN_LIST_COUNTRY=This table lists all countries.
 ADMIN_MENU_MOBILE_PROVIDER_TITLE=Mobile providers
 ADMIN_LINK_LIST_MOBILE_PROVIDER=List mobile provider
 ADMIN_LINK_LIST_MOBILE_PROVIDER_TITLE=Add, list, edit and delete mobile providers.
@@ -473,7 +474,7 @@ BUTTON_GUEST_CONFIRM_USER_ACCOUNT=Confirm account
 ADMIN_MENU_CONTACT_TITLE=Contact data
 ADMIN_LINK_LIST_CONTACT=Contact data
 ADMIN_LINK_LIST_CONTACT_TITLE=Lists all contact data regardless where they was created.
-ADMIN_CONTACT_COUNTRY_CODE=Country code:
+DATA_COUNTRY_CODE=Country code:
 ADMIN_CONTACT_MOBILE_NUMBER=Mobile number:
 ADMIN_CONTACT_LAND_LINE_NUMBER=Phone number:
 ADMIN_CONTACT_FAX_NUMBER=Fax number:
index 94c88cc5d6fd43a01e05267a303d8b5b919adaf0..0099a771634f8201d5bc409c01bd13836aa1ef44 100644 (file)
@@ -79,7 +79,7 @@
        </p:column>
 
        <p:column>
-               <p:outputLabel for="contactCountry" styleClass="table-data-label" value="#{msg.ADMIN_CONTACT_COUNTRY_CODE}" />
+               <p:outputLabel for="contactCountry" styleClass="table-data-label" value="#{msg.DATA_COUNTRY_CODE}" />
 
                <h:outputText id="contactCountry" styleClass="table-data-field" value="#{beanHelper.contact.contactCountry.countryCode}" />
        </p:column>
index 93dc2349d66df645720f89fa69d8a0dee5da3902..f64ef0b7b75f439353a2e9a1dab9d5af64535025 100644 (file)
 
                        <h:panelGroup styleClass="table-row" layout="block">
                                <div class="table-left-medium">
-                                       <p:outputLabel for="country" value="#{msg.PERSONAL_DATA_COUNTRY_CODE}" />
+                                       <p:outputLabel for="country" value="#{msg.DATA_COUNTRY_CODE}" />
                                </div>
 
                                <div class="table-right-medium">
index 290dd9bfbaedfb59c9ea8a7ec16c425c68af8690..45ce0bc89def8b7bf3deff555818fb50b50f31da 100644 (file)
                                <p:column
                                        headerText="#{msg.ENTRY_CREATED_HEADER}"
                                        sortBy="#{basicData.companyCreated}"
+                                       filterBy="#{basicData.companyCreated}"
+                                       filterMatchMode="contains"
                                        >
-                                       <h:outputText id="companyCreated" value="#{basicData.companyCreated}">
+                                       <h:outputText value="#{basicData.companyCreated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
index e394f038d8c84493d900a9cfb789b7dbd8dc0b51..99aa89ebb879fdf8ad0de8a77136cd0d079b9cea 100644 (file)
                        <p:dataTable
                                id="countryList"
                                var="country"
-                               value="#{countryController.allCountries()}"
+                               value="#{countryListController.allCountries}"
                                paginator="true"
+                               paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
+                               filteredValue="#{countryListController.filteredCountries}"
                                rows="10"
-                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRIES}"
+                               rowKey="#{country.countryId}"
+                               reflow="true"
+                               resizableColumns="true"
+                               rowsPerPageTemplate="5,10,20,50,100"
+                               sortMode="multiple"
+                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_COUNTRY}"
                                emptyMessage="#{msg.ADMIN_EMPTY_LIST_COUNTRY}"
                                widgetVar="countryList"
+                               selectionMode="single"
+                               selection="#{countryListController.selectedCountry}"
+                               skipChildren="true"
                                >
-                               <p:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ID_HEADER}" />
-                                       </f:facet>
 
+                               <f:facet name="header">
+                                       <p:panelGrid
+                                               columns="3"
+                                               layout="grid"
+                                               columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+                                               >
+                                               <p:spacer />
+
+                                               <p:panelGrid
+                                                       columns="2"
+                                                       columnClasses="ui-grid-4,ui-grid-8"
+                                                       layout="grid"
+                                                       styleClass="ui-noborder"
+                                                       >
+                                                       <p:outputLabel for="globalFilter" value="#{msg.SEARCH_ALL_FIELDS}" style="float: right" />
+                                                       <p:inputText id="globalFilter" onkeyup="PF('countryList').filter()" placeholder="#{msg.ENTER_KEYWORD}"/>
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
+
+                                                       <p:commandButton
+                                                               id="toggler"
+                                                               type="button"
+                                                               value="#{msg.SELECT_SHOWN_COLUMNS}"
+                                                               styleClass="column-selector"
+                                                               />
+
+                                                       <p:columnToggler datasource="countryList" trigger="toggler" />
+                                               </p:outputPanel>
+                                       </p:panelGrid>
+                               </f:facet>
+
+                               <p:ajax
+                                       event="rowSelect"
+                                       update=":master:form-list-countries:country-details"
+                                       oncomplete="PF('countryDialog').show()"
+                                       />
+
+                               <p:column
+                                       headerText="#{msg.ID_HEADER}"
+                                       sortBy="#{country.countryId}"
+                                       filterable="false"
+                                       >
                                        <p:link
                                                outcome="admin_show_country"
                                                value="#{country.countryId}"
                                        </p:link>
                                </p:column>
 
-                               <p:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_CODE}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_CODE}"
+                                       sortBy="#{country.countryCode}"
+                                       filterBy="#{country.countryCode}"
+                                       filterMatchMode="contains"
+                                       >
 
                                        <h:outputText value="#{country.countryCode}" />
                                </p:column>
 
-                               <p:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_EXTERNAL_DIAL_PREFIX}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_NAME}"
+                                       sortBy="#{msg[country.countryI18nKey]}"
+                                       filterBy="#{msg[country.countryI18nKey]}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{msg[country.countryI18nKey]}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_EXTERNAL_DIAL_PREFIX}"
+                                       sortBy="#{country.countryExternalDialPrefix}"
+                                       filterBy="#{country.countryExternalDialPrefix}"
+                                       filterMatchMode="contains"
+                                       >
 
                                        <h:outputText value="#{country.countryExternalDialPrefix}" />
                                </p:column>
 
-                               <p:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_LIST_COUNTRY_DATA_COUNTRY_NAME}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.DATA_COUNTRY_ABROAD_DIAL_PREFIX}"
+                                       sortBy="#{country.countryAbroadDialPrefix}"
+                                       filterBy="#{country.countryAbroadDialPrefix}"
+                                       filterMatchMode="contains"
+                                       >
 
-                                       <h:outputText value="#{msg[country.countryI18nKey]}" />
+                                       <h:outputText value="#{country.countryAbroadDialPrefix}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.DATA_IS_REQUIRED}"
+                                       sortBy="#{country.countryIsLocalPrefixRequired}"
+                                       filterBy="#{country.countryIsLocalPrefixRequired}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryIsLocalPrefixRequired ? msg.CHOICE_YES : msg.CHOICE_NO}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_CREATED_HEADER}"
+                                       sortBy="#{country.countryEntryCreated}"
+                                       filterBy="#{country.countryEntryCreated}"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <h:outputText value="#{country.countryEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
                                </p:column>
 
-                               <p:column>
-                                       <f:facet name="header">
-                                               <h:outputText value="#{msg.ADMIN_ACTION_LINKS_HEADER}" />
-                                       </f:facet>
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{country.countryEntryUpdated}"
+                                       filterBy="#{country.countryEntryUpdated}"
+                                       filterMatchMode="contains"
+                                       >
 
+                                       <h:outputText value="#{country.countryEntryUpdated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}"
+                                       filterable="false"
+                                       sortable="false"
+                                       >
                                        <links:outputCountryAdminDropdownMenu country="#{country}" />
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_COUNTRY_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="countryDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="country-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty countryListController.selectedCountry}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_COUNTRY_DETAILS_HEADER}">
+                                                               <f:param value="#{msg[countryListController.selectedCountry.countryI18nKey]}" />
+                                                               <f:param value="#{countryListController.selectedCountry.countryId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.COUNTRY_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{countryListController.selectedCountry.countryId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
                <h:form>