From 3dbaebda972acb74fbd7ab069c21180cc078988f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 1 Apr 2020 20:24:20 +0200 Subject: [PATCH] Please cherry-pick: - 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../list/JobsBasicDataListWebViewBean.java | 15 +- .../list/JobsBranchOfficeListWebViewBean.java | 15 +- .../JobsDepartmentWebRequestBean.java | 15 +- .../employee/JobsEmployeeWebRequestBean.java | 15 +- .../JobsHeadquarterWebRequestBean.java | 15 +- .../JobsOpeningTimeWebRequestBean.java | 15 +- .../list/JobsContactListWebViewBean.java | 44 +--- .../JobsAdminCountryWebRequestBean.java | 28 +-- .../country/JobsCountryWebRequestBean.java | 106 --------- .../JobsCountryWebRequestController.java | 22 -- .../list/JobsCountryListWebViewBean.java | 219 ++++++++++++++++++ .../JobsCountryListWebViewController.java | 50 ++++ .../JobsMobileProviderWebRequestBean.java | 15 +- .../beans/phone/JobsPhoneWebRequestBean.java | 31 +-- .../beans/user/JobsUserWebRequestBean.java | 100 +++----- .../JobsConfirmationLinkWebRequestBean.java | 17 +- .../JobsEmailChangeWebRequestBean.java | 12 +- .../country/JobsCountryConverter.java | 20 +- .../localization/generic_de_DE.properties | 13 +- .../localization/generic_en_US.properties | 13 +- .../columns/admin_contact_data_columns.tpl | 2 +- .../templates/contact/form_contact_data.tpl | 2 +- .../basic_data/admin_basic_data_list.xhtml | 4 +- web/admin/country/admin_country_list.xhtml | 173 ++++++++++++-- 24 files changed, 539 insertions(+), 422 deletions(-) create mode 100644 src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewBean.java create mode 100644 src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewController.java diff --git a/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewBean.java index 1d64bb1e..026cf1f5 100644 --- a/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsBasicDataListWebViewBean extends BaseJobsBean implements JobsBa // Is cache there and list is not full? if ((this.getAllBasicData().isEmpty()) && (this.basicDataCache.iterator().hasNext())) { - // Get iterator - final Iterator> iterator = this.basicDataCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.basicDataCache) { // Add to list - this.getAllBasicData().add(next.getValue()); + this.getAllBasicData().add(currentEntry.getValue()); } // Sort list this.getAllBasicData().sort(new Comparator() { @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; } }); diff --git a/src/java/org/mxchange/jjobs/beans/business/branchoffice/list/JobsBranchOfficeListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/business/branchoffice/list/JobsBranchOfficeListWebViewBean.java index 73180936..fdd1a08b 100644 --- a/src/java/org/mxchange/jjobs/beans/business/branchoffice/list/JobsBranchOfficeListWebViewBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/branchoffice/list/JobsBranchOfficeListWebViewBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsBranchOfficeListWebViewBean extends BaseJobsBean implements Job // Is the list empty, but filled cache? if (this.allBranchOffices.isEmpty() && this.branchOfficeCache.iterator().hasNext()) { - // Get iterator - final Iterator> iterator = this.branchOfficeCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.branchOfficeCache) { // Add to list - this.allBranchOffices.add(next.getValue()); + this.allBranchOffices.add(currentEntry.getValue()); } // Sort list this.allBranchOffices.sort(new Comparator() { @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; } }); } diff --git a/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java index 09da5b80..84a8283c 100644 --- a/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/department/JobsDepartmentWebRequestBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsDepartmentWebRequestBean extends BaseJobsBean implements JobsDe // Is the list empty, but filled cache? if (this.allDepartments.isEmpty() && this.departmentCache.iterator().hasNext()) { - // Get iterator - final Iterator> iterator = this.departmentCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.departmentCache) { // Add to list - this.allDepartments.add(next.getValue()); + this.allDepartments.add(currentEntry.getValue()); } // Sort list this.allDepartments.sort(new Comparator() { @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; } }); } diff --git a/src/java/org/mxchange/jjobs/beans/business/employee/JobsEmployeeWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/employee/JobsEmployeeWebRequestBean.java index b276e9bb..275fb527 100644 --- a/src/java/org/mxchange/jjobs/beans/business/employee/JobsEmployeeWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/employee/JobsEmployeeWebRequestBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsEmployeeWebRequestBean extends BaseJobsBean implements JobsEmpl // Is cache filled and list is empty if ((this.employeeCache.iterator().hasNext()) && (this.allEmployees.isEmpty())) { - // Get iterator - final Iterator> iterator = this.employeeCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.employeeCache) { // Add to list - this.allEmployees.add(next.getValue()); + this.allEmployees.add(currentEntry.getValue()); } // Sort list this.allEmployees.sort(new Comparator() { @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; } }); } diff --git a/src/java/org/mxchange/jjobs/beans/business/headquarter/JobsHeadquarterWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/headquarter/JobsHeadquarterWebRequestBean.java index 10fab4f6..dc43b6d5 100644 --- a/src/java/org/mxchange/jjobs/beans/business/headquarter/JobsHeadquarterWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/headquarter/JobsHeadquarterWebRequestBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsHeadquarterWebRequestBean extends BaseJobsBean implements JobsH // Is the list empty, but filled cache? if (this.allHeadquarter.isEmpty() && this.headquarterCache.iterator().hasNext()) { - // Get iterator - final Iterator> iterator = this.headquarterCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.headquarterCache) { // Add to list - this.allHeadquarter.add(next.getValue()); + this.allHeadquarter.add(currentEntry.getValue()); } // Sort list this.allHeadquarter.sort(new Comparator() { @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; } }); } diff --git a/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java index 6fa7f434..cfd1a053 100644 --- a/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/opening_time/JobsOpeningTimeWebRequestBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsOpeningTimeWebRequestBean extends BaseJobsBean implements JobsO // Is the list empty, but filled cache? if (this.allOpeningTimes.isEmpty() && this.openingTimesCache.iterator().hasNext()) { - // Get iterator - final Iterator> iterator = this.openingTimesCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.openingTimesCache) { // Add to list - this.allOpeningTimes.add(next.getValue()); + this.allOpeningTimes.add(currentEntry.getValue()); } // Sort list this.allOpeningTimes.sort(new Comparator() { @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; } } ); diff --git a/src/java/org/mxchange/jjobs/beans/contact/list/JobsContactListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/contact/list/JobsContactListWebViewBean.java index 10ce68f1..c1d06c93 100644 --- a/src/java/org/mxchange/jjobs/beans/contact/list/JobsContactListWebViewBean.java +++ b/src/java/org/mxchange/jjobs/beans/contact/list/JobsContactListWebViewBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsContactListWebViewBean extends BaseJobsBean implements JobsCont * 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 JobsContactListWebViewBean extends BaseJobsBean implements JobsCont // Is cache there and list is not full? if ((this.getAllContacts().isEmpty()) && (this.contactCache.iterator().hasNext())) { - // Get iterator - final Iterator> iterator = this.contactCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.contactCache) { // Add to list - this.getAllContacts().add(next.getValue()); + this.getAllContacts().add(currentEntry.getValue()); } // Sort list this.getAllContacts().sort(new Comparator() { @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 JobsContactListWebViewBean extends BaseJobsBean implements JobsCont // Default is not found boolean IsFound = false; - // Get iterator - final Iterator 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 JobsContactListWebViewBean extends BaseJobsBean implements JobsCont */ 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 JobsContactListWebViewBean extends BaseJobsBean implements JobsCont * @param contact Contact instance to add uniquely */ private void uniqueAddContact (final Contact contact) { - // Get iterator from list - final Iterator> iterator = this.contactCache.iterator(); - // "Walk" through all entries - while (iterator.hasNext()) { - // Get next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry 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; } } diff --git a/src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java index 2e939910..7b3bdc1c 100644 --- a/src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/country/JobsAdminCountryWebRequestBean.java @@ -16,8 +16,6 @@ */ package org.mxchange.jjobs.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.jjobs.beans.BaseJobsBean; +import org.mxchange.jjobs.beans.country.list.JobsCountryListWebViewController; /** * An administrative country bean @@ -71,12 +70,6 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsBean implements Jobs */ private String countryCode; - /** - * Regular country controller - */ - @Inject - private JobsCountryWebRequestController countryController; - /** * Local dial prefix */ @@ -92,6 +85,12 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsBean implements Jobs */ private Boolean countryIsLocalPrefixRequired; + /** + * Regular country controller + */ + @Inject + private JobsCountryListWebViewController countryListController; + /** * Phone code */ @@ -282,19 +281,10 @@ public class JobsAdminCountryWebRequestBean extends BaseJobsBean implements Jobs // Default is not found boolean isAdded = false; - // Now get whole ist - final List countries = this.countryController.allCountries(); - - // Get iterator from it - final Iterator 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; diff --git a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java index 02bc4ff2..d23618cb 100644 --- a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestBean.java @@ -16,21 +16,9 @@ */ package org.mxchange.jjobs.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.jjobs.beans.BaseJobsBean; @@ -54,13 +42,6 @@ public class JobsCountryWebRequestBean extends BaseJobsBean implements JobsCount @EJB (lookup = "java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote") private CountrySingletonBeanRemote countryBean; - /** - * List of all countries - */ - @Inject - @NamedCache (cacheName = "countryCache") - private Cache countryCache; - /** * Default constructor */ @@ -69,91 +50,4 @@ public class JobsCountryWebRequestBean extends BaseJobsBean implements JobsCount super(); } - /** - * Observing method when the event is fired that an administrator added a - * new country - *

- * @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 allCountries () { - // Init list - final List list = new LinkedList<>(); - - // Get iterator - final Iterator> iterator = this.countryCache.iterator(); - - // Loop over all - while (iterator.hasNext()) { - // Get next entry - final Cache.Entry 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 countries = this.countryBean.allCountries(); - - // Add all - for (final Country country : countries) { - // Add it to cache - this.countryCache.put(country.getCountryId(), country); - } - } - } - } diff --git a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestController.java b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestController.java index 1f0fc0e4..8c5de0d0 100644 --- a/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestController.java +++ b/src/java/org/mxchange/jjobs/beans/country/JobsCountryWebRequestController.java @@ -17,9 +17,6 @@ package org.mxchange.jjobs.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 JobsCountryWebRequestController extends Serializable { - /** - * A list of all countries - *

- * @return All countries - */ - List allCountries (); - - /** - * Returns a country instance found by given primary key. If not found, a - * proper exception is thrown. - *

- * @param countryId Primary key - *

- * @return Country data instance - *

- * @throws CountryNotFoundException If the primary key was not found - */ - public Country findCountryById (final Long countryId) throws CountryNotFoundException; - } diff --git a/src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewBean.java b/src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewBean.java new file mode 100644 index 00000000..2467e57f --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewBean.java @@ -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 . + */ +package org.mxchange.jjobs.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.jjobs.beans.BaseJobsBean; + +/** + * A country-list bean + *

+ * @author Roland Häder + */ +@Named ("countryListController") +@ViewScoped +public class JobsCountryListWebViewBean extends BaseJobsBean implements JobsCountryListWebViewController { + + /** + * Serial number + */ + private static final long serialVersionUID = 176_985_298_681_742_961L; + + /** + * A list of all countries + */ + private final List allCountries; + + /** + * Remote country EJB + */ + @EJB (lookup = "java:global/jjobs-ejb/country!org.mxchange.jcountry.model.data.CountrySingletonBeanRemote") + private CountrySingletonBeanRemote countryBean; + + /** + * List of all countries + */ + @Inject + @NamedCache (cacheName = "countryCache") + private transient Cache countryCache; + + /** + * A list of filtered countries + */ + private List filteredCountries; + + /** + * Selected country + */ + private Country selectedCountry; + + /** + * Default constructor + */ + public JobsCountryListWebViewBean () { + // Call super constructor + super(); + + // Init list + this.allCountries = new LinkedList<>(); + } + + /** + * Observing method when the event is fired that an administrator added a + * new country + *

+ * @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 getAllCountries () { + return this.allCountries; + } + + /** + * Getter for filtered country list + *

+ * @return Filtered country list + */ + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getFilteredCountries () { + return this.filteredCountries; + } + + /** + * Setter for filtered countries list + *

+ * @param filteredCountries Filtered countries list + */ + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setFilteredCountries (final List filteredCountries) { + this.filteredCountries = filteredCountries; + } + + /** + * Getter for selected country + *

+ * @return Selected country + */ + public Country getSelectedCountry () { + return this.selectedCountry; + } + + /** + * Setter for selected country + *

+ * @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 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 currentEntry : this.countryCache) { + // Add to list + this.getAllCountries().add(currentEntry.getValue()); + } + + // Sort list + this.getAllCountries().sort(new Comparator() { + @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/jjobs/beans/country/list/JobsCountryListWebViewController.java b/src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewController.java new file mode 100644 index 00000000..51c4ec1f --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/country/list/JobsCountryListWebViewController.java @@ -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 . + */ +package org.mxchange.jjobs.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 + *

+ * @author Roland Häder + */ +public interface JobsCountryListWebViewController extends Serializable { + + /** + * A list of all countries + *

+ * @return All countries + */ + List getAllCountries (); + + /** + * Returns a country instance found by given primary key. If not found, a + * proper exception is thrown. + *

+ * @param countryId Primary key + *

+ * @return Country data instance + *

+ * @throws CountryNotFoundException If the primary key was not found + */ + public Country findCountryById (final Long countryId) throws CountryNotFoundException; + +} diff --git a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java index c2d82657..ca1c32e9 100644 --- a/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/mobileprovider/JobsMobileProviderWebRequestBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsMobileProviderWebRequestBean extends BaseJobsBean implements Jo // Is the list empty, but filled cache? if (this.allMobileProviders.isEmpty() && this.mobileProviderCache.iterator().hasNext()) { - // Get iterator - final Iterator> iterator = this.mobileProviderCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.mobileProviderCache) { // Add to list - this.allMobileProviders.add(next.getValue()); + this.allMobileProviders.add(currentEntry.getValue()); } // Sort list this.allMobileProviders.sort(new Comparator() { @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; } }); } diff --git a/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java index b40dda97..5ee30477 100644 --- a/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/phone/JobsPhoneWebRequestBean.java @@ -18,7 +18,6 @@ package org.mxchange.jjobs.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 JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe // Init list final List list = new LinkedList<>(); - // Get iterator - final Iterator> iterator = this.faxNumberCache.iterator(); - // Loop over all - while (iterator.hasNext()) { - // Get next entry - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.faxNumberCache) { // Add value to list - list.add(next.getValue()); + list.add(currentEntry.getValue()); } // Return it @@ -509,16 +502,10 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe // Init list final List list = new LinkedList<>(); - // Get iterator - final Iterator> iterator = this.landLineNumberCache.iterator(); - // Loop over all - while (iterator.hasNext()) { - // Get next entry - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.landLineNumberCache) { // Add value to list - list.add(next.getValue()); + list.add(currentEntry.getValue()); } // Return it @@ -531,16 +518,10 @@ public class JobsPhoneWebRequestBean extends BaseJobsBean implements JobsPhoneWe // Init list final List list = new LinkedList<>(); - // Get iterator - final Iterator> iterator = this.mobileNumberCache.iterator(); - // Loop over all - while (iterator.hasNext()) { - // Get next entry - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.mobileNumberCache) { // Add value to list - list.add(next.getValue()); + list.add(currentEntry.getValue()); } // Return it diff --git a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java index 40ce5305..49165b43 100644 --- a/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/JobsUserWebRequestBean.java @@ -19,7 +19,6 @@ package org.mxchange.jjobs.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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR */ private String userName; - /** - * User name list - */ - @Inject - @NamedCache (cacheName = "userNameCache") - private Cache userNameCache; - /** * User password (clear-text from web form) */ @@ -502,9 +494,6 @@ public class JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR // 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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR 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> iterator = this.userCache.iterator(); - // Build up list - while (iterator.hasNext()) { - // GEt next element - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry currentEntry : this.userCache) { // Add to list - this.allUsers.add(next.getValue()); + this.allUsers.add(currentEntry.getValue()); } // Sort list this.allUsers.sort(new Comparator() { @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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR // Default is not found boolean isFound = false; - // Get iterator - final Iterator 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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR @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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR User user = null; // Try to lookup it in visible user list - for (final Iterator> iterator = this.userCache.iterator(); iterator.hasNext();) { - // Get next user - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry 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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR User user = null; // Try to lookup it in visible user list - for (final Iterator> iterator = this.userCache.iterator(); iterator.hasNext();) { - // Get next user - final Cache.Entry next = iterator.next(); - + for (final Cache.Entry 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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR 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, - *

- * @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 JobsUserWebRequestBean extends BaseJobsBean implements JobsUserWebR } // 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()); } /** diff --git a/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java index 02a0ea75..ccf2ea4b 100644 --- a/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/confirmlink/JobsConfirmationLinkWebRequestBean.java @@ -17,8 +17,6 @@ package org.mxchange.jjobs.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 JobsConfirmationLinkWebRequestBean extends BaseJobsBean implements return; } - // Now try to find the user in user list, first get the whole list - final List users = this.userController.allUsers(); - - // Get iterator from it - final Iterator 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; } } diff --git a/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebRequestBean.java index 1981b135..a916b3a5 100644 --- a/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/user/email_address/JobsEmailChangeWebRequestBean.java @@ -18,8 +18,6 @@ package org.mxchange.jjobs.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 JobsEmailChangeWebRequestBean extends BaseJobsBean implements JobsE public void init () { // Is cache there? if (!this.queuedEmailCache.iterator().hasNext()) { - // Get whole list from EJB - final List list = this.emailChangeBean.allQueuedAddresses(); - // Add all - for (final Iterator 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); } } } diff --git a/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java b/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java index 2f516dd7..6473599f 100644 --- a/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java +++ b/src/java/org/mxchange/jjobs/converter/country/JobsCountryConverter.java @@ -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.jjobs.beans.country.JobsCountryWebRequestBean; -import org.mxchange.jjobs.beans.country.JobsCountryWebRequestController; +import org.mxchange.jjobs.beans.country.list.JobsCountryListWebViewBean; +import org.mxchange.jjobs.beans.country.list.JobsCountryListWebViewController; /** * Converter for country instance @@ -38,16 +38,10 @@ public class JobsCountryConverter implements Converter { /** * Country backing bean */ - private static JobsCountryWebRequestController COUNTRY_CONTROLLER; + private static JobsCountryListWebViewController 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(JobsCountryWebRequestBean.class).get(); - } - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -65,8 +59,14 @@ public class JobsCountryConverter implements Converter { // 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(JobsCountryListWebViewBean.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); diff --git a/src/java/org/mxchange/localization/generic_de_DE.properties b/src/java/org/mxchange/localization/generic_de_DE.properties index fe05c837..fac4739f 100644 --- a/src/java/org/mxchange/localization/generic_de_DE.properties +++ b/src/java/org/mxchange/localization/generic_de_DE.properties @@ -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 @@ -310,11 +309,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 @@ -496,7 +497,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_LANDLINE_NUMBER=Telefonnummer: ADMIN_CONTACT_FAX_NUMBER=Faxnummer: diff --git a/src/java/org/mxchange/localization/generic_en_US.properties b/src/java/org/mxchange/localization/generic_en_US.properties index 4cf5bcde..d9a51515 100644 --- a/src/java/org/mxchange/localization/generic_en_US.properties +++ b/src/java/org/mxchange/localization/generic_en_US.properties @@ -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 @@ -284,11 +283,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. @@ -481,7 +482,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_LANDLINE_NUMBER=Phone number: ADMIN_CONTACT_FAX_NUMBER=Fax number: diff --git a/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl b/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl index 49934fc9..7be60aca 100644 --- a/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl +++ b/web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl @@ -79,7 +79,7 @@ - + diff --git a/web/WEB-INF/templates/contact/form_contact_data.tpl b/web/WEB-INF/templates/contact/form_contact_data.tpl index 93dc2349..f64ef0b7 100644 --- a/web/WEB-INF/templates/contact/form_contact_data.tpl +++ b/web/WEB-INF/templates/contact/form_contact_data.tpl @@ -153,7 +153,7 @@

- +
diff --git a/web/admin/basic_data/admin_basic_data_list.xhtml b/web/admin/basic_data/admin_basic_data_list.xhtml index 290dd9bf..45ce0bc8 100644 --- a/web/admin/basic_data/admin_basic_data_list.xhtml +++ b/web/admin/basic_data/admin_basic_data_list.xhtml @@ -264,8 +264,10 @@ - + diff --git a/web/admin/country/admin_country_list.xhtml b/web/admin/country/admin_country_list.xhtml index e394f038..99aa89eb 100644 --- a/web/admin/country/admin_country_list.xhtml +++ b/web/admin/country/admin_country_list.xhtml @@ -22,18 +22,68 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - + - - - - + + + + + + - - - - + - + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + -- 2.39.5