From: Roland Häder Date: Fri, 30 Mar 2018 17:36:50 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=713e8a4167443a28c6c514bcae30032f62afa11a;p=jjobs-war.git Please cherry-pick: - data output by a p:dataTable with pagination, filtering and sorting cannot come from a request-scoped bean as each AJAX request will reset the filteredValue-referenced bean property to null which leads to an empty table. - better is to have a separate backing bean on view-scoped which holds both lists, the full ("all") list and filtered list (which are the items that have passed the filter). - also had to update converters and validators - finally, no need for javax.faces.STATE_SAVING_METHOD=client anymore! yeah! - rewrote menu system (admin at least, guest and user login is following) to a menu-bar-based system which saves a lot space and is a more modern approach - added filter for not caching xhtml (JSF view) requests Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestBean.java b/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestBean.java index 124244d9..44311693 100644 --- a/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestBean.java +++ b/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestBean.java @@ -16,25 +16,11 @@ */ package org.mxchange.jjobs.beans.business.basicdata; -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; -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.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent; -import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException; import org.mxchange.jcontactsbusiness.model.basicdata.AdminBasicCompanyDataSessionBeanRemote; -import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote; -import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcountry.model.data.Country; import org.mxchange.jjobs.beans.BaseJobsBean; import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; @@ -44,7 +30,7 @@ import org.mxchange.jjobs.beans.user.login.JobsUserLoginWebSessionController; *

* @author Roland Häder */ -@Named ("basicCompanyDataController") +@Named ("basicDataController") @RequestScoped public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBasicDataWebRequestController { @@ -60,6 +46,7 @@ public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBas private AdminBasicCompanyDataSessionBeanRemote adminBasicCompanyDataBean; /** +<<<<<<< HEAD:src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestBean.java * List of all basic company data */ private final List allBasicData; @@ -78,6 +65,8 @@ public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBas private BasicCompanyDataSessionBeanRemote businessDataBean; /** +======= +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestBean.java * Comments for this company */ private String companyComments; @@ -107,11 +96,6 @@ public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBas */ private Long faxNumber; - /** - * List of filtered basic company data - */ - private List filteredBasicCompanyData; - /** * Area code for land-line number */ @@ -139,73 +123,6 @@ public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBas public JobsBasicDataWebRequestBean () { // Call super constructor super(); - - // Init list - this.allBasicData = new LinkedList<>(); - } - - /** - * Observers events being fired when an administrator has added company - * basic data. - *

- * @param event Event being fired - */ - public void afterAdminAddedBasicCompanyDataEvent (@Observes final ObservableAdminAddedBusinessBasicDataEvent event) { - // Is the parameter valid? - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getBasicData() == null) { - // Throw NPE again - throw new NullPointerException("event.basicData is null"); //NOI18N - } else if (event.getBasicData().getBasicDataId() == null) { - // Throw NPE again - throw new NullPointerException("event.basicData.basicDataId is null"); //NOI18N - } else if (event.getBasicData().getBasicDataId() < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("event.basicData.basicDataId={0} is invalid", event.getBasicData().getBasicDataId())); //NOI18N - } else if (event.getBasicData().getCompanyName() == null) { - // Throw NPE again - throw new NullPointerException("event.basicData.companyName is null"); //NOI18N - } else if (event.getBasicData().getCompanyName().isEmpty()) { - // Throw IAE again - throw new IllegalArgumentException("event.basicData.companyName is empty"); //NOI18N - } - - // Add it to list - this.basicDataCache.put(event.getBasicData().getBasicDataId(), event.getBasicData()); - this.allBasicData.add(event.getBasicData()); - } - - /** - * Getter for a list of all business contacts - *

- * @return A list of all business contacts - */ - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List allBasicData () { - return this.allBasicData; - } - - @Override - public BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException { - // Validate parameter - if (null == basicDataId) { - // Throw NPE - throw new NullPointerException("basicDataId is null"); //NOI18N - } else if (basicDataId < 1) { - // Throw IAE - throw new IllegalArgumentException(MessageFormat.format("basicDataId={0} is invalid", basicDataId)); //NOI18N - } else if (!this.basicDataCache.containsKey(basicDataId)) { - // Not found - throw new BasicDataNotFoundException(basicDataId); - } - - // Get it from cache - final BasicData basicData = this.basicDataCache.get(basicDataId); - - // Return it - return basicData; } /** @@ -316,26 +233,6 @@ public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBas this.faxNumber = faxNumber; } - /** - * Getter for filtered basic company data - *

- * @return Filtered basic company data - */ - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List getFilteredBasicCompanyData () { - return this.filteredBasicCompanyData; - } - - /** - * Setter for filtered basic company data - *

- * @param filteredBasicCompanyData Filtered basic company data - */ - @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") - public void setFilteredBasicCompanyData (final List filteredBasicCompanyData) { - this.filteredBasicCompanyData = filteredBasicCompanyData; - } - /** * Getter for land-line number's area code *

@@ -390,103 +287,6 @@ public class JobsBasicDataWebRequestBean extends BaseJobsBean implements JobsBas this.landLineNumber = landLineNumber; } - /** - * Initializer method - */ - @PostConstruct - public void initializeList () { - // Is cache there? - if (!this.basicDataCache.iterator().hasNext()) { - // Get whole list - final List basicDatas = this.businessDataBean.allBusinessBasicData(); - - // Add all - for (final BasicData basicData : basicDatas) { - // Add it to cache - this.basicDataCache.put(basicData.getBasicDataId(), basicData); - } - } - - // Is cache there and list is not full? - if ((this.allBasicData.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(); - - // Add to list - this.allBasicData.add(next.getValue()); - } - - // Sort list - this.allBasicData.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; - } - }); - } - } - - @Override - public Boolean isCompanyNameUsed (final String companyName) { - // Validate parameter - if (null == companyName) { - // Throw NPE - throw new NullPointerException("companyName is null"); //NOI18N - } else if (companyName.isEmpty()) { - // Throw IAE - throw new IllegalArgumentException("companyName is empty"); //NOI18N - } - - // Default is not found - boolean isFound = false; - - // Check all entries - for (final BasicData basicData : this.allBasicData()) { - // Is same company name? - if (Objects.equals(basicData.getCompanyName(), companyName)) { - // Found it - isFound = true; - break; - } - } - - // Return flag - return isFound; - } - - @Override - public Boolean isEmailAddressRegistered (final String emailAddress) { - // Validate parameter - if (null == emailAddress) { - // Throw NPE - throw new NullPointerException("emailAddress is null"); //NOI18N - } else if (emailAddress.isEmpty()) { - // Throw IAE - throw new IllegalArgumentException("emailAddress is empty"); //NOI18N - } - - // Default is not found - boolean isFound = false; - - // Check all entries - for (final BasicData basicData : this.allBasicData()) { - // Is email address used? - if (Objects.equals(basicData.getCompanyEmailAddress(), emailAddress)) { - // Found it - isFound = true; - break; - } - } - - // Return flag - return isFound; - } - /** * Clears this bean */ diff --git a/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestController.java b/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestController.java index c801fbdd..ef5468d3 100644 --- a/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestController.java +++ b/src/java/org/mxchange/jjobs/beans/business/basicdata/JobsBasicDataWebRequestController.java @@ -17,8 +17,6 @@ package org.mxchange.jjobs.beans.business.basicdata; import java.io.Serializable; -import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException; -import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; /** * An interface for session-scoped financial controller @@ -27,36 +25,4 @@ import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; */ public interface JobsBasicDataWebRequestController extends Serializable { - /** - * Checks if given email address is already registered by other basic - * company data - *

- * @param emailAddress Email address - *

- * @return Whether the email address has been already registered - */ - Boolean isEmailAddressRegistered (final String emailAddress); - - /** - * Retrieves a single business data entity for given id number or throws a - * proper exception if not found. - *

- * @param basicDataId Company basic data id to lookup - *

- * @return Business contact instance - *

- * @throws BasicDataNotFoundException If the id number could not be looked - * up and solved into an entity - */ - BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException; - - /** - * Checks whether given company name already exists - *

- * @param companyName Company name to check - *

- * @return Whether the company name exists - */ - Boolean isCompanyNameUsed (final String companyName); - } 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 new file mode 100644 index 00000000..833777ac --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewBean.java @@ -0,0 +1,271 @@ +/* + * Copyright (C) 2017, 2018 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.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; +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.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent; +import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; +import org.mxchange.jjobs.beans.BaseJobsBean; + +/** + * A view-scoped bean for product lists + *

+ * @author Roland Haeder + */ +@Named ("basicDataListController") +@ViewScoped +public class JobsBasicDataListWebViewBean extends BaseJobsBean implements JobsBasicDataListWebViewController { + + /** + * Serial number + */ + private static final long serialVersionUID = 34_869_872_672_645L; + + /** + * List of all basic company data + */ + private final List allBasicData; + + /** + * EJB for general basic business data purposes + */ + @EJB (lookup = "java:global/jjobs-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote", description = "A stateless session bean for general purposes.") + private BasicCompanyDataSessionBeanRemote basicDataBean; + + /** + * A list of all registered companies (globally) + */ + @Inject + @NamedCache (cacheName = "basicDataCache") + private transient Cache basicDataCache; + + /** + * List of filtered basic company data + */ + private List filteredBasicData; + + /** + * Default constructor + */ + public JobsBasicDataListWebViewBean () { + // Call super constructor + super(); + + // Init list + this.allBasicData = new LinkedList<>(); + } + + /** + * Observers events being fired when an administrator has added company + * basic data. + *

+ * @param event Event being fired + */ + public void afterAdminAddedBasicCompanyDataEvent (@Observes final ObservableAdminAddedBusinessBasicDataEvent event) { + // Is the parameter valid? + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getBasicData() == null) { + // Throw NPE again + throw new NullPointerException("event.basicData is null"); //NOI18N + } else if (event.getBasicData().getBasicDataId() == null) { + // Throw NPE again + throw new NullPointerException("event.basicData.basicDataId is null"); //NOI18N + } else if (event.getBasicData().getBasicDataId() < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("event.basicData.basicDataId={0} is invalid", event.getBasicData().getBasicDataId())); //NOI18N + } else if (event.getBasicData().getCompanyName() == null) { + // Throw NPE again + throw new NullPointerException("event.basicData.companyName is null"); //NOI18N + } else if (event.getBasicData().getCompanyName().isEmpty()) { + // Throw IAE again + throw new IllegalArgumentException("event.basicData.companyName is empty"); //NOI18N + } + + // Add it to list + this.basicDataCache.put(event.getBasicData().getBasicDataId(), event.getBasicData()); + this.getAllBasicData().add(event.getBasicData()); + } + + @Override + public BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException { + // Validate parameter + if (null == basicDataId) { + // Throw NPE + throw new NullPointerException("basicDataId is null"); //NOI18N + } else if (basicDataId < 1) { + // Throw IAE + throw new IllegalArgumentException(MessageFormat.format("basicDataId={0} is invalid", basicDataId)); //NOI18N + } else if (!this.basicDataCache.containsKey(basicDataId)) { + // Not found + throw new BasicDataNotFoundException(basicDataId); + } + + // Get it from cache + final BasicData basicData = this.basicDataCache.get(basicDataId); + + // Return it + return basicData; + } + + /** + * Getter for a list of all business contacts + *

+ * @return A list of all business contacts + */ + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getAllBasicData () { + return this.allBasicData; + } + + /** + * Getter for filtered basic company data + *

+ * @return Filtered basic company data + */ + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getFilteredBasicData () { + return this.filteredBasicData; + } + + /** + * Setter for filtered basic company data + *

+ * @param filteredBasicData Filtered basic company data + */ + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setFilteredBasicData (final List filteredBasicData) { + this.filteredBasicData = filteredBasicData; + } + + /** + * Initializer method + */ + @PostConstruct + public void initializeList () { + // Is cache there? + if (!this.basicDataCache.iterator().hasNext()) { + // Get whole list + final List basicDatas = this.basicDataBean.allBusinessBasicData(); + + // Add all + for (final BasicData basicData : basicDatas) { + // Add it to cache + this.basicDataCache.put(basicData.getBasicDataId(), basicData); + } + } + + // 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(); + + // Add to list + this.getAllBasicData().add(next.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; + } + }); + + // Set full list + this.setFilteredBasicData(this.getAllBasicData()); + } + } + + @Override + public Boolean isCompanyNameUsed (final String companyName) { + // Validate parameter + if (null == companyName) { + // Throw NPE + throw new NullPointerException("companyName is null"); //NOI18N + } else if (companyName.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("companyName is empty"); //NOI18N + } + + // Default is not found + boolean isFound = false; + + // Check all entries + for (final BasicData basicData : this.getAllBasicData()) { + // Is same company name? + if (Objects.equals(basicData.getCompanyName(), companyName)) { + // Found it + isFound = true; + break; + } + } + + // Return flag + return isFound; + } + + @Override + public Boolean isEmailAddressRegistered (final String emailAddress) { + // Validate parameter + if (null == emailAddress) { + // Throw NPE + throw new NullPointerException("emailAddress is null"); //NOI18N + } else if (emailAddress.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("emailAddress is empty"); //NOI18N + } + + // Default is not found + boolean isFound = false; + + // Check all entries + for (final BasicData basicData : this.getAllBasicData()) { + // Is email address used? + if (Objects.equals(basicData.getCompanyEmailAddress(), emailAddress)) { + // Found it + isFound = true; + break; + } + } + + // Return flag + return isFound; + } + +} diff --git a/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewController.java b/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewController.java new file mode 100644 index 00000000..f4424c8c --- /dev/null +++ b/src/java/org/mxchange/jjobs/beans/business/basicdata/list/JobsBasicDataListWebViewController.java @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2018 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.jfinancials.beans.business.basicdata.list; + +import java.io.Serializable; +import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; + +/** + * An interface of basic data list backing beans + *

+ * @author Roland Häder + */ +public interface JobsBasicDataListWebViewController extends Serializable { + + /** + * Retrieves a single business data entity for given id number or throws a + * proper exception if not found. + *

+ * @param basicDataId Company basic data id to lookup + *

+ * @return Business contact instance + *

+ * @throws BasicDataNotFoundException If the id number could not be looked + * up and solved into an entity + */ + BasicData findBasicDataById (final Long basicDataId) throws BasicDataNotFoundException; + + /** + * Checks if given email address is already registered by other basic + * company data + *

+ * @param emailAddress Email address + *

+ * @return Whether the email address has been already registered + */ + Boolean isEmailAddressRegistered (final String emailAddress); + + /** + * Checks whether given company name already exists + *

+ * @param companyName Company name to check + *

+ * @return Whether the company name exists + */ + Boolean isCompanyNameUsed (final String companyName); + +} diff --git a/src/java/org/mxchange/jjobs/beans/data/JobsDataWebApplicationBean.java b/src/java/org/mxchange/jjobs/beans/data/JobsDataWebApplicationBean.java index 6e29c400..4a7983d6 100644 --- a/src/java/org/mxchange/jjobs/beans/data/JobsDataWebApplicationBean.java +++ b/src/java/org/mxchange/jjobs/beans/data/JobsDataWebApplicationBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Haeder + * Copyright (C) 2017, 2018 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 diff --git a/src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java b/src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java index a35c4594..2feff0fa 100644 --- a/src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java +++ b/src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java @@ -24,8 +24,13 @@ import javax.faces.convert.ConverterException; import javax.faces.convert.FacesConverter; import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException; import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; +<<<<<<< HEAD:src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java import org.mxchange.jjobs.beans.business.basicdata.JobsBasicDataWebRequestBean; import org.mxchange.jjobs.beans.business.basicdata.JobsBasicDataWebRequestController; +======= +import org.mxchange.jjobs.beans.business.basicdata.list.JobsBasicDataListWebViewBean; +import org.mxchange.jjobs.beans.business.basicdata.list.JobsBasicDataListWebViewController; +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBasicCompanyDataConverter.java /** * Converter for basic company data id <-> valid basic company data instance @@ -38,14 +43,22 @@ public class JobsBasicCompanyDataConverter implements Converter { /** * Basic company data backing bean */ +<<<<<<< HEAD:src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java private static JobsBasicDataWebRequestController BASIC_DATA_CONTROLLER; +======= + private static JobsBasicDataListWebViewController BASIC_DATA_LIST_CONTROLLER; +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBasicCompanyDataConverter.java @Override public BasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the instance there? - if (null == BASIC_DATA_CONTROLLER) { + if (null == BASIC_DATA_LIST_CONTROLLER) { // Get bean from CDI directly +<<<<<<< HEAD:src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBusinessContactConverter.java BASIC_DATA_CONTROLLER = CDI.current().select(JobsBasicDataWebRequestBean.class).get(); +======= + BASIC_DATA_LIST_CONTROLLER = CDI.current().select(JobsBasicDataListWebViewBean.class).get(); +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/converter/business/basicdata/JobsBasicCompanyDataConverter.java } // Is the value null or empty? @@ -65,7 +78,7 @@ public class JobsBasicCompanyDataConverter implements Converter { final Long basicDataId = Long.valueOf(submittedValue); // Try to get user instance from it - basicData = BASIC_DATA_CONTROLLER.findBasicDataById(basicDataId); + basicData = BASIC_DATA_LIST_CONTROLLER.findBasicDataById(basicDataId); } catch (final NumberFormatException ex) { // Throw again throw new ConverterException(ex); diff --git a/src/java/org/mxchange/jjobs/filter/JobsNoCacheFilter.java b/src/java/org/mxchange/jjobs/filter/JobsNoCacheFilter.java new file mode 100644 index 00000000..f74f4372 --- /dev/null +++ b/src/java/org/mxchange/jjobs/filter/JobsNoCacheFilter.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2018 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.filter; + +import java.io.IOException; +import javax.faces.application.ResourceHandler; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebFilter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * A filter for no-caching of JSF requests send from client. This class was + * taken from stackoverflow.com at + * https://stackoverflow.com/questions/3642919/javax-faces-application-viewexpiredexception-view-could-not-be-restored + * and was slightly expanded with "final" keyword and comments + *

+ * @author Bauke "BalusC" Scholz + * @author Roland Häder + */ +@WebFilter (servletNames = {"Faces Servlet"}) +public class JobsNoCacheFilter implements Filter { + + @Override + public void destroy () { + System.out.println("destroy!"); + } + + @Override + public void doFilter (final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException { + // Cast parameter + final HttpServletRequest req = (HttpServletRequest) request; + final HttpServletResponse res = (HttpServletResponse) response; + + // Is the request URI not starting with resource identifier? + if (!req.getRequestURI().startsWith(req.getContextPath() + ResourceHandler.RESOURCE_IDENTIFIER)) { + res.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); //NOI18N + res.setHeader("Pragma", "no-cache"); // //NOI18N + res.setDateHeader("Expires", 0); // //NOI18N + } + + // Continue filtering + chain.doFilter(request, response); + } + + @Override + public void init (final FilterConfig filterConfig) throws ServletException { + System.out.println("init!"); + } + +} diff --git a/src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java b/src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java index c4c7ced7..a7e4eebf 100644 --- a/src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java +++ b/src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java @@ -24,8 +24,13 @@ import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.string.BaseStringValidator; +<<<<<<< HEAD:src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java import org.mxchange.jjobs.beans.business.basicdata.JobsBasicDataWebRequestBean; import org.mxchange.jjobs.beans.business.basicdata.JobsBasicDataWebRequestController; +======= +import org.mxchange.jjobs.beans.business.basicdata.list.JobsBasicDataListWebViewBean; +import org.mxchange.jjobs.beans.business.basicdata.list.JobsBasicDataListWebViewController; +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java /** * A validator for basic data company names @@ -38,7 +43,11 @@ public class JobsBasicDataCompanyNameValidator extends BaseStringValidator { /** * Business basic data backing bean */ +<<<<<<< HEAD:src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java private static JobsBasicDataWebRequestController BASIC_DATA_CONTROLLER; +======= + private static JobsBasicDataListWebViewController BASIC_DATA_LIST_CONTROLLER; +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java /** * Serial number @@ -48,9 +57,13 @@ public class JobsBasicDataCompanyNameValidator extends BaseStringValidator { @Override public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException { // Is the instance there? - if (null == BASIC_DATA_CONTROLLER) { + if (null == BASIC_DATA_LIST_CONTROLLER) { // Get bean from CDI directly +<<<<<<< HEAD:src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java BASIC_DATA_CONTROLLER = CDI.current().select(JobsBasicDataWebRequestBean.class).get(); +======= + BASIC_DATA_LIST_CONTROLLER = CDI.current().select(JobsBasicDataListWebViewBean.class).get(); +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/validator/business/basicdata/JobsBasicDataCompanyNameValidator.java } // All accepted, required fields @@ -81,7 +94,7 @@ public class JobsBasicDataCompanyNameValidator extends BaseStringValidator { } // Check if name is already used - final Boolean nameExists = BASIC_DATA_CONTROLLER.isCompanyNameUsed(companyName); + final Boolean nameExists = BASIC_DATA_LIST_CONTROLLER.isCompanyNameUsed(companyName); // Is the user id valid? if ((!nameExists) && (checkExisting)) { diff --git a/src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java b/src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java index f2ccf3d4..ce6693fd 100644 --- a/src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java +++ b/src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java @@ -25,8 +25,13 @@ import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.string.BaseStringValidator; +<<<<<<< HEAD:src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java import org.mxchange.jjobs.beans.business.basicdata.JobsBasicDataWebRequestBean; import org.mxchange.jjobs.beans.business.basicdata.JobsBasicDataWebRequestController; +======= +import org.mxchange.jjobs.beans.business.basicdata.list.JobsBasicDataListWebViewBean; +import org.mxchange.jjobs.beans.business.basicdata.list.JobsBasicDataListWebViewController; +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java /** * A validator for basic company data email address validation @@ -39,7 +44,11 @@ public class JobsBasicDataEmailAddressValidator extends BaseStringValidator { /** * Branch office backing bean */ +<<<<<<< HEAD:src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java private static JobsBasicDataWebRequestController BASIC_DATA_CONTROLLER; +======= + private static JobsBasicDataListWebViewController BASIC_DATA_LIST_CONTROLLER; +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java /** * Email pattern @@ -115,13 +124,17 @@ public class JobsBasicDataEmailAddressValidator extends BaseStringValidator { final String clientId = component.getClientId(); // Is the instance there? - if (null == BASIC_DATA_CONTROLLER) { + if (null == BASIC_DATA_LIST_CONTROLLER) { // Get bean from CDI directly +<<<<<<< HEAD:src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java BASIC_DATA_CONTROLLER = CDI.current().select(JobsBasicDataWebRequestBean.class).get(); +======= + BASIC_DATA_LIST_CONTROLLER = CDI.current().select(JobsBasicDataListWebViewBean.class).get(); +>>>>>>> 11ccdf2a4... Please cherry-pick::src/java/org/mxchange/jjobs/validator/emailaddress/basicdata/JobsBasicDataEmailAddressValidator.java } // Is it registered? - final Boolean isRegistered = BASIC_DATA_CONTROLLER.isEmailAddressRegistered(emailAddress); + final Boolean isRegistered = BASIC_DATA_LIST_CONTROLLER.isEmailAddressRegistered(emailAddress); // Is the email address already registered? if ((!clientId.endsWith("resendEmailAddress")) && (isRegistered)) { //NOI18N diff --git a/src/java/org/mxchange/localization/generic_de_DE.properties b/src/java/org/mxchange/localization/generic_de_DE.properties index 0ef22b61..afb1f3ab 100644 --- a/src/java/org/mxchange/localization/generic_de_DE.properties +++ b/src/java/org/mxchange/localization/generic_de_DE.properties @@ -241,7 +241,7 @@ PAGE_TITLE_ADMIN_EDIT_USER=Benuzteraccount editieren CONTENT_TITLE_ADMIN_EDIT_USER=\u00c4ndern von Benutzeraccounts: PAGE_TITLE_ADMIN_UNLOCK_USER=Entsperren von Benutzeraccounts CONTENT_TITLE_ADMIN_UNLOCK_USER=Entsperren von Benutzeraccounts: -ADMIN_MENU_USER_TITLE=Benutzerverwaltung +ADMIN_MENU_USER_TITLE=Benutzer #@TODO Please fix German umlauts! PAGE_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen CONTENT_TITLE_ADMIN_ADD_USER=Neues Benutzeraccount hinzufuegen: @@ -475,7 +475,7 @@ GUEST_CONFIRMATION_KEY_NOT_SET=Es wurde keine Best\u00e4tigungsschl\u00fcssel an GUEST_CONFIRM_USER_ACCOUNT_DONE_TITLE=Vielen Dank f\u00fcr die Best\u00e4tigung GUEST_USER_CONFIRM_ACCOUNT_DONE=Hallo {0} {1} {2}. Sie haben soeben Ihren Account best\u00e4tigt. Es ist eine Mail mit weiteren Details an Sie unterwegs. BUTTON_GUEST_CONFIRM_USER_ACCOUNT=Account best\u00e4tigen -ADMIN_MENU_CONTACT_TITLE=Kontaktdaten 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: @@ -579,7 +579,7 @@ ERROR_BEAN_HELPER_USER_NOT_SET=Fehler: Instanz 'user' im Bean-Helper nicht geset ERROR_BEAN_HELPER_CONTACT_NOT_SET=Fehler: Instanz 'contact' im Bean-Helper nicht gesetzt. ERROR_BEAN_HELPER_MOBILE_NUMBER_NOT_SET=Fehler: Instanz 'mobile' in Bean-Helper nicht gesetzt. CONTENT_TITLE_ADMIN_LIST_CONTACT_MOBILE_NUMBER=Auflisten von Mobiltelefonnummern: -ADMIN_MENU_PHONE_NUMBERS_TITLE=Telefonnummern: +ADMIN_MENU_PHONE_NUMBERS_TITLE=Telefonnummern ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS=Handynummern ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS_TITLE=Alle Mobilfunknummern auflisten. ADMIN_SHOW_PHONE_CREATED=Telefoneintrag erstellt: @@ -1170,3 +1170,5 @@ ADMIN_LAND_LINE_NUMBER_REQUIRED=Bitte geben Sie die Rufnummer zur Festnetznummer ADMIN_FAX_AREA_CODE_REQUIRED=Bitte geben Sie die Vorwahlnummer zur Faxnummer ein. ADMIN_FAX_NUMBER_REQUIRED=Bitte geben Sie die Rufnummer zur Faxnummer ein. CHOICE_ALL=Alle/s +ENTER_KEYWORD=Stichwort eingeben ... +SEARCH_ALL_FIELDS=Alle Felder durchsuchen: diff --git a/src/java/org/mxchange/localization/generic_en_US.properties b/src/java/org/mxchange/localization/generic_en_US.properties index a79f1cd7..8a2e3756 100644 --- a/src/java/org/mxchange/localization/generic_en_US.properties +++ b/src/java/org/mxchange/localization/generic_en_US.properties @@ -226,7 +226,7 @@ PAGE_TITLE_ADMIN_EDIT_USER=Edit user accounts CONTENT_TITLE_ADMIN_EDIT_USER=Edit user accounts: PAGE_TITLE_ADMIN_UNLOCK_USER=Unlock user accounts CONTENT_TITLE_ADMIN_UNLOCK_USER=Unlock user accounts: -ADMIN_MENU_USER_TITLE=User management +ADMIN_MENU_USER_TITLE=Users PAGE_TITLE_ADMIN_ADD_USER=Add new user account CONTENT_TITLE_ADMIN_ADD_USER=Add new user account: TABLE_SUMMARY_ADMIN_LIST_USERS=Administration, list all users @@ -469,7 +469,7 @@ GUEST_CONFIRMATION_KEY_NOT_SET=No confirmation key was provided. Please check th GUEST_CONFIRM_USER_ACCOUNT_DONE_TITLE=Thank you for confirmation of your account GUEST_USER_CONFIRM_ACCOUNT_DONE=Hello {0} {1} {2}. You have successfully confirmed your account. An email with more details is on it's way to you. BUTTON_GUEST_CONFIRM_USER_ACCOUNT=Confirm account -ADMIN_MENU_CONTACT_TITLE=Manage contact data +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: @@ -570,7 +570,7 @@ ERROR_BEAN_HELPER_USER_NOT_SET=Error: Instance 'user' not set in bean helper. ERROR_BEAN_HELPER_CONTACT_NOT_SET=Error: Instance 'contact' not set in bean helper. ERROR_BEAN_HELPER_MOBILE_NUMBER_NOT_SET=Error: Instance 'mobile' in bean helper not set. CONTENT_TITLE_ADMIN_LIST_CONTACT_MOBILE_NUMBER=List mobile phone numbers: -ADMIN_MENU_PHONE_NUMBERS_TITLE=Phone numbers: +ADMIN_MENU_PHONE_NUMBERS_TITLE=Phone numbers ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS=Mobile numbers ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS_TITLE=List all mobile numbers. ADMIN_SHOW_PHONE_CREATED=Created: @@ -1064,3 +1064,5 @@ ADMIN_LAND_LINE_NUMBER_REQUIRED=Please enter caller number for land-line number. ADMIN_FAX_AREA_CODE_REQUIRED=Please enter an area-code for fax number. ADMIN_FAX_NUMBER_REQUIRED=Please enter caller number for fax number. CHOICE_ALL=All +ENTER_KEYWORD=Enter keyword ... +SEARCH_ALL_FIELDS=Search all fields: diff --git a/web/WEB-INF/templates/admin/admin_menu.tpl b/web/WEB-INF/templates/admin/admin_menu.tpl index b992069a..9310b72e 100644 --- a/web/WEB-INF/templates/admin/admin_menu.tpl +++ b/web/WEB-INF/templates/admin/admin_menu.tpl @@ -1,14 +1,13 @@ + > - + @@ -48,10 +47,12 @@ - + - + + + diff --git a/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl b/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl index e4fd7bd2..6f81c4c3 100644 --- a/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl +++ b/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl @@ -23,7 +23,7 @@ > - + diff --git a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl index bc7fb9c6..50ef8bad 100644 --- a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl +++ b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl @@ -30,7 +30,7 @@ > - + diff --git a/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl b/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl index 2cc22003..df6c8692 100644 --- a/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl +++ b/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl @@ -23,7 +23,7 @@ > - + diff --git a/web/WEB-INF/templates/base.tpl b/web/WEB-INF/templates/base.tpl index 3c397ae5..a9da0c56 100644 --- a/web/WEB-INF/templates/base.tpl +++ b/web/WEB-INF/templates/base.tpl @@ -39,33 +39,37 @@ - - -

- - - - - -

- + + + +

+ + + + + +

+
+ + + + +
+
- - + - + - - - - + + @@ -85,29 +89,31 @@ - -
- - -
- -
- - -
- -
- -
-
+ + +
+ + +
+ +
+ + +
+ +
+ +
+
+
diff --git a/web/WEB-INF/templates/widgets/locale_change_widget.tpl b/web/WEB-INF/templates/widgets/locale_change_widget.tpl index e714b82d..5e75c095 100644 --- a/web/WEB-INF/templates/widgets/locale_change_widget.tpl +++ b/web/WEB-INF/templates/widgets/locale_change_widget.tpl @@ -7,15 +7,18 @@ xmlns:p="http://primefaces.org/ui"> - - - + + + + - + - - + + + + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml index ea67a16d..1d3610d0 100644 --- a/web/WEB-INF/web.xml +++ b/web/WEB-INF/web.xml @@ -22,11 +22,6 @@ javax.faces.FACELETS_REFRESH_PERIOD -1 - - State saving method - javax.faces.STATE_SAVING_METHOD - client - Development mode for WELD, keep disabled unless really needed. Currently it messes up the website. org.jboss.weld.development