From 7b33d87873e1cb16fb40fd7b87daab0ed572a952 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 2 Sep 2017 21:52:41 +0200 Subject: [PATCH] Please rename/cherry-pick: - having to much session-scoped beans was a bad design idea anyway - on each new session, "tons" of EJB (JNDI lookup + business method invocation) will occur which will overrun the EJB container soon or later - also having JNDI lookup in PostConstruct-annotated methods was bad, too because it "confuses" the web container - while it is building proxy objects arround every managed class (like also now converters, JSF 2.3.x only) especially backing beans, there should be no JNDI lookup hapening - but initializing some lists for performance reasons is the right thing to do - maybe later some other annotation will be used instead, but for now it is fine - so let's make this painless and rename all session-scoped backing beans and re-annotate them with RequestScoped for now as this is also reduces memory foot-print MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- ...FinancialsBusinessDataWebRequestBean.java} | 79 +++++++-- ...ialsBusinessDataWebRequestController.java} | 2 +- ...nancialsCompanyEmployeeWebRequestBean.java | 52 ++++-- ...sCompanyEmployeeWebRequestController.java} | 2 +- .../FinancialsAdminContactWebRequestBean.java | 2 +- ...a => FinancialsContactWebRequestBean.java} | 98 +++++++---- ...inancialsContactWebRequestController.java} | 2 +- ...FinancialsContactPhoneWebRequestBean.java} | 47 +++--- ...ialsContactPhoneWebRequestController.java} | 2 +- .../FinancialsAdminCountryWebRequestBean.java | 2 +- ...a => FinancialsCountryWebRequestBean.java} | 54 ++++-- ...inancialsCountryWebRequestController.java} | 2 +- ...a => FinancialsReceiptWebRequestBean.java} | 8 +- ...inancialsReceiptWebRequestController.java} | 2 +- .../FinancialsWebRequestHelperBean.java | 4 +- ...inancialsMobileProviderWebRequestBean.java | 51 +++++- .../FinancialsAdminPhoneWebRequestBean.java | 2 +- ...ava => FinancialsPhoneWebRequestBean.java} | 131 ++++++++++++--- ... FinancialsPhoneWebRequestController.java} | 2 +- .../FinancialsUserProfileWebRequestBean.java | 4 +- .../FinancialsAdminUserWebRequestBean.java | 10 +- ...java => FinancialsUserWebRequestBean.java} | 154 ++++++++---------- ...> FinancialsUserWebRequestController.java} | 17 +- ...FinancialsUserActivityWebRequestBean.java} | 37 +++-- ...ialsUserActivityWebRequestController.java} | 2 +- ...ancialsConfirmationLinkWebRequestBean.java | 4 +- ... FinancialsEmailChangeWebRequestBean.java} | 43 +++-- ...cialsEmailChangeWebRequestController.java} | 2 +- .../FinancialsUserLoginWebSessionBean.java | 4 +- ...FinancialsUserRegisterWebRequestBean.java} | 20 +-- ...ialsUserRegisterWebRequestController.java} | 2 +- ...> FinancialsResendLinkWebRequestBean.java} | 12 +- ...ncialsResendLinkWebRequestController.java} | 2 +- .../FinancialsMobileProviderConverter.java | 2 +- web/guest/user/user_list.xhtml | 34 ++-- 35 files changed, 568 insertions(+), 325 deletions(-) rename src/java/org/mxchange/jfinancials/beans/business/basicdata/{FinancialsBusinessDataWebSessionBean.java => FinancialsBusinessDataWebRequestBean.java} (81%) rename src/java/org/mxchange/jfinancials/beans/business/basicdata/{FinancialsBusinessDataWebSessionController.java => FinancialsBusinessDataWebRequestController.java} (93%) rename src/java/org/mxchange/jfinancials/beans/business/employee/{FinancialsCompanyEmployeeWebSessionController.java => FinancialsCompanyEmployeeWebRequestController.java} (93%) rename src/java/org/mxchange/jfinancials/beans/contact/{FinancialsContactWebSessionBean.java => FinancialsContactWebRequestBean.java} (93%) rename src/java/org/mxchange/jfinancials/beans/contact/{FinancialsContactWebSessionController.java => FinancialsContactWebRequestController.java} (97%) rename src/java/org/mxchange/jfinancials/beans/contact/phone/{FinancialsContactPhoneWebSessionBean.java => FinancialsContactPhoneWebRequestBean.java} (93%) rename src/java/org/mxchange/jfinancials/beans/contact/phone/{FinancialsContactPhoneWebSessionController.java => FinancialsContactPhoneWebRequestController.java} (93%) rename src/java/org/mxchange/jfinancials/beans/country/{FinancialsCountryWebApplicationBean.java => FinancialsCountryWebRequestBean.java} (67%) rename src/java/org/mxchange/jfinancials/beans/country/{FinancialsCountryWebApplicationController.java => FinancialsCountryWebRequestController.java} (92%) rename src/java/org/mxchange/jfinancials/beans/financial/receipt/{FinancialsReceiptWebSessionBean.java => FinancialsReceiptWebRequestBean.java} (97%) rename src/java/org/mxchange/jfinancials/beans/financial/receipt/{FinancialsReceiptWebSessionController.java => FinancialsReceiptWebRequestController.java} (93%) rename src/java/org/mxchange/jfinancials/beans/phone/{FinancialsPhoneWebApplicationBean.java => FinancialsPhoneWebRequestBean.java} (87%) rename src/java/org/mxchange/jfinancials/beans/phone/{FinancialsPhoneWebApplicationController.java => FinancialsPhoneWebRequestController.java} (96%) rename src/java/org/mxchange/jfinancials/beans/user/{FinancialsUserWebSessionBean.java => FinancialsUserWebRequestBean.java} (91%) rename src/java/org/mxchange/jfinancials/beans/user/{FinancialsUserWebSessionController.java => FinancialsUserWebRequestController.java} (91%) rename src/java/org/mxchange/jfinancials/beans/user/activity/{FinancialsUserActivityWebApplicationBean.java => FinancialsUserActivityWebRequestBean.java} (95%) rename src/java/org/mxchange/jfinancials/beans/user/activity/{FinancialsUserActivityWebApplicationController.java => FinancialsUserActivityWebRequestController.java} (91%) rename src/java/org/mxchange/jfinancials/beans/user/email_address/{FinancialsEmailChangeWebSessionBean.java => FinancialsEmailChangeWebRequestBean.java} (89%) rename src/java/org/mxchange/jfinancials/beans/user/email_address/{FinancialsEmailChangeWebSessionController.java => FinancialsEmailChangeWebRequestController.java} (94%) rename src/java/org/mxchange/jfinancials/beans/user/register/{FinancialsUserRegisterWebSessionBean.java => FinancialsUserRegisterWebRequestBean.java} (95%) rename src/java/org/mxchange/jfinancials/beans/user/register/{FinancialsUserRegisterWebSessionController.java => FinancialsUserRegisterWebRequestController.java} (93%) rename src/java/org/mxchange/jfinancials/beans/user/resendlink/{FinancialsResendLinkWebSessionBean.java => FinancialsResendLinkWebRequestBean.java} (94%) rename src/java/org/mxchange/jfinancials/beans/user/resendlink/{FinancialsResendLinkWebSessionController.java => FinancialsResendLinkWebRequestController.java} (93%) diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebRequestBean.java similarity index 81% rename from src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebRequestBean.java index f0505ce9..ea14c631 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebRequestBean.java @@ -17,11 +17,13 @@ package org.mxchange.jfinancials.beans.business.basicdata; 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.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Named; @@ -29,6 +31,7 @@ import org.mxchange.jcontactsbusiness.basicdata.AdminBusinessDataSessionBeanRemo import org.mxchange.jcontactsbusiness.basicdata.BusinessBasicData; import org.mxchange.jcontactsbusiness.basicdata.BusinessDataSessionBeanRemote; import org.mxchange.jcontactsbusiness.events.basicdata.added.ObservableAdminAddedBusinessBasicDataEvent; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jcountry.data.Country; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; @@ -39,8 +42,8 @@ import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionCo * @author Roland Häder */ @Named ("companyDataController") -@SessionScoped -public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsController implements FinancialsBusinessDataWebSessionController { +@RequestScoped +public class FinancialsBusinessDataWebRequestBean extends BaseFinancialsController implements FinancialsBusinessDataWebRequestController { /** * Serial number @@ -56,7 +59,9 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll /** * A list of all registered companies (globally) */ - private final List businessContacts; + @Inject + @Cached (cacheName = "basicDataCache") + private transient Cache basicDataCache; /** * EJB for general basic business data purposes @@ -75,7 +80,7 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll private String companyEmailAddress; /** - * Company name + * Company cacheName */ private String companyName; @@ -118,12 +123,9 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll /** * Constructor */ - public FinancialsBusinessDataWebSessionBean () { + public FinancialsBusinessDataWebRequestBean () { // Call super constructor super(); - - // Init list - this.businessContacts = new LinkedList<>(); } /** @@ -155,7 +157,7 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll } // Add it to list - this.businessContacts.add(event.getBasicData()); + this.basicDataCache.put(event.getBasicData().getCompanyDataId(), event.getBasicData()); } /** @@ -165,8 +167,23 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll */ @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allCompanyBasicData () { + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.basicDataCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + // Return it - return this.businessContacts; + return list; } /** @@ -206,18 +223,18 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll } /** - * Getter for company name + * Getter for company cacheName *

- * @return Company name + * @return Company cacheName */ public String getCompanyName () { return this.companyName; } /** - * Setter for company name + * Setter for company cacheName *

- * @param companyName Company name + * @param companyName Company cacheName */ public void setCompanyName (final String companyName) { this.companyName = companyName; @@ -336,8 +353,36 @@ public class FinancialsBusinessDataWebSessionBean extends BaseFinancialsControll */ @PostConstruct public void initializeList () { - // Init user's contact list - this.businessContacts.addAll(this.adminBusinessDataBean.allCompanyBasicData()); + // Is cache there? + if (!this.basicDataCache.iterator().hasNext()) { + // Get whole list + List list = this.businessDataBean.allCompanyBasicData(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final BusinessBasicData next = iterator.next(); + + // Add it to cache + this.basicDataCache.put(next.getCompanyDataId(), next); + } + } + } + + /** + * Clears this bean + */ + private void clear () { + // Clear all data: + this.setCompanyComments(null); + this.setCompanyEmailAddress(null); + this.setCompanyName(null); + this.setFaxAreaCode(null); + this.setFaxCountry(null); + this.setFaxNumber(null); + this.setLandLineAreaCode(null); + this.setLandLineCountry(null); + this.setLandLineNumber(null); } } diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebRequestController.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebRequestController.java index 60b1397b..990aa91f 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBusinessDataWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsBusinessDataWebSessionController extends Serializable { +public interface FinancialsBusinessDataWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestBean.java index 8d8307a2..9b00752d 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestBean.java @@ -16,14 +16,18 @@ */ package org.mxchange.jfinancials.beans.business.employee; +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.SessionScoped; +import javax.enterprise.context.RequestScoped; +import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jcontactsbusiness.employee.CompanyEmployeeSessionBeanRemote; import org.mxchange.jcontactsbusiness.employee.Employee; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jfinancials.beans.BaseFinancialsController; /** @@ -32,8 +36,8 @@ import org.mxchange.jfinancials.beans.BaseFinancialsController; * @author Roland Häder */ @Named ("companyEmployeeController") -@SessionScoped -public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsController implements FinancialsCompanyEmployeeWebSessionController { +@RequestScoped +public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsController implements FinancialsCompanyEmployeeWebRequestController { /** * Serial number @@ -49,7 +53,9 @@ public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsContr /** * List of all company employees */ - private final List companyEmployees; + @Inject + @Cached(cacheName = "companyEmployeeCache") + private transient Cache companyEmployeeCache; /** * Default constructor @@ -57,9 +63,6 @@ public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsContr public FinancialsCompanyEmployeeWebRequestBean () { // Call super constructor super(); - - // Init list instance - this.companyEmployees = new LinkedList<>(); } /** @@ -69,7 +72,23 @@ public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsContr */ @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allCompanyEmployees () { - return this.companyEmployees; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.companyEmployeeCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } /** @@ -77,11 +96,20 @@ public class FinancialsCompanyEmployeeWebRequestBean extends BaseFinancialsContr */ @PostConstruct public void init () { - // Get all entries from remote bean - List employees = this.companyEmployeeBean.allCompanyEmployees(); + // Is cache there? + if (!this.companyEmployeeCache.iterator().hasNext()) { + // Get whole list + List list = this.companyEmployeeBean.allCompanyEmployees(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final Employee next = iterator.next(); - // Copy it to main list - this.companyEmployees.addAll(employees); + // Add it to cache + this.companyEmployeeCache.put(next.getEmployeeId(), next); + } + } } } diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestController.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestController.java index 80e14ad1..ef6bd148 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsCompanyEmployeeWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsCompanyEmployeeWebSessionController extends Serializable { +public interface FinancialsCompanyEmployeeWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java index a5f3d1aa..7f5c5400 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java @@ -107,7 +107,7 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsControll * General contact controller */ @Inject - private FinancialsContactWebSessionController contactController; + private FinancialsContactWebRequestController contactController; /** * Country instance diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java index f11749c6..8d47e2b9 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java @@ -24,8 +24,9 @@ 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.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; @@ -37,9 +38,9 @@ import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcontacts.contact.title.PersonalTitle; import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jcountry.data.Country; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.fax.FaxNumber; @@ -55,6 +56,7 @@ import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAc import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; /** * A general contact bean (controller) @@ -62,8 +64,8 @@ import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; * @author Roland Häder */ @Named ("contactController") -@SessionScoped -public class FinancialsContactWebSessionBean extends BaseFinancialsController implements FinancialsContactWebSessionController { +@RequestScoped +public class FinancialsContactWebRequestBean extends BaseFinancialsController implements FinancialsContactWebRequestController { /** * Serial number @@ -99,7 +101,9 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im /** * Contact list */ - private final List contactList; + @Inject + @Cached (cacheName = "contactsCache") + private transient Cache contactsCache; /** * Country instance @@ -114,7 +118,9 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im /** * Email address list */ - private final List emailAddressList; + @Inject + @Cached (cacheName = "emailAddressCache") + private transient Cache emailAddressCache; /** * Email address repeated @@ -215,7 +221,7 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im * Regular user controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Login bean (controller) @@ -231,13 +237,9 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im /** * Default constructor */ - public FinancialsContactWebSessionBean () { + public FinancialsContactWebRequestBean () { // Call super constructor super(); - - // Init lists/maps - this.contactList = new LinkedList<>(); - this.emailAddressList = new LinkedList<>(); } /** @@ -354,7 +356,7 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im this.uniqueAddContact(event.getUpdatedContact()); // Add email address to list - this.emailAddressList.add(event.getUpdatedContact().getContactEmailAddress()); + this.emailAddressCache.put(event.getUpdatedContact().getContactId(), event.getUpdatedContact().getContactEmailAddress()); } /** @@ -447,8 +449,23 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allContacts () { - // Return un-modified list - return this.contactList; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.contactsCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } @Override @@ -1008,20 +1025,31 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im */ @PostConstruct public void init () { - // Get full email address list for reducing EJB calls - this.emailAddressList.addAll(this.contactBean.getEmailAddressList()); - - // Get full contact list - this.contactList.addAll(this.contactBean.getAllContacts()); + // Get all contacts + final List selectable = new LinkedList<>(); + + // Is cache there? + if (!this.contactsCache.iterator().hasNext()) { + // Get whole list + List list = this.contactBean.allContacts(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final Contact next = iterator.next(); + + // Add it to cache + this.contactsCache.put(next.getContactId(), next); + this.emailAddressCache.put(next.getContactId(), next.getContactEmailAddress()); + selectable.add(next); + } + } // Get all users List allUsers = this.userController.allUsers(); - // Get all contacts - List allContacts = this.contactBean.getAllContacts(); - // Get iterator - Iterator iterator = allContacts.iterator(); + Iterator iterator = selectable.iterator(); // Loop through it while (iterator.hasNext()) { @@ -1046,7 +1074,7 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im } // Set contact list - this.selectableContacts = allContacts; + this.selectableContacts = selectable; } @Override @@ -1064,7 +1092,7 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im } // Determine it - return ((this.emailAddressList instanceof List) && (this.emailAddressList.contains(contact.getContactEmailAddress()))); + return ((this.emailAddressCache instanceof List) && (this.emailAddressCache.containsKey(contact.getContactId()))); } @Override @@ -1131,13 +1159,13 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im */ private void addUserNameEmailAddress (final Contact contact) { // Make sure the entry is not added yet - if (this.emailAddressList.contains(contact.getContactEmailAddress())) { + if (this.emailAddressCache.containsKey(contact.getContactId())) { // Already added throw new IllegalArgumentException(MessageFormat.format("Email address {0} already added.", contact.getContactEmailAddress())); //NOI18N } // Add email addres - this.emailAddressList.add(contact.getContactEmailAddress()); + this.emailAddressCache.put(contact.getContactId(), contact.getContactEmailAddress()); } /** @@ -1250,13 +1278,13 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im } // Remove from general list - if (!this.contactList.remove(contact)) { + if (!this.contactsCache.remove(contact.getContactId())) { // Did not remove contact throw new IllegalStateException(MessageFormat.format("contact {0} was not removed.", contact.getContactId())); //NOI18N } // Remove from other lists - this.emailAddressList.remove(contact.getContactEmailAddress()); + this.emailAddressCache.remove(contact.getContactId()); } /** @@ -1279,23 +1307,23 @@ public class FinancialsContactWebSessionBean extends BaseFinancialsController im } // Get iterator from list - Iterator iterator = this.contactList.iterator(); + Iterator> iterator = this.contactsCache.iterator(); // "Walk" through all entries while (iterator.hasNext()) { // Get next element - Contact next = iterator.next(); + Cache.Entry next = iterator.next(); // Is id number the same? - if (Objects.equals(contact.getContactId(), next.getContactId())) { + if (Objects.equals(contact.getContactId(), next.getKey())) { // Found entry, so remove it and abort - this.removeContact(next); + this.removeContact(next.getValue()); break; } } // Add contact to list - this.contactList.add(contact); + this.contactsCache.put(contact.getContactId(), contact); } } diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java similarity index 97% rename from src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java index b345e414..3718a5b8 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java @@ -25,7 +25,7 @@ import org.mxchange.jcontacts.contact.Contact; *

* @author Roland Häder */ -public interface FinancialsContactWebSessionController extends Serializable { +public interface FinancialsContactWebRequestController extends Serializable { /** * Minimum password length diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java index 17ebaa4c..0477ae76 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java @@ -17,12 +17,11 @@ package org.mxchange.jfinancials.beans.contact.phone; import java.text.MessageFormat; -import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map; import java.util.Objects; -import javax.enterprise.context.SessionScoped; +import javax.cache.Cache; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; import javax.inject.Inject; import javax.inject.Named; @@ -32,8 +31,8 @@ import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContac import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent; import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent; import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.contact.FinancialsContactWebSessionController; import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent; import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent; import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent; @@ -42,6 +41,7 @@ import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber; import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber; import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; +import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; /** * A general contact bean (controller) @@ -49,8 +49,8 @@ import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; * @author Roland Häder */ @Named ("contactPhoneController") -@SessionScoped -public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsController implements FinancialsContactPhoneWebSessionController { +@RequestScoped +public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsController implements FinancialsContactPhoneWebRequestController { /** * Serial number @@ -61,14 +61,16 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll * General contact controller */ @Inject - private FinancialsContactWebSessionController contactController; + private FinancialsContactWebRequestController contactController; /** * "Cache" for contact's mobile, land-line and fax numbers. Currently one * per each type is supported. Maybe later this will change into a OneToMany * relationship (one contact, many numbers). */ - private final Map> contacts; + @Inject + @Cached(cacheName = "contactsPhoneCache") + private transient Cache> contactsPhoneCache; /** * fax number @@ -88,12 +90,9 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll /** * Default constructor */ - public FinancialsContactPhoneWebSessionBean () { + public FinancialsContactPhoneWebRequestBean () { // Call super constructor super(); - - // Init lists/maps - this.contacts = new HashMap<>(10); } /** @@ -169,7 +168,7 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll } // Remove it from list - this.contacts.remove(event.getUnlinkedFaxNumber()); + this.contactsPhoneCache.remove(event.getUnlinkedFaxNumber()); // Clear all data this.clear(); @@ -197,7 +196,7 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll } // Remove it from list - this.contacts.remove(event.getUnlinkedLandLineNumber()); + this.contactsPhoneCache.remove(event.getUnlinkedLandLineNumber()); // Clear all data this.clear(); @@ -225,7 +224,7 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll } // Remove it from list - this.contacts.remove(event.getUnlinkedMobileNumber()); + this.contactsPhoneCache.remove(event.getUnlinkedMobileNumber()); // Clear all data this.clear(); @@ -344,9 +343,9 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll DialableFaxNumber number = this.getFaxNumber(); // Is cache there? - if (this.contacts.containsKey(number)) { + if (this.contactsPhoneCache.containsKey(number)) { // Return cached version - return this.contacts.get(number); + return this.contactsPhoneCache.get(number); } else { // Ask bean List list = new LinkedList<>(); @@ -361,7 +360,7 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll } // Store result in cache - this.contacts.put(number, list); + this.contactsPhoneCache.put(number, list); // Return now-cached list return list; @@ -378,9 +377,9 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll DialableLandLineNumber number = this.getLandLineNumber(); // Is cache there? - if (this.contacts.containsKey(number)) { + if (this.contactsPhoneCache.containsKey(number)) { // Return cached version - return this.contacts.get(number); + return this.contactsPhoneCache.get(number); } else { // Ask bean List list = new LinkedList<>(); @@ -395,7 +394,7 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll } // Store result in cache - this.contacts.put(number, list); + this.contactsPhoneCache.put(number, list); // Return now-cached list return list; @@ -412,9 +411,9 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll DialableMobileNumber number = this.getMobileNumber(); // Is cache there? - if (this.contacts.containsKey(number)) { + if (this.contactsPhoneCache.containsKey(number)) { // Return cached version - return this.contacts.get(number); + return this.contactsPhoneCache.get(number); } else { // Ask bean List list = new LinkedList<>(); @@ -429,7 +428,7 @@ public class FinancialsContactPhoneWebSessionBean extends BaseFinancialsControll } // Store result in cache - this.contacts.put(number, list); + this.contactsPhoneCache.put(number, list); // Return now-cached list return list; diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java index 4ba4867c..f8233b31 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsContactPhoneWebSessionController extends Serializable { +public interface FinancialsContactPhoneWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java index a5cbab54..1b736e35 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java @@ -75,7 +75,7 @@ public class FinancialsAdminCountryWebRequestBean extends BaseFinancialsControll * Regular country controller */ @Inject - private FinancialsCountryWebApplicationController countryController; + private FinancialsCountryWebRequestController countryController; /** * Local dial prefix diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationBean.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java similarity index 67% rename from src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationBean.java rename to src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java index 55f9b3be..a5a9ccf8 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationBean.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java @@ -17,12 +17,17 @@ package org.mxchange.jfinancials.beans.country; 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.ApplicationScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; +import javax.inject.Inject; import javax.inject.Named; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jcountry.data.Country; import org.mxchange.jcountry.data.CountrySingletonBeanRemote; import org.mxchange.jcountry.events.ObservableAdminAddedCountryEvent; @@ -34,8 +39,8 @@ import org.mxchange.jfinancials.beans.BaseFinancialsController; * @author Roland Häder */ @Named ("countryController") -@ApplicationScoped -public class FinancialsCountryWebApplicationBean extends BaseFinancialsController implements FinancialsCountryWebApplicationController { +@RequestScoped +public class FinancialsCountryWebRequestBean extends BaseFinancialsController implements FinancialsCountryWebRequestController { /** * Serial number @@ -51,12 +56,14 @@ public class FinancialsCountryWebApplicationBean extends BaseFinancialsControlle /** * List of all countries */ - private List countryList; + @Inject + @Cached (cacheName = "countryCache") + private transient Cache countryCache; /** * Default constructor */ - public FinancialsCountryWebApplicationBean () { + public FinancialsCountryWebRequestBean () { // Call super constructor super(); } @@ -84,14 +91,29 @@ public class FinancialsCountryWebApplicationBean extends BaseFinancialsControlle } // Add the event - this.countryList.add(event.getAddedCountry()); + this.countryCache.put(event.getAddedCountry().getCountryId(), event.getAddedCountry()); } @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allCountries () { - // Return "cached" version - return this.countryList; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.countryCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } /** @@ -99,8 +121,20 @@ public class FinancialsCountryWebApplicationBean extends BaseFinancialsControlle */ @PostConstruct public void init () { - // "Cache" country list as this will not change so often. - this.countryList = this.countryBean.allCountries(); + // Is cache there? + if (!this.countryCache.iterator().hasNext()) { + // Get whole list + List list = this.countryBean.allCountries(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final Country next = iterator.next(); + + // Add it to cache + this.countryCache.put(next.getCountryId(), next); + } + } } } diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationController.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java similarity index 92% rename from src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationController.java rename to src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java index 98737e0d..b4e5960d 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebApplicationController.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java @@ -25,7 +25,7 @@ import org.mxchange.jcountry.data.Country; *

* @author Roland Häder */ -public interface FinancialsCountryWebApplicationController extends Serializable { +public interface FinancialsCountryWebRequestController extends Serializable { /** * A list of all countries diff --git a/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java similarity index 97% rename from src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java index fc9cfba2..2eca75a0 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestBean.java @@ -22,7 +22,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.List; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; @@ -43,8 +43,8 @@ import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; * @author Roland Häder */ @Named ("financialReceiptController") -@SessionScoped -public class FinancialsReceiptWebSessionBean extends BaseFinancialsController implements FinancialsReceiptWebSessionController { +@RequestScoped +public class FinancialsReceiptWebRequestBean extends BaseFinancialsController implements FinancialsReceiptWebRequestController { /** * Serial number @@ -92,7 +92,7 @@ public class FinancialsReceiptWebSessionBean extends BaseFinancialsController im * Constructor */ @SuppressWarnings ("CollectionWithoutInitialCapacity") - public FinancialsReceiptWebSessionBean () { + public FinancialsReceiptWebRequestBean () { // Call super constructor super(); diff --git a/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestController.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestController.java index 957f0125..67416d87 100644 --- a/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/financial/receipt/FinancialsReceiptWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsReceiptWebSessionController extends Serializable { +public interface FinancialsReceiptWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java index 44c9144c..a1d6a378 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java @@ -29,7 +29,6 @@ import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController; import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController; import org.mxchange.jfinancials.beans.user.FinancialsAdminUserWebRequestController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent; import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent; import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent; @@ -42,6 +41,7 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; import org.mxchange.jusercore.events.user.created.CreatedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; import org.mxchange.jusercore.model.user.User; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; /** * A general helper for beans @@ -137,7 +137,7 @@ public class FinancialsWebRequestHelperBean extends BaseFinancialsController imp * Regular user controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Event for when a user instance was created diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java index ee1509be..f4490ca9 100644 --- a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java @@ -17,12 +17,17 @@ package org.mxchange.jfinancials.beans.mobileprovider; 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.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; +import javax.inject.Inject; import javax.inject.Named; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent; import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProvider; @@ -34,7 +39,7 @@ import org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBe * @author Roland Häder */ @Named ("mobileProviderController") -@SessionScoped +@RequestScoped public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsController implements FinancialsMobileProviderWebRequestController { /** @@ -45,13 +50,15 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsContro /** * "Cached" list of mobile providers */ - private List mobileProviders; + @Inject + @Cached (cacheName = "mobileProviderCache") + private transient Cache mobileProviderCache; /** * Remote EJB for mobile providers (regular) */ @EJB (lookup = "java:global/jfinancials-ejb/mobileprovider!org.mxchange.jphone.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote") - private MobileProviderSingletonBeanRemote mobileRemoteBean; + private MobileProviderSingletonBeanRemote mobileProviderBean; /** * Default constructor @@ -84,13 +91,29 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsContro } // Add it to the list - this.mobileProviders.add(event.getAddedMobileProvider()); + this.mobileProviderCache.put(event.getAddedMobileProvider().getProviderId(), event.getAddedMobileProvider()); } @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allMobileProviders () { - return this.mobileProviders; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.mobileProviderCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } /** @@ -98,8 +121,20 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsContro */ @PostConstruct public void init () { - // Init list of mobile providers - this.mobileProviders = this.mobileRemoteBean.allMobileProvider(); + // Is cache there? + if (!this.mobileProviderCache.iterator().hasNext()) { + // Get whole list + List list = this.mobileProviderBean.allMobileProviders(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final MobileProvider next = iterator.next(); + + // Add it to cache + this.mobileProviderCache.put(next.getProviderId(), next); + } + } } } diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java index e99b72fc..fc5a681d 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java @@ -155,7 +155,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsController * Generic hone controller */ @Inject - private FinancialsPhoneWebApplicationController phoneController; + private FinancialsPhoneWebRequestController phoneController; /** * Country (for dial prefix) diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebApplicationBean.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java similarity index 87% rename from src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebApplicationBean.java rename to src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java index 367019af..93ba6314 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebApplicationBean.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java @@ -17,13 +17,16 @@ package org.mxchange.jfinancials.beans.phone; import java.text.MessageFormat; +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.ApplicationScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; +import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent; @@ -31,6 +34,7 @@ import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContac import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent; import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent; import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent; import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent; @@ -50,8 +54,8 @@ import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; * @author Roland Häder */ @Named ("phoneController") -@ApplicationScoped -public class FinancialsPhoneWebApplicationBean extends BaseFinancialsController implements FinancialsPhoneWebApplicationController { +@RequestScoped +public class FinancialsPhoneWebRequestBean extends BaseFinancialsController implements FinancialsPhoneWebRequestController { /** * Serial number @@ -61,17 +65,23 @@ public class FinancialsPhoneWebApplicationBean extends BaseFinancialsController /** * All fax numbers */ - private final List faxNumbers; + @Inject + @Cached(cacheName = "faxNumberCache") + private transient Cache faxNumberCache; /** * All land-line numbers */ - private final List landLineNumbers; + @Inject + @Cached(cacheName = "landLineNumberCache") + private transient Cache landLineNumberCache; /** * All mobile numbers */ - private final List mobileNumbers; + @Inject + @Cached(cacheName = "mobileNumberCache") + private transient Cache mobileNumberCache; /** * General EJB for phone numbers @@ -82,14 +92,9 @@ public class FinancialsPhoneWebApplicationBean extends BaseFinancialsController /** * Default constructor */ - public FinancialsPhoneWebApplicationBean () { + public FinancialsPhoneWebRequestBean () { // Call super constructor super(); - - // Init all lists - this.mobileNumbers = new LinkedList<>(); - this.faxNumbers = new LinkedList<>(); - this.landLineNumbers = new LinkedList<>(); } /** @@ -478,19 +483,67 @@ public class FinancialsPhoneWebApplicationBean extends BaseFinancialsController @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allFaxNumbers () { - return this.faxNumbers; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.faxNumberCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allLandLineNumbers () { - return this.landLineNumbers; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.landLineNumberCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allMobileNumbers () { - return this.mobileNumbers; + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.mobileNumberCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } + + // Return it + return list; } /** @@ -498,10 +551,50 @@ public class FinancialsPhoneWebApplicationBean extends BaseFinancialsController */ @PostConstruct public void init () { - // All phone numbers - this.allMobileNumbers().addAll(this.phoneBean.allMobileNumbers()); - this.allFaxNumbers().addAll(this.phoneBean.allFaxNumbers()); - this.allLandLineNumbers().addAll(this.phoneBean.allLandLineNumbers()); + // Is cache there? + if (!this.faxNumberCache.iterator().hasNext()) { + // Get whole list + List list = this.phoneBean.allFaxNumbers(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final DialableFaxNumber next = iterator.next(); + + // Add it to cache + this.faxNumberCache.put(next.getPhoneId(), next); + } + } + + // Is cache there? + if (!this.landLineNumberCache.iterator().hasNext()) { + // Get whole list + List list = this.phoneBean.allLandLineNumbers(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final DialableLandLineNumber next = iterator.next(); + + // Add it to cache + this.landLineNumberCache.put(next.getPhoneId(), next); + } + } + + // Is cache there? + if (!this.mobileNumberCache.iterator().hasNext()) { + // Get whole list + List list = this.phoneBean.allMobileNumbers(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final DialableMobileNumber next = iterator.next(); + + // Add it to cache + this.mobileNumberCache.put(next.getPhoneId(), next); + } + } } /** diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebApplicationController.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java similarity index 96% rename from src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebApplicationController.java rename to src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java index 57d23609..ce8a50df 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebApplicationController.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java @@ -28,7 +28,7 @@ import org.mxchange.jphone.phonenumbers.mobile.DialableMobileNumber; *

* @author Roland Häder */ -public interface FinancialsPhoneWebApplicationController extends Serializable { +public interface FinancialsPhoneWebRequestController extends Serializable { /** * Returns a list of all mobile numbers. For performance reasons, the diff --git a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java index 6f2820f5..d482c92b 100644 --- a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java @@ -23,11 +23,11 @@ import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; /** * A web request bean for user profiles @@ -47,7 +47,7 @@ public class FinancialsUserProfileWebRequestBean extends BaseFinancialsControlle * User controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Login controller diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java index 0eeeb10c..feccf11e 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java @@ -33,7 +33,6 @@ import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController; -import org.mxchange.jfinancials.beans.contact.FinancialsContactWebSessionController; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; @@ -63,6 +62,7 @@ import org.mxchange.juserlogincore.container.login.UserLoginContainer; import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; import org.mxchange.juserlogincore.exceptions.UserPasswordRepeatMismatchException; import org.mxchange.juserlogincore.login.UserLoginUtils; +import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; /** * A user bean (controller) @@ -106,7 +106,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController * Regular contact controller */ @Inject - private FinancialsContactWebSessionController contactController; + private FinancialsContactWebRequestController contactController; /** * Event being fired when administrator has deleted user @@ -137,7 +137,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController * Regular user controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Delete reason @@ -270,7 +270,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController return ""; //NOI18N } else if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) { // Empty password entered, then generate one - password = UserLoginUtils.createRandomPassword(FinancialsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + password = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); } else if (!this.isSamePasswordEntered()) { // Both passwords don't match throw new FaceletException(new UserPasswordRepeatMismatchException(newUser)); @@ -281,7 +281,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsController // The password should not be null and at least 5 characters long assert (password != null) : "password is null"; //NOI18N - assert (password.length() >= FinancialsUserWebSessionController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N + assert (password.length() >= FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N // Encrypt password and set it newUser.setUserEncryptedPassword(UserLoginUtils.encryptPassword(password)); diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java similarity index 91% rename from src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java index 08d64fd4..bb2c9bc2 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java @@ -18,12 +18,14 @@ package org.mxchange.jfinancials.beans.user; import java.text.MessageFormat; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Objects; import javax.annotation.PostConstruct; +import javax.cache.Cache; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.enterprise.event.Observes; import javax.enterprise.inject.Any; @@ -33,8 +35,8 @@ import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcoreee.events.locale.ObservableLocaleChangeEvent; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.contact.FinancialsContactWebSessionController; import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; @@ -61,6 +63,7 @@ import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredE import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; import org.mxchange.juserlogincore.login.UserLoginUtils; +import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; /** * A user bean (controller) @@ -68,8 +71,8 @@ import org.mxchange.juserlogincore.login.UserLoginUtils; * @author Roland Häder */ @Named ("userController") -@SessionScoped -public class FinancialsUserWebSessionBean extends BaseFinancialsController implements FinancialsUserWebSessionController { +@RequestScoped +public class FinancialsUserWebRequestBean extends BaseFinancialsController implements FinancialsUserWebRequestController { /** * Serial number @@ -80,7 +83,7 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple * General contact controller */ @Inject - private FinancialsContactWebSessionController contactController; + private FinancialsContactWebRequestController contactController; /** * Features controller @@ -120,7 +123,9 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple /** * A list of all user profiles */ - private List userList; + @Inject + @Cached (cacheName = "userCache") + private transient Cache userCache; /** * Login controller (bean) @@ -136,7 +141,9 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple /** * User name list */ - private List userNameList; + @Inject + @Cached (cacheName = "userNameCache") + private transient Cache userNameCache; /** * User password (clear-text from web form) @@ -153,18 +160,10 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple */ private ProfileMode userProfileMode; - /** - * A list of all public user profiles - *

- * @TODO Hmm, makes that sense? Having visible user list in current - * (session-scoped) user's visible user list? - */ - private List visibleUserList; - /** * Default constructor */ - public FinancialsUserWebSessionBean () { + public FinancialsUserWebRequestBean () { // Call super constructor super(); } @@ -438,12 +437,6 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple // Copy all data to this bean this.copyUser(loggedInUser); - - // Is the user visible? - if (Objects.equals(loggedInUser.getUserProfileMode(), ProfileMode.PUBLIC)) { - // Yes, then add user - this.visibleUserList.add(loggedInUser); - } } /** @@ -505,12 +498,6 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple // Add user name this.addUserName(registeredUser); - // Is the account public? - if (Objects.equals(registeredUser.getUserProfileMode(), ProfileMode.PUBLIC)) { - // Also add it to this list - this.visibleUserList.add(registeredUser); - } - // Set user id again this.setUserId(registeredUser.getUserId()); } @@ -569,15 +556,23 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple @Override @SuppressWarnings ("ReturnOfCollectionOrArrayField") public List allUsers () { - // Return it - return this.userList; - } + // Init list + List list = new LinkedList<>(); + + // Get iterator + Iterator> iterator = this.userCache.iterator(); + + // Loop over all + while (iterator.hasNext()) { + // Get next entry + final Cache.Entry next = iterator.next(); + + // Add value to list + list.add(next.getValue()); + } - @Override - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List allVisibleUsers () { // Return it - return this.visibleUserList; + return list; } /** @@ -633,7 +628,7 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple this.setUserProfileMode(ProfileMode.INVISIBLE); // Generate random password - String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); // Set random password this.setUserPassword(randomPassword); @@ -831,19 +826,20 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple */ @PostConstruct public void init () { - // Initialize user list - this.userList = this.userBean.allUsers(); - - // Get full user name list for reducing EJB calls - this.userNameList = this.userBean.getUserNameList(); - - // Is the user logged-in? - if (this.userLoginController.isUserLoggedIn()) { - // Is logged-in, so load also users visible to memebers - this.visibleUserList = this.userBean.allMemberPublicVisibleUsers(); - } else { - // Initialize user list - this.visibleUserList = this.userBean.allPublicUsers(); + // Is cache there? + if (!this.userCache.iterator().hasNext()) { + // Get whole list + List list = this.userBean.allUsers(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final User next = iterator.next(); + + // Add it to cache + this.userCache.put(next.getUserId(), next); + this.userNameCache.put(next.getUserId(), next.getUserName()); + } } } @@ -936,7 +932,7 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple @Override public boolean isUserNameRegistered (final User user) { - return ((this.userNameList instanceof List) && (this.userNameList.contains(user.getUserName()))); + return ((this.userNameCache instanceof List) && (this.userNameCache.containsKey(user.getUserId()))); } @Override @@ -951,11 +947,6 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple return isRequired; } - @Override - public boolean isVisibleUserFound () { - return ((this.visibleUserList instanceof List) && (this.visibleUserList.size() > 0)); - } - @Override public User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException { // Parameter must be valid @@ -971,23 +962,23 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple User user = null; // Try to lookup it in visible user list - for (final Iterator iterator = this.userList.iterator(); iterator.hasNext();) { + for (final Iterator> iterator = this.userCache.iterator(); iterator.hasNext();) { // Get next user - User next = iterator.next(); + Cache.Entry next = iterator.next(); // Contact should be set - if (next.getUserContact() == null) { + if (next.getValue().getUserContact() == null) { // Contact is null - throw new NullPointerException(MessageFormat.format("next.userContact is null for user id {0}", next.getUserId())); //NOI18N - } else if (next.getUserContact().getContactEmailAddress() == null) { + throw new NullPointerException(MessageFormat.format("next.userContact is null for user id {0}", next.getKey())); //NOI18N + } else if (next.getValue().getUserContact().getContactEmailAddress() == null) { // Email address should be set - throw new NullPointerException(MessageFormat.format("next.userContact.contactEmailAddress is null for user id {0}", next.getUserId())); //NOI18N + throw new NullPointerException(MessageFormat.format("next.userContact.contactEmailAddress is null for user id {0}", next.getKey())); //NOI18N } // Is the email address found? - if (Objects.equals(next.getUserContact().getContactEmailAddress(), emailAddress)) { + if (Objects.equals(next.getValue().getUserContact().getContactEmailAddress(), emailAddress)) { // Copy to other variable - user = next; + user = next.getValue(); break; } } @@ -1017,14 +1008,14 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple User user = null; // Try to lookup it in visible user list - for (final Iterator iterator = this.userList.iterator(); iterator.hasNext();) { + for (final Iterator> iterator = this.userCache.iterator(); iterator.hasNext();) { // Get next user - User next = iterator.next(); + Cache.Entry next = iterator.next(); // Is the user id found? - if (Objects.equals(next.getUserId(), userId)) { + if (Objects.equals(next.getKey(), userId)) { // Copy to other variable - user = next; + user = next.getValue(); break; } } @@ -1047,13 +1038,13 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple */ private void addUserName (final User user) { // Make sure the entry is not added yet - if (this.userNameList.contains(user.getUserName())) { + 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.userNameList.add(user.getUserName()); + this.userNameCache.put(user.getUserId(), user.getUserName()); } /** @@ -1146,11 +1137,10 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple } // Remove it from lists - this.userList.remove(user); - this.visibleUserList.remove(user); + this.userCache.remove(user.getUserId()); // Remove name from list - this.userNameList.remove(user.getUserName()); + this.userNameCache.remove(user.getUserId()); } /** @@ -1180,24 +1170,8 @@ public class FinancialsUserWebSessionBean extends BaseFinancialsController imple throw new NullPointerException(MessageFormat.format("user.userContact.contactId={0} is invalid.", user.getUserContact().getContactId())); //NOI18N } - // Get iterator from list - Iterator iterator = this.userList.iterator(); - - // "Walk" through all entries - while (iterator.hasNext()) { - // Get next element - User next = iterator.next(); - - // Is user id number the same? - if (Objects.equals(user.getUserId(), next.getUserId())) { - // Found entry, so remove it and abort - this.userList.remove(next); - break; - } - } - - // Re-add user - this.userList.add(user); + // Add/update user + this.userCache.put(user.getUserId(), user); } } diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java similarity index 91% rename from src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java index b0b9ac81..206d155d 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java @@ -28,7 +28,7 @@ import org.mxchange.jusercore.model.user.User; *

* @author Roland Häder */ -public interface FinancialsUserWebSessionController extends Serializable { +public interface FinancialsUserWebRequestController extends Serializable { /** * Minimum password length @@ -61,13 +61,6 @@ public interface FinancialsUserWebSessionController extends Serializable { */ List allUsers (); - /** - * All public user profiles - *

- * @return A list of all public user profiles - */ - List allVisibleUsers (); - /** * Checks whether the given contact is a user *

@@ -77,14 +70,6 @@ public interface FinancialsUserWebSessionController extends Serializable { */ boolean isContactFound (final Contact contact); - /** - * Checks whether a public user account is registered. This means that at - * least one user profile has its flag "public user profile" enabled. - *

- * @return Whether at least one user has a public profile - */ - boolean isVisibleUserFound (); - /** * Checks whether given user instance's name is used *

diff --git a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebApplicationBean.java b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java similarity index 95% rename from src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebApplicationBean.java rename to src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java index 9a2a1198..e699cf6e 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebApplicationBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java @@ -19,15 +19,16 @@ package org.mxchange.jfinancials.beans.user.activity; import java.text.MessageFormat; import java.util.Collections; import java.util.GregorianCalendar; -import java.util.LinkedHashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map; import javax.annotation.PostConstruct; +import javax.cache.Cache; import javax.ejb.EJB; -import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Observes; +import javax.inject.Inject; import javax.inject.Named; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; @@ -55,8 +56,8 @@ import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdated * @author Roland Häder */ @Named ("userActivityController") -@ApplicationScoped -public class FinancialsUserActivityWebApplicationBean extends BaseFinancialsController implements FinancialsUserActivityWebApplicationController { +@RequestScoped +public class FinancialsUserActivityWebRequestBean extends BaseFinancialsController implements FinancialsUserActivityWebRequestController { /** * Serial number @@ -77,15 +78,17 @@ public class FinancialsUserActivityWebApplicationBean extends BaseFinancialsCont /** * "Cache" for activity log per user */ - private final Map> usersActivity; + @Inject + @Cached(cacheName = "usersActivityCache") + private transient Cache> usersActivityCache; /** * Default constructor */ @SuppressWarnings ("CollectionWithoutInitialCapacity") - public FinancialsUserActivityWebApplicationBean () { - // Init cache - this.usersActivity = new LinkedHashMap<>(); + public FinancialsUserActivityWebRequestBean () { + // Call super constructor + super(); } /** @@ -505,9 +508,9 @@ public class FinancialsUserActivityWebApplicationBean extends BaseFinancialsCont List list = new LinkedList<>(); // Is the user set? - if (this.usersActivity.containsKey(this.getUser())) { + if (this.usersActivityCache.containsKey(this.getUser())) { // Return it - list.addAll(this.usersActivity.get(this.getUser())); + list.addAll(this.usersActivityCache.get(this.getUser())); // Sort list and reverse it Collections.sort(list, new UserActivityLogTimestampComparator()); @@ -547,13 +550,13 @@ public class FinancialsUserActivityWebApplicationBean extends BaseFinancialsCont // Put all in map, per-user for (final LogableUserActivity userActivity : list) { // Is the list there? - if (!this.usersActivity.containsKey(userActivity.getActivityUser())) { + if (!this.usersActivityCache.containsKey(userActivity.getActivityUser())) { // Init list - this.usersActivity.put(userActivity.getActivityUser(), new LinkedList()); + this.usersActivityCache.put(userActivity.getActivityUser(), new LinkedList()); } // Add by user instance - boolean added = this.usersActivity.get(userActivity.getActivityUser()).add(userActivity); + boolean added = this.usersActivityCache.get(userActivity.getActivityUser()).add(userActivity); // Should be added assert (added) : "Activity log not added"; //NOI18N @@ -662,13 +665,13 @@ public class FinancialsUserActivityWebApplicationBean extends BaseFinancialsCont } // Is it there? - if (!this.usersActivity.containsKey(userActivity.getActivityUser())) { + if (!this.usersActivityCache.containsKey(userActivity.getActivityUser())) { // Init it - this.usersActivity.put(userActivity.getActivityUser(), new LinkedList()); + this.usersActivityCache.put(userActivity.getActivityUser(), new LinkedList()); } // Add activity to log - this.usersActivity.get(userActivity.getActivityUser()).add(userActivity); + this.usersActivityCache.get(userActivity.getActivityUser()).add(userActivity); } } diff --git a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebApplicationController.java b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java similarity index 91% rename from src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebApplicationController.java rename to src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java index 802c11a8..a6ea444b 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebApplicationController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsUserActivityWebApplicationController extends Serializable { +public interface FinancialsUserActivityWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java index bcbe7486..1c73afdc 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java @@ -31,7 +31,6 @@ import org.mxchange.jcoreee.events.helper.clear.HelperCleanupEvent; import org.mxchange.jcoreee.events.helper.clear.ObservableHelperCleanupEvent; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; import org.mxchange.jusercore.events.user.created.CreatedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; @@ -41,6 +40,7 @@ import org.mxchange.jusercore.model.user.UserSessionBeanRemote; import org.mxchange.jusercore.model.user.status.UserAccountStatus; import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; import org.mxchange.juserlogincore.events.confirmation.UserConfirmedAccountEvent; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; /** * A web request bean for confirmation link handling @@ -85,7 +85,7 @@ public class FinancialsConfirmationLinkWebRequestBean extends BaseFinancialsCont * User controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Event for when a user instance was created diff --git a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java similarity index 89% rename from src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java index 044ccb3f..d3862692 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java @@ -17,15 +17,18 @@ package org.mxchange.jfinancials.beans.user.email_address; import java.text.MessageFormat; +import java.util.Iterator; import java.util.List; import java.util.Objects; import javax.annotation.PostConstruct; +import javax.cache.Cache; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jcontacts.contact.Contact; +import org.mxchange.jcoreee.jcache.Cached; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; @@ -42,8 +45,8 @@ import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException; * @author Roland Häder */ @Named ("userEmailChangeController") -@SessionScoped -public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsController implements FinancialsEmailChangeWebSessionController { +@RequestScoped +public class FinancialsEmailChangeWebRequestBean extends BaseFinancialsController implements FinancialsEmailChangeWebRequestController { /** * Serial number @@ -60,11 +63,6 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle */ private String emailAddressRepeat; - /** - * Local list of already queued email addresses - */ - private List emailAddresses; - /** * Remote email change bean */ @@ -77,6 +75,13 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle @Inject private FinancialsFeaturesWebApplicationController featureController; + /** + * Local list of already queued email addresses + */ + @Inject + @Cached (cacheName = "queuedEmailCache") + private transient Cache queuedEmailCache; + /** * Login controller (bean) */ @@ -86,7 +91,7 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle /** * Default constructor */ - public FinancialsEmailChangeWebSessionBean () { + public FinancialsEmailChangeWebRequestBean () { // Call super constructor super(); } @@ -196,8 +201,20 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle */ @PostConstruct public void init () { - // Init list - this.emailAddresses = this.emailChangeBean.allQueuedAddresses(); + // Is cache there? + if (!this.queuedEmailCache.iterator().hasNext()) { + // Get whole list + List list = this.emailChangeBean.allQueuedAddresses(); + + // Add all + for (final Iterator iterator = list.iterator(); iterator.hasNext();) { + // Get next element + final String next = iterator.next(); + + // Add it to cache + this.queuedEmailCache.put(next, Boolean.TRUE); + } + } } @Override @@ -230,7 +247,7 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle assert (!emailAddress.trim().isEmpty()) : "emailAddress should not be empty"; //NOI18N // Check list - if (this.emailAddresses.contains(emailAddress)) { + if (this.queuedEmailCache.containsKey(emailAddress)) { // Okay, found it return true; } @@ -241,7 +258,7 @@ public class FinancialsEmailChangeWebSessionBean extends BaseFinancialsControlle // Is it there? if (isQueued) { // Add to list - this.emailAddresses.add(emailAddress); + this.queuedEmailCache.put(emailAddress, Boolean.TRUE); } // Return status diff --git a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java similarity index 94% rename from src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java index 17c3d1e6..c4522401 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java @@ -23,7 +23,7 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsEmailChangeWebSessionController extends Serializable { +public interface FinancialsEmailChangeWebRequestController extends Serializable { /** * Checks whether all required are set for changing email address diff --git a/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java index 622c071f..491d3594 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java @@ -29,7 +29,7 @@ import javax.faces.context.FacesContext; import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusLockedException; import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException; @@ -88,7 +88,7 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsController * User controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Current password diff --git a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java similarity index 95% rename from src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java index 030fc107..bc494e79 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java @@ -17,7 +17,7 @@ package org.mxchange.jfinancials.beans.user.register; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.enterprise.inject.Any; import javax.faces.view.facelets.FaceletException; @@ -27,10 +27,8 @@ import org.mxchange.jcontacts.contact.Contact; import org.mxchange.jcontacts.contact.UserContact; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsController; -import org.mxchange.jfinancials.beans.contact.FinancialsContactWebSessionController; import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; import org.mxchange.jfinancials.beans.user.FinancialsAdminUserWebRequestController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; import org.mxchange.jusercore.events.user.clear.password.ClearUserPasswordEvent; import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent; import org.mxchange.jusercore.events.user.clear.username.ClearUserNameEvent; @@ -48,6 +46,8 @@ import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdated import org.mxchange.juserlogincore.events.user.password_change.UpdatedUserPasswordEvent; import org.mxchange.juserlogincore.login.UserLoginUtils; import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBeanRemote; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; /** * A web bean for user registration @@ -55,8 +55,8 @@ import org.mxchange.juserlogincore.model.user.register.UserRegistrationSessionBe * @author Roland Häder */ @Named ("userRegistrationController") -@SessionScoped -public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsController implements FinancialsUserRegisterWebSessionController { +@RequestScoped +public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsController implements FinancialsUserRegisterWebRequestController { /** * Serial number @@ -87,7 +87,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll * Contact controller */ @Inject - private FinancialsContactWebSessionController contactController; + private FinancialsContactWebRequestController contactController; /** * Features controller @@ -105,7 +105,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll * User controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * An event being fired when a user password was changed @@ -124,7 +124,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll /** * Default constructor */ - public FinancialsUserRegisterWebSessionBean () { + public FinancialsUserRegisterWebRequestBean () { // Call super constructor super(); } @@ -197,7 +197,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll throw new FaceletException(new DataRepeatMismatchException("Passwords not matching.")); //NOI18N } else if (this.userController.ifBothPasswordsEmptyAllowed()) { // Both passwords are left empty and is allowed, then generate a random password - randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); // Generate (ignored) password-history PasswordHistory passwordHistory = new UserPasswordHistory(randomPassword, user); @@ -294,7 +294,7 @@ public class FinancialsUserRegisterWebSessionBean extends BaseFinancialsControll return ""; //NOI18N } else if (this.userController.ifBothPasswordsEmptyAllowed()) { // Both passwords are left empty and is allowed, then generate a random password - String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebSessionController.MINIMUM_PASSWORD_LENGTH); + String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); // Generate (ignored) password-history PasswordHistory passwordHistory = new UserPasswordHistory(randomPassword, user); diff --git a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java index 6d20c7aa..dcf5fdaa 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsUserRegisterWebSessionController extends Serializable { +public interface FinancialsUserRegisterWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java similarity index 94% rename from src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebSessionBean.java rename to src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java index 56ecd73d..8a4c4d5f 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java @@ -18,7 +18,7 @@ package org.mxchange.jfinancials.beans.user.resendlink; import java.util.Locale; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.enterprise.event.Observes; import javax.enterprise.inject.Any; @@ -28,7 +28,6 @@ import org.mxchange.jcoreee.events.locale.ObservableLocaleChangeEvent; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsController; import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebSessionController; import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; @@ -38,6 +37,7 @@ import org.mxchange.jusercore.model.user.status.UserAccountStatus; import org.mxchange.juserlogincore.events.resendlink.ObservableUserResendLinkAccountEvent; import org.mxchange.juserlogincore.events.resendlink.UserResendLinkAccountEvent; import org.mxchange.juserlogincore.model.user.resendlink.ResendLinkSessionBeanRemote; +import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; /** * A web session-scoped bean for resending confirmation link @@ -45,8 +45,8 @@ import org.mxchange.juserlogincore.model.user.resendlink.ResendLinkSessionBeanRe * @author Roland Häder */ @Named ("userResendConfirmationController") -@SessionScoped -public class FinancialsResendLinkWebSessionBean extends BaseFinancialsController implements FinancialsResendLinkWebSessionController { +@RequestScoped +public class FinancialsResendLinkWebRequestBean extends BaseFinancialsController implements FinancialsResendLinkWebRequestController { /** * Serial number @@ -79,7 +79,7 @@ public class FinancialsResendLinkWebSessionBean extends BaseFinancialsController * Regular user controller */ @Inject - private FinancialsUserWebSessionController userController; + private FinancialsUserWebRequestController userController; /** * Event being fired after confirmation link is being sent @@ -91,7 +91,7 @@ public class FinancialsResendLinkWebSessionBean extends BaseFinancialsController /** * Default constructor */ - public FinancialsResendLinkWebSessionBean () { + public FinancialsResendLinkWebRequestBean () { // Call super constructor super(); } diff --git a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java similarity index 93% rename from src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebSessionController.java rename to src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java index 8b21db8c..4ad42c60 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java @@ -23,6 +23,6 @@ import java.io.Serializable; *

* @author Roland Häder */ -public interface FinancialsResendLinkWebSessionController extends Serializable { +public interface FinancialsResendLinkWebRequestController extends Serializable { } diff --git a/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java b/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java index c31b7ad6..a86619c3 100644 --- a/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java @@ -58,7 +58,7 @@ public class FinancialsMobileProviderConverter implements Converter providerList = this.mobileProviderBean.allMobileProvider(); + List providerList = this.mobileProviderBean.allMobileProviders(); // Init value MobileProvider provider = null; diff --git a/web/guest/user/user_list.xhtml b/web/guest/user/user_list.xhtml index ba2287d6..b1726a33 100644 --- a/web/guest/user/user_list.xhtml +++ b/web/guest/user/user_list.xhtml @@ -22,22 +22,24 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + > -- 2.39.5