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;
// 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;
}
});
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;
// 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;
}
});
}
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;
// 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;
}
});
}
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;
// 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;
}
});
}
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;
// 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;
}
});
}
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;
// 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;
}
}
);
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;
* Post-construction method
*/
@PostConstruct
- public void init () {
+ public void initializeList () {
// Is cache there?
if (!this.contactCache.iterator().hasNext()) {
// Get whole list from EJB
// 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;
}
});
// 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;
*/
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());
}
/**
* @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;
}
}
*/
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;
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
*/
private String countryCode;
- /**
- * Regular country controller
- */
- @Inject
- private JobsCountryWebRequestController countryController;
-
/**
* Local dial prefix
*/
*/
private Boolean countryIsLocalPrefixRequired;
+ /**
+ * Regular country controller
+ */
+ @Inject
+ private JobsCountryListWebViewController countryListController;
+
/**
* Phone code
*/
// 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;
*/
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;
@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<Long, Country> countryCache;
-
/**
* Default constructor
*/
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);
- }
- }
- }
-
}
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
*/
public interface JobsCountryWebRequestController 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;
-
}
--- /dev/null
+/*
+ * 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.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@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<Country> 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<Long, Country> countryCache;
+
+ /**
+ * A list of filtered countries
+ */
+ private List<Country> 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
+ * <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());
+ }
+ }
+
+}
--- /dev/null
+/*
+ * 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.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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface JobsCountryListWebViewController 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;
+
+}
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;
// 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;
}
});
}
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;
// 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
// 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
// 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
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;
*/
private String userName;
- /**
- * User name list
- */
- @Inject
- @NamedCache (cacheName = "userNameCache")
- private Cache<Long, String> userNameCache;
-
/**
* User password (clear-text from web form)
*/
// Update user list
this.updateList(registeredUser);
- // Add user name
- this.addUserName(registeredUser);
-
// Set user id again
this.setUserId(registeredUser.getUserId());
}
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;
}
});
}
// 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;
@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
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;
}
}
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;
}
}
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
*/
}
// 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());
}
/**
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;
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;
}
}
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;
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);
}
}
}
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
/**
* 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
// 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);
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
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
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:
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
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.
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:
</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>
<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">
<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>
<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>