*/
package org.mxchange.jfinancials.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.jfinancials.beans.BaseFinancialsBean;
import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
* <p>
* @author Roland Häder<roland@mxchange.org>
*/
-@Named ("basicCompanyDataController")
+@Named ("basicDataController")
@RequestScoped
public class FinancialsBasicDataWebRequestBean extends BaseFinancialsBean implements FinancialsBasicDataWebRequestController {
@EJB (lookup = "java:global/jfinancials-ejb/adminBasicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.AdminBasicCompanyDataSessionBeanRemote", description = "A stateless session bean for administrative purposes.")
private AdminBasicCompanyDataSessionBeanRemote adminBasicCompanyDataBean;
- /**
- * List of all basic company data
- */
- private final List<BasicData> allBasicData;
-
- /**
- * A list of all registered companies (globally)
- */
- @Inject
- @NamedCache (cacheName = "basicDataCache")
- private Cache<Long, BasicData> basicDataCache;
-
- /**
- * EJB for general basic business data purposes
- */
- @EJB (lookup = "java:global/jfinancials-ejb/basicCompanyData!org.mxchange.jcontactsbusiness.model.basicdata.BasicCompanyDataSessionBeanRemote", description = "A stateless session bean for general purposes.")
- private BasicCompanyDataSessionBeanRemote businessDataBean;
-
/**
* Comments for this company
*/
*/
private Long faxNumber;
- /**
- * List of filtered basic company data
- */
- private List<BasicData> filteredBasicCompanyData;
-
/**
* Area code for land-line number
*/
public FinancialsBasicDataWebRequestBean () {
// Call super constructor
super();
-
- // Init list
- this.allBasicData = new LinkedList<>();
- }
-
- /**
- * Observers events being fired when an administrator has added company
- * basic data.
- * <p>
- * @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
- * <p>
- * @return A list of all business contacts
- */
- @SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<BasicData> 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;
}
/**
this.faxNumber = faxNumber;
}
- /**
- * Getter for filtered basic company data
- * <p>
- * @return Filtered basic company data
- */
- @SuppressWarnings ("ReturnOfCollectionOrArrayField")
- public List<BasicData> getFilteredBasicCompanyData () {
- return this.filteredBasicCompanyData;
- }
-
- /**
- * Setter for filtered basic company data
- * <p>
- * @param filteredBasicCompanyData Filtered basic company data
- */
- @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
- public void setFilteredBasicCompanyData (final List<BasicData> filteredBasicCompanyData) {
- this.filteredBasicCompanyData = filteredBasicCompanyData;
- }
-
/**
* Getter for land-line number's area code
* <p>
this.landLineNumber = landLineNumber;
}
- /**
- * Initializer method
- */
- @PostConstruct
- public void initializeList () {
- // Is cache there?
- if (!this.basicDataCache.iterator().hasNext()) {
- // Get whole list
- final List<BasicData> 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<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();
-
- // Add to list
- this.allBasicData.add(next.getValue());
- }
-
- // Sort list
- this.allBasicData.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;
- }
- });
- }
- }
-
- @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
*/
package org.mxchange.jfinancials.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
*/
public interface FinancialsBasicDataWebRequestController extends Serializable {
- /**
- * Checks if given email address is already registered by other basic
- * company data
- * <p>
- * @param emailAddress Email address
- * <p>
- * @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.
- * <p>
- * @param basicDataId Company basic data id to lookup
- * <p>
- * @return Business contact instance
- * <p>
- * @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
- * <p>
- * @param companyName Company name to check
- * <p>
- * @return Whether the company name exists
- */
- Boolean isCompanyNameUsed (final String companyName);
-
}
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.business.basicdata.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+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.jfinancials.beans.BaseFinancialsBean;
+
+/**
+ * A view-scoped bean for product lists
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@Named ("basicDataListController")
+@ViewScoped
+public class FinancialsBasicDataListWebViewBean extends BaseFinancialsBean implements FinancialsBasicDataListWebViewController {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 34_869_872_672_645L;
+
+ /**
+ * List of all basic company data
+ */
+ private final List<BasicData> allBasicData;
+
+ /**
+ * EJB for general basic business data purposes
+ */
+ @EJB (lookup = "java:global/jfinancials-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<Long, BasicData> basicDataCache;
+
+ /**
+ * List of filtered basic company data
+ */
+ private List<BasicData> filteredBasicData;
+
+ /**
+ * Default constructor
+ */
+ public FinancialsBasicDataListWebViewBean () {
+ // Call super constructor
+ super();
+
+ // Init list
+ this.allBasicData = new LinkedList<>();
+ }
+
+ /**
+ * Observers events being fired when an administrator has added company
+ * basic data.
+ * <p>
+ * @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
+ * <p>
+ * @return A list of all business contacts
+ */
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<BasicData> getAllBasicData () {
+ return this.allBasicData;
+ }
+
+ /**
+ * Getter for filtered basic company data
+ * <p>
+ * @return Filtered basic company data
+ */
+ @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+ public List<BasicData> getFilteredBasicData () {
+ return this.filteredBasicData;
+ }
+
+ /**
+ * Setter for filtered basic company data
+ * <p>
+ * @param filteredBasicData Filtered basic company data
+ */
+ @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+ public void setFilteredBasicData (final List<BasicData> filteredBasicData) {
+ this.filteredBasicData = filteredBasicData;
+ }
+
+ /**
+ * Initializer method
+ */
+ @PostConstruct
+ public void initializeList () {
+ // Is cache there?
+ if (!this.basicDataCache.iterator().hasNext()) {
+ // Get whole list
+ final List<BasicData> 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<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();
+
+ // Add to list
+ this.getAllBasicData().add(next.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;
+ }
+ });
+
+ // 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;
+ }
+
+}
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+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
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsBasicDataListWebViewController extends Serializable {
+
+ /**
+ * Retrieves a single business data entity for given id number or throws a
+ * proper exception if not found.
+ * <p>
+ * @param basicDataId Company basic data id to lookup
+ * <p>
+ * @return Business contact instance
+ * <p>
+ * @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
+ * <p>
+ * @param emailAddress Email address
+ * <p>
+ * @return Whether the email address has been already registered
+ */
+ Boolean isEmailAddressRegistered (final String emailAddress);
+
+ /**
+ * Checks whether given company name already exists
+ * <p>
+ * @param companyName Company name to check
+ * <p>
+ * @return Whether the company name exists
+ */
+ Boolean isCompanyNameUsed (final String companyName);
+
+}
/*
- * Copyright (C) 2017 Roland Haeder<roland@mxchange.org>
+ * 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
import javax.faces.convert.FacesConverter;
import org.mxchange.jcontactsbusiness.exceptions.basicdata.BasicDataNotFoundException;
import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
-import org.mxchange.jfinancials.beans.business.basicdata.FinancialsBasicDataWebRequestBean;
-import org.mxchange.jfinancials.beans.business.basicdata.FinancialsBasicDataWebRequestController;
+import org.mxchange.jfinancials.beans.business.basicdata.list.FinancialsBasicDataListWebViewBean;
+import org.mxchange.jfinancials.beans.business.basicdata.list.FinancialsBasicDataListWebViewController;
/**
* Converter for basic company data id <-> valid basic company data instance
/**
* Basic company data backing bean
*/
- private static FinancialsBasicDataWebRequestController BASIC_DATA_CONTROLLER;
+ private static FinancialsBasicDataListWebViewController BASIC_DATA_LIST_CONTROLLER;
@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
- BASIC_DATA_CONTROLLER = CDI.current().select(FinancialsBasicDataWebRequestBean.class).get();
+ BASIC_DATA_LIST_CONTROLLER = CDI.current().select(FinancialsBasicDataListWebViewBean.class).get();
}
// Is the value null or empty?
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);
--- /dev/null
+/*
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.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
+ * <p>
+ * @author Bauke "BalusC" Scholz<unknown@email.invalid>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@WebFilter (servletNames = {"Faces Servlet"})
+public class FinancialsNoCacheFilter 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!");
+ }
+
+}
import javax.faces.validator.FacesValidator;
import javax.faces.validator.ValidatorException;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-import org.mxchange.jfinancials.beans.business.basicdata.FinancialsBasicDataWebRequestBean;
-import org.mxchange.jfinancials.beans.business.basicdata.FinancialsBasicDataWebRequestController;
+import org.mxchange.jfinancials.beans.business.basicdata.list.FinancialsBasicDataListWebViewBean;
+import org.mxchange.jfinancials.beans.business.basicdata.list.FinancialsBasicDataListWebViewController;
/**
* A validator for basic data company names
/**
* Business basic data backing bean
*/
- private static FinancialsBasicDataWebRequestController BASIC_DATA_CONTROLLER;
+ private static FinancialsBasicDataListWebViewController BASIC_DATA_LIST_CONTROLLER;
/**
* Serial number
@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
- BASIC_DATA_CONTROLLER = CDI.current().select(FinancialsBasicDataWebRequestBean.class).get();
+ BASIC_DATA_LIST_CONTROLLER = CDI.current().select(FinancialsBasicDataListWebViewBean.class).get();
}
// All accepted, required fields
}
// 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)) {
import javax.faces.validator.FacesValidator;
import javax.faces.validator.ValidatorException;
import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-import org.mxchange.jfinancials.beans.business.basicdata.FinancialsBasicDataWebRequestBean;
-import org.mxchange.jfinancials.beans.business.basicdata.FinancialsBasicDataWebRequestController;
+import org.mxchange.jfinancials.beans.business.basicdata.list.FinancialsBasicDataListWebViewBean;
+import org.mxchange.jfinancials.beans.business.basicdata.list.FinancialsBasicDataListWebViewController;
/**
* A validator for basic company data email address validation
/**
* Branch office backing bean
*/
- private static FinancialsBasicDataWebRequestController BASIC_DATA_CONTROLLER;
+ private static FinancialsBasicDataListWebViewController BASIC_DATA_LIST_CONTROLLER;
/**
* Email pattern
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
- BASIC_DATA_CONTROLLER = CDI.current().select(FinancialsBasicDataWebRequestBean.class).get();
+ BASIC_DATA_LIST_CONTROLLER = CDI.current().select(FinancialsBasicDataListWebViewBean.class).get();
}
// 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
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:
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:
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:
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:
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
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:
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:
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:
<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
- xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
- xmlns:pm="http://primefaces.org/mobile">
+ >
<h:form>
- <p:menu>
+ <p:menubar id="menu-bar">
<p:submenu label="#{msg.ADMIN_MENU_MAIN_TITLE}">
<p:menuitem title="#{msg.ADMIN_LINK_INDEX_TITLE}" outcome="admin_index" value="#{msg.ADMIN_LINK_INDEX}" />
</p:submenu>
<p:menuitem title="#{msg.ADMIN_LINK_LIST_MOBILE_PROVIDER_TITLE}" outcome="admin_list_mobile_provider" value="#{msg.ADMIN_LINK_LIST_MOBILE_PROVIDER}" />
</p:submenu>
- <p:submenu label="#{msg.ADMIN_MENU_LOGOUT_TITLE}">
+ <p:submenu label="#{msg.ADMIN_MENU_LOGOUT_TITLE}" style="float: right">
<p:menuitem title="#{msg.ADMIN_LINK_LOGOUT_TITLE}" outcome="admin_logout" value="#{msg.ADMIN_LINK_LOGOUT}" />
<p:menuitem title="#{msg.ADMIN_LINK_TO_WEBPAGE_TITLE}" outcome="index" value="#{msg.ADMIN_LINK_TO_WEBPAGE}" />
</p:submenu>
- </p:menu>
+ </p:menubar>
+
+ <p:sticky target="menu-bar" />
</h:form>
</ui:composition>
>
<f:converter converterId="BasicCompanyDataConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectOneMenu>
<p:outputLabel for="branchContactEmployee" value="#{msg.ADMIN_ASSIGN_BRANCH_OFFICE_CONTACT_EMPLOYEE}" />
>
<f:converter converterId="BasicCompanyDataConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectOneMenu>
<p:outputLabel for="departmentBranchOffice" value="#{msg.ADMIN_ASSIGN_DEPARTMENT_BRANCH_OFFICE}" />
>
<f:converter converterId="BasicCompanyDataConverter" />
<f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
- <f:selectItems value="#{basicCompanyDataController.allBasicData()}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
+ <f:selectItems value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" itemLabel="#{basicData.companyName}" />
</p:selectOneMenu>
<p:outputLabel for="employeeBranchOffice" value="#{msg.ADMIN_ASSIGN_EMPLOYEE_BRANCH_OFFICE}" />
<pm:page id="master">
<h:panelGroup styleClass="ui-fluid" layout="block">
<pm:header>
- <h:panelGroup layout="block">
- <h:panelGroup styleClass="page-header" layout="block">
- <h1>
- <h:outputText value="#{initParam['project_title']} - " />
-
- <ui:insert name="content_header">
- <h:outputText value="Default header title" />
- </ui:insert>
- </h1>
- </h:panelGroup>
+ <h:panelGroup styleClass="page-header" layout="block">
+ <p:outputPanel styleClass="ui-g">
+ <p:outputPanel styleClass="ui-g-12 ui-md-9 ui-g-nopad">
+ <h1>
+ <h:outputText value="#{initParam['project_title']} - " />
+
+ <ui:insert name="content_header">
+ <h:outputText value="Default header title" />
+ </ui:insert>
+ </h1>
+ </p:outputPanel>
+
+ <p:outputPanel styleClass="ui-g-12 ui-md-3">
+ <ui:include src="/WEB-INF/templates/widgets/locale_change_widget.tpl" />
+ </p:outputPanel>
+ </p:outputPanel>
+ </h:panelGroup>
- <h:panelGroup styleClass="page-content-gap" layout="block">
- </h:panelGroup>
+ <h:panelGroup styleClass="page-content-gap" layout="block">
</h:panelGroup>
</pm:header>
<h:panelGroup styleClass="ui-g" layout="block">
- <h:panelGroup styleClass="ui-g-12 ui-md-2" layout="block">
+ <h:panelGroup styleClass="ui-g-12 ui-md-12" layout="block">
<ui:insert name="menu">
<h:outputText value="Default menu" />
</ui:insert>
-
- <ui:include src="/WEB-INF/templates/widgets/locale_change_widget.tpl" />
</h:panelGroup>
- <h:panelGroup styleClass="ui-g-12 ui-md-10 ui-g-nopad" layout="block">
- <h:panelGroup styleClass="ui-g-12 ui-g-nopad">
+ <h:panelGroup styleClass="ui-g-12 ui-md-12 ui-g-nopad" layout="block">
+ <h:panelGroup styleClass="ui-g-12">
<ui:insert name="content">
<h:outputText value="Default content" />
</ui:insert>
</p:growl>
<p:ajaxExceptionHandler
- type="javax.faces.application.ViewExpiredException"
+ type="java.lang.Throwable"
update="exceptionDialog"
- onexception="PF('exceptionDialog').show();"
+ onexception="PF('master:exception-dialog-form:exceptionDialog').show();"
/>
- <p:dialog id="exceptionDialog" closable="true" closeOnEscape="true" header="Exception '#{pfExceptionHandler.type}' occured!" widgetVar="exceptionDialog"
- height="500px">
- <div class="para">
- <h:outputText value="#{msg.EXCEPTION_MESSAGE}:" />
- <h:outputText value="#{pfExceptionHandler.message}" />
- </div>
-
- <div class="para">
- <h:outputText value="#{msg.EXCEPTION_STACK_TRACE}:" />
- <h:outputText value="#{pfExceptionHandler.formattedStackTrace}" escape="false" />
- </div>
-
- <div class="para">
- <p:button onclick="window.location.href = document.location.href;"
- value="#{msg.RELOAD_PAGE}"
- rendered="#{pfExceptionHandler.type == 'javax.faces.application.ViewExpiredException'}" />
- </div>
- </p:dialog>
+ <h:form id="exception-dialog-form">
+ <p:dialog id="exceptionDialog" closable="true" closeOnEscape="true" header="Exception '#{pfExceptionHandler.type}' occured!" widgetVar="exceptionDialog"
+ height="500px">
+ <div class="para">
+ <h:outputText value="#{msg.EXCEPTION_MESSAGE}:" />
+ <h:outputText value="#{pfExceptionHandler.message}" />
+ </div>
+
+ <div class="para">
+ <h:outputText value="#{msg.EXCEPTION_STACK_TRACE}:" />
+ <h:outputText value="#{pfExceptionHandler.formattedStackTrace}" escape="false" />
+ </div>
+
+ <div class="para">
+ <p:button onclick="window.location.href = document.location.href;"
+ value="#{msg.RELOAD_PAGE}"
+ rendered="#{pfExceptionHandler.type == 'javax.faces.application.ViewExpiredException'}" />
+ </div>
+ </p:dialog>
+ </h:form>
</h:panelGroup>
</h:panelGroup>
</pm:page>
xmlns:p="http://primefaces.org/ui">
<h:form id="form-change-locale">
- <p:panelGrid columns="2" layout="grid">
- <h:panelGroup layout="block">
- <p:selectOneMenu value="#{localizationController.localeCode}" onchange="$('#form-change-locale').submit()">
+ <p:outputPanel styleClass="ui-g">
+ <p:outputPanel styleClass="ui-g-12 ui-md-6">
+ <p:selectOneMenu value="#{localizationController.localeCode}">
+ <p:ajax update="master" />
<f:selectItem itemLabel="#{msg.SELECT_LANGUAGE}" noSelectionOption="true" itemDisabled="true" />
<f:selectItems value="#{localizationController.supportedLocales}" var="locale" itemValue="#{locale}" itemLabel="#{msg[locale.toString().toUpperCase()]}" />
</p:selectOneMenu>
- </h:panelGroup>
+ </p:outputPanel>
- <p:commandButton styleClass="submit" type="submit" actionListener="#{localizationController.doChangeLocale()}" value="#{msg.BUTTON_CHANGE_LOCALE}" title="#{msg.BUTTON_CHANGE_LOCALE_TITLE}" />
- </p:panelGrid>
+ <p:outputPanel styleClass="ui-g-12 ui-md-6">
+ <p:commandButton styleClass="submit" type="submit" actionListener="#{localizationController.doChangeLocale()}" value="#{msg.BUTTON_CHANGE_LOCALE}" title="#{msg.BUTTON_CHANGE_LOCALE_TITLE}" />
+ </p:outputPanel>
+ </p:outputPanel>
</h:form>
</ui:composition>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>-1</param-value>
</context-param>
- <context-param>
- <description>State saving method</description>
- <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
- <param-value>client</param-value>
- </context-param>
<context-param>
<description>Development mode for WELD, keep disabled unless really needed. Currently it messes up the website.</description>
<param-name>org.jboss.weld.development</param-name>