From: Roland Häder Date: Fri, 10 Apr 2020 19:38:06 +0000 (+0200) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3efa8df5724bc13cec98cee46a993524efaa1507;p=jfinancials-war.git Please cherry-pick: - WIP: rewrote admin-list-users view into ViewScoped - added missing "global search" to it - added initial p:dialog box to it - also output userLastLock[Reason] and userMustChangePassword - added/removed/renamed some i18n strings - rewrote cache initialization to avoid a local List copy Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java index 41184b88..f281a464 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java @@ -197,11 +197,8 @@ public class FinancialsBasicDataListWebViewBean extends BaseFinancialsBean imple public void initializeList () { // Is cache there? if (!this.basicDataCache.iterator().hasNext()) { - // Get whole list from EJB - final List basicDatas = this.basicDataBean.allBusinessBasicData(); - // Add all - for (final BasicData basicData : basicDatas) { + for (final BasicData basicData : this.basicDataBean.allBusinessBasicData()) { // Add it to cache this.basicDataCache.put(basicData.getBasicDataId(), basicData); } diff --git a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewBean.java index 7a7fbc17..5d56953a 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewBean.java @@ -190,11 +190,8 @@ public class FinancialsBranchOfficeListWebViewBean extends BaseFinancialsBean im public void initializeList () { // Is cache there? if (!this.branchOfficeCache.iterator().hasNext()) { - // Get whole list from EJB - final List branchOffices = this.branchOfficeBean.allBranchOffices(); - // Add all - for (final BranchOffice branchOffice : branchOffices) { + for (final BranchOffice branchOffice : this.branchOfficeBean.allBranchOffices()) { // Add it to cache this.branchOfficeCache.put(branchOffice.getBranchId(), branchOffice); } diff --git a/src/java/org/mxchange/jfinancials/beans/business/department/list/FinancialsDepartmentListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/department/list/FinancialsDepartmentListWebViewBean.java index 2b40abf5..30815f86 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/department/list/FinancialsDepartmentListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/department/list/FinancialsDepartmentListWebViewBean.java @@ -194,11 +194,8 @@ public class FinancialsDepartmentListWebViewBean extends BaseFinancialsBean impl public void initializeList () { // Is cache there? if (!this.departmentCache.iterator().hasNext()) { - // Get whole list from EJB - final List departments = this.departmentBean.allDepartments(); - // Add all - for (final Department department : departments) { + for (final Department department : this.departmentBean.allDepartments()) { // Add it to cache this.departmentCache.put(department.getDepartmentId(), department); } diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java index 84b6a29d..2dbc4548 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java @@ -163,11 +163,8 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme public void init () { // Is cache there? if (!this.employeeCache.iterator().hasNext()) { - // Get whole list from EJB - final List employees = this.employeeBean.allEmployees(); - // Add all - for (final Employable employee : employees) { + for (final Employable employee : this.employeeBean.allEmployees()) { // Add it to cache this.employeeCache.put(employee.getEmployeeId(), employee); } diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/list/FinancialsHeadquarterListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/list/FinancialsHeadquarterListWebViewBean.java index b5bce36b..e4f579d6 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/headquarter/list/FinancialsHeadquarterListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/headquarter/list/FinancialsHeadquarterListWebViewBean.java @@ -191,11 +191,8 @@ public class FinancialsHeadquarterListWebViewBean extends BaseFinancialsBean imp public void initializeList () { // Is cache there? if (!this.headquarterCache.iterator().hasNext()) { - // Get whole list from EJB - final List Headquarter = this.headquarterBean.allHeadquarters(); - // Add all - for (final Headquarter headquarter : Headquarter) { + for (final Headquarter headquarter : this.headquarterBean.allHeadquarters()) { // Add it to cache this.headquarterCache.put(headquarter.getHeadquarterId(), headquarter); } diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java index 7577eec1..5399bec3 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java @@ -162,11 +162,8 @@ public class FinancialsOpeningTimeWebRequestBean extends BaseFinancialsBean impl public void initializeList () { // Is cache there? if (!this.openingTimesCache.iterator().hasNext()) { - // Get whole list from EJB - final List openingTimes = this.openingTimesBean.allOpeningTimes(); - // Add all - for (final OpeningTime openingTime : openingTimes) { + for (final OpeningTime openingTime : this.openingTimesBean.allOpeningTimes()) { // Add it to cache this.openingTimesCache.put(openingTime.getOpeningId(), openingTime); } diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java index cca45e73..08604069 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java @@ -271,7 +271,7 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp final Contact contact = this.createContactInstance(); // Default is not same contact - if (this.contactListController.isSameContactFound(contact)) { + if (this.contactListController.isContactFound(contact)) { // Already registered throw new FaceletException(new ContactAlreadyAddedException(contact)); } diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java index 8e9d7ecd..bf31d213 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java @@ -217,7 +217,7 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen * @param event Event being fired */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -243,7 +243,7 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen * @param event Event being fired */ public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -271,7 +271,7 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen * @param event Event instance */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewBean.java index 83f001cd..7b6079f1 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewBean.java @@ -126,7 +126,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme * @param event Updated contact data event */ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -151,7 +151,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme * @param event Event being fired */ public void afterUserConfirmedAccount (@Observes final ObservableUserConfirmedAccountEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -176,7 +176,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme * @param event User registration event */ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -323,11 +323,8 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme public void initializeList () { // Is cache there? if (!this.contactCache.iterator().hasNext()) { - // Get whole list from EJB - final List contacts = this.contactBean.allContacts(); - // Add all - for (final Contact contact : contacts) { + for (final Contact contact : this.contactBean.allContacts()) { // Add it to cache this.contactCache.put(contact.getContactId(), contact); } @@ -355,7 +352,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme } @Override - public boolean isSameContactFound (final Contact contact) { + public boolean isContactFound (final Contact contact) { // Default is not found boolean IsFound = false; diff --git a/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewController.java index 51d3346e..ceea4115 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewController.java @@ -46,7 +46,7 @@ public interface FinancialsContactListWebViewController extends Serializable { * * @return Whether contact has been found */ - boolean isSameContactFound (final Contact contact); + boolean isContactFound (final Contact contact); /** * Getter for all contacts diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java index e762c53a..ad5d0103 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java @@ -236,7 +236,7 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea * @param event Event being fired */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -261,7 +261,7 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea * @param event Updated contact data event */ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java index 1be5d85e..48f48fef 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java @@ -127,7 +127,7 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -152,7 +152,7 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp * @param event Unlinked fax contact event */ public void afterAdminUnlinkedFaxContactDataEvent (@Observes final ObservableAdminUnlinkedFaxNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -180,7 +180,7 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp * @param event Unlinked land-line contact event */ public void afterAdminUnlinkedLandLineContactDataEvent (@Observes final ObservableAdminUnlinkedLandLineNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -208,7 +208,7 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp * @param event Unlinked mobile contact event */ public void afterAdminUnlinkedMobileContactDataEvent (@Observes final ObservableAdminUnlinkedMobileNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -236,7 +236,7 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp * @param event Updated contact data event */ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java index 19e00598..f772c1fc 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java @@ -185,11 +185,8 @@ public class FinancialsCountryListWebViewBean extends BaseFinancialsBean impleme public void initializeList () { // Is cache there? if (!this.countryCache.iterator().hasNext()) { - // Get whole list from EJB - final List countrys = this.countryBean.allCountries(); - // Add all - for (final Country country : countrys) { + for (final Country country : this.countryBean.allCountries()) { // Add it to cache this.countryCache.put(country.getCountryId(), country); } diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java index 4fc6ef40..c94a402b 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java @@ -32,8 +32,8 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable; import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; import org.mxchange.jcountry.model.data.Country; import org.mxchange.jfinancials.beans.BaseFinancialsBean; +import org.mxchange.jfinancials.beans.contact.list.FinancialsContactListWebViewController; import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; import org.mxchange.jphone.events.fax.created.CreatedFaxNumberEvent; import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent; import org.mxchange.jphone.events.landline.created.CreatedLandLineNumberEvent; @@ -125,7 +125,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F * Regular user controller */ @Inject - private FinancialsUserWebRequestController userController; + private FinancialsContactListWebViewController contactListController; /** * Event for when a user instance was created @@ -185,7 +185,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F String messageKey = "CONTACT_IS_UNUSED"; //NOI18N // Check user first - if (this.userController.isContactFound(contact)) { + if (this.contactListController.isContactFound(contact)) { // Only user messageKey = "CONTACT_IS_USER"; //NOI18N } diff --git a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java index 16fd8b48..e291a145 100644 --- a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java @@ -98,7 +98,7 @@ public class FinancialsLocalizationSessionBean extends BaseFinancialsBean implem * @param event Event instance */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -129,7 +129,7 @@ public class FinancialsLocalizationSessionBean extends BaseFinancialsBean implem * @param event Event instance */ public void afterUserLogoutEvent (@Observes final ObservableUserLogoutEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -198,11 +198,7 @@ public class FinancialsLocalizationSessionBean extends BaseFinancialsBean implem return NUMBER_FORMAT.format(amount); } - /** - * Getter for locale - *

- * @return Locale - */ + @Override public Locale getLocale () { return this.locale; } diff --git a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java index 74576003..d845049f 100644 --- a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java @@ -17,6 +17,7 @@ package org.mxchange.jfinancials.beans.localization; import java.io.Serializable; +import java.util.Locale; /** * An interface for localization change beans @@ -34,4 +35,11 @@ public interface FinancialsLocalizationSessionController extends Serializable { */ String formatCurrency (final Float amount); + /** + * Getter for locale + *

+ * @return Locale + */ + Locale getLocale (); + } diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java index 7d86d788..184b68b2 100644 --- a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java @@ -164,11 +164,8 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsBean i public void initCache () { // Is cache there? if (!this.mobileProviderCache.iterator().hasNext()) { - // Get whole list from EJB - final List mobileProviders = this.mobileProviderBean.allMobileProviders(); - // Add all - for (final MobileProvider mobileProvider : mobileProviders) { + for (final MobileProvider mobileProvider : this.mobileProviderBean.allMobileProviders()) { // Add it to cache this.mobileProviderCache.put(mobileProvider.getProviderId(), mobileProvider); } diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java index 70a20c91..35f54e27 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java @@ -132,7 +132,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -161,7 +161,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminDeletedFaxNumberEvent (@Observes final AdminDeletedFaxNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -190,7 +190,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminDeletedLandLineNumberEvent (@Observes final AdminDeletedLandLineNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -219,7 +219,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminDeletedMobileNumberEvent (@Observes final AdminDeletedMobileNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -371,7 +371,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -400,7 +400,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminUpdatedFaxNumberEvent (@Observes final AdminUpdatedFaxNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -429,7 +429,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminUpdatedLandLineNumberEvent (@Observes final AdminUpdatedLandLineNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -458,7 +458,7 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminUpdatedMobileNumberEvent (@Observes final AdminUpdatedMobileNumberEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -598,11 +598,8 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements public void init () { // Is cache there? if (!this.faxNumberCache.iterator().hasNext()) { - // Get whole list from EJB - final List faxNumbers = this.phoneBean.allFaxNumbers(); - // Add all - for (final DialableFaxNumber faxNumber : faxNumbers) { + for (final DialableFaxNumber faxNumber : this.phoneBean.allFaxNumbers()) { // Add it to cache this.faxNumberCache.put(faxNumber.getPhoneId(), faxNumber); } @@ -610,11 +607,8 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements // Is cache there? if (!this.landLineNumberCache.iterator().hasNext()) { - // Get whole list from EJB - final List lineNumbers = this.phoneBean.allLandLineNumbers(); - // Add all - for (final DialableLandLineNumber lineNumber : lineNumbers) { + for (final DialableLandLineNumber lineNumber : this.phoneBean.allLandLineNumbers()) { // Add it to cache this.landLineNumberCache.put(lineNumber.getPhoneId(), lineNumber); } @@ -622,11 +616,8 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements // Is cache there? if (!this.mobileNumberCache.iterator().hasNext()) { - // Get whole list from EJB - final List mobileNumbers = this.phoneBean.allMobileNumbers(); - // Add all - for (final DialableMobileNumber mobileNumber : mobileNumbers) { + for (final DialableMobileNumber mobileNumber : this.phoneBean.allMobileNumbers()) { // Add it to cache this.mobileNumberCache.put(mobileNumber.getPhoneId(), mobileNumber); } diff --git a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java index 42e39d61..bf3c9b28 100644 --- a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java @@ -22,7 +22,7 @@ import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jfinancials.beans.BaseFinancialsBean; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; @@ -43,10 +43,10 @@ public class FinancialsUserProfileWebRequestBean extends BaseFinancialsBean impl private static final long serialVersionUID = 187_687_145_286_710L; /** - * User controller + * User list controller */ @Inject - private FinancialsUserWebRequestController userController; + private FinancialsUserListWebViewController userListController; /** * Login controller @@ -69,7 +69,7 @@ public class FinancialsUserProfileWebRequestBean extends BaseFinancialsBean impl try { // Try to get it - user = this.userController.lookupUserById(userId); + user = this.userListController.lookupUserById(userId); } catch (final UserNotFoundException ex) { // Throw again throw new FaceletException(ex); diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java index 7fb24036..9c5cf607 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java @@ -36,6 +36,7 @@ import org.mxchange.jfinancials.beans.BaseFinancialsBean; import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController; import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; @@ -141,12 +142,6 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; - /** - * Regular user controller - */ - @Inject - private FinancialsUserWebRequestController userController; - /** * Delete reason */ @@ -160,6 +155,12 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem @Any private Event userLinkedEvent; + /** + * Regular user controller + */ + @Inject + private FinancialsUserListWebViewController userListController; + /** * User lock reason */ @@ -236,7 +237,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem // Is the user name or email address used already? // @TODO Add password length check - if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(newUser))) { + if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userListController.isUserNameRegistered(newUser))) { // User name is already used throw new FaceletException(new UserNameAlreadyRegisteredException(newUser)); } else if ((this.getContact() == null) && (this.contactController.isEmailAddressRegistered(newUser.getUserContact()))) { @@ -311,7 +312,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem * @param event User registration event */ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java index 96916310..23bc0e50 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java @@ -16,15 +16,8 @@ */ package org.mxchange.jfinancials.beans.user; -import fish.payara.cdi.jsr107.impl.NamedCache; import java.text.MessageFormat; -import java.util.Comparator; -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.RequestScoped; import javax.enterprise.event.Event; @@ -35,29 +28,22 @@ import javax.faces.view.facelets.FaceletException; import javax.inject.Inject; import javax.inject.Named; import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jcoreee.events.locale.ObservableLocaleChangeEvent; import org.mxchange.jfinancials.beans.BaseFinancialsBean; import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; +import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController; import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.clear.password.ObservableClearUserPasswordEvent; import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; -import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent; import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; -import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent; -import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent; -import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent; -import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; -import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.LoginUser; import org.mxchange.jusercore.model.user.User; import org.mxchange.jusercore.model.user.UserSessionBeanRemote; import org.mxchange.jusercore.model.user.profilemodes.ProfileMode; -import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent; import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; @@ -78,11 +64,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements */ private static final long serialVersionUID = 542_145_347_916L; - /** - * List of all users - */ - private final List allUsers; - /** * General contact controller */ @@ -96,14 +77,10 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements private FinancialsFeaturesWebApplicationController featureController; /** - * List of filtered users - */ - private List filteredUsers; - - /** - * Locale instance + * Localization controller */ - private Locale locale; + @Inject + private FinancialsLocalizationSessionController localizationController; /** * Event being fired when user updated personal data @@ -118,13 +95,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") private UserSessionBeanRemote userBean; - /** - * A list of all user profiles - */ - @Inject - @NamedCache (cacheName = "userCache") - private Cache userCache; - /** * User id */ @@ -162,9 +132,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements public FinancialsUserWebRequestBean () { // Call super constructor super(); - - // Init list - this.allUsers = new LinkedList<>(); } /** @@ -173,7 +140,7 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements * @param event Event being fired */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -188,51 +155,17 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N } - // Update user list - this.updateList(event.getAddedUser()); - - // Clear all data - this.clear(); - // Set user id again this.setUserId(event.getAddedUser().getUserId()); } - /** - * Event observer for deleted user accounts (by administrator) - *

- * @param event Event being fired - */ - public void afterAdminDeletedUserEvent (@Observes final ObservableAdminDeletedUserEvent event) { - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getDeletedUser() == null) { - // Throw NPE again - throw new NullPointerException("event.deletedUser is null"); //NOI18N - } else if (event.getDeletedUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.deletedUser.userId is null"); //NOI18N - } else if (event.getDeletedUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getDeletedUser(), event.getDeletedUser().getUserId())); //NOI18N - } - - // Update user list - this.removeFromList(event.getDeletedUser()); - - // Clear all data - this.clear(); - } - /** * Event observer for linked users with existing contact data *

* @param event Event being fired */ public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -247,94 +180,10 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLinkedUser(), event.getLinkedUser().getUserId())); //NOI18N } - // Update user list - this.updateList(event.getLinkedUser()); - - // Clear all data - this.clear(); - // Set user id again this.setUserId(event.getLinkedUser().getUserId()); } - /** - * Event observer for locked users - *

- * @param event Event being fired - */ - public void afterAdminLockedUserEvent (@Observes final ObservableAdminLockedUserEvent event) { - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getLockedUser() == null) { - // Throw NPE again - throw new NullPointerException("event.lockedUser is null"); //NOI18N - } else if (event.getLockedUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.lockedUser.userId is null"); //NOI18N - } else if (event.getLockedUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLockedUser(), event.getLockedUser().getUserId())); //NOI18N - } - - // Update user list - this.updateList(event.getLockedUser()); - } - - /** - * Event observer for unlocked users - *

- * @param event Event being fired - */ - public void afterAdminUnlockedUserEvent (@Observes final ObservableAdminUnlockedUserEvent event) { - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getUnlockedUser() == null) { - // Throw NPE again - throw new NullPointerException("event.unlockedUser is null"); //NOI18N - } else if (event.getUnlockedUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.unlockedUser.userId is null"); //NOI18N - } else if (event.getUnlockedUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUnlockedUser(), event.getUnlockedUser().getUserId())); //NOI18N - } - - // Update user list - this.updateList(event.getUnlockedUser()); - } - - /** - * Event observer for updated user data by administrator - *

- * @param event Event being updated - */ - public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) { - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getUpdatedUser() == null) { - // Throw NPE again - throw new NullPointerException("event.updatedUser is null"); //NOI18N - } else if (event.getUpdatedUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N - } else if (event.getUpdatedUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedUser(), event.getUpdatedUser().getUserId())); //NOI18N - } - - // Update user list - this.updateList(event.getUpdatedUser()); - - // Clear all data - this.clear(); - } - /** * Event observer for when a bean helper has successfully created a user * instance, means the user exists. If the user does not exist, this event @@ -365,58 +214,13 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements this.copyUser(user); } - /** - * Observer method for events being fired when the application's locale has - * been changed. - *

- * @param event Event being fired - */ - public void afterLocaleChangeEvent (@Observes final ObservableLocaleChangeEvent event) { - // Is the parameter valid? - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getLocale() == null) { - // Throw NPE again - throw new NullPointerException("event.locale is null"); //NOI18N - } - - // Set it here - this.setLocale(event.getLocale()); - } - - /** - * Event observer when user confirmed account. - *

- * @param event Event being fired - */ - public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) { - // event should not be null - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getConfirmedUser() == null) { - // Throw NPE again - throw new NullPointerException("event.confirmedUser is null"); //NOI18N - } else if (event.getConfirmedUser().getUserId() == null) { - // userId is null - throw new NullPointerException("event.confirmedUser.userId is null"); //NOI18N - } else if (event.getConfirmedUser().getUserId() < 1) { - // Not avalid id - throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getConfirmedUser(), event.getConfirmedUser().getUserId())); //NOI18N - } - - // Update user list - this.updateList(event.getConfirmedUser()); - } - /** * Event observer for logged-in user *

* @param event Event instance */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -467,7 +271,7 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements * @param event User registration event */ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -488,73 +292,10 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements // Copy all data from registered->user this.copyUser(registeredUser); - // Clear all data - this.clear(); - - // Update user list - this.updateList(registeredUser); - // Set user id again this.setUserId(registeredUser.getUserId()); } - /** - * Method being call after user's password has been updated (and history - * entry has been created). - *

- * @param event Event being observed - */ - public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) { - // Check parameter - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getPasswordHistory() == null) { - // Throw NPE again - throw new NullPointerException("event.passwordHistory is null"); //NOI18N - } else if (event.getPasswordHistory().getUserPasswordHistoryId() == null) { - // ... and again - throw new NullPointerException("event.passwordHistory.userPasswordHistoryId is null"); //NOI18N - } else if (event.getPasswordHistory().getUserPasswordHistoryId() < 1) { - // Invalid value - throw new IllegalArgumentException(MessageFormat.format("event.passwordHistory.userPasswordHistoryId={0} is in valid", event.getPasswordHistory().getUserPasswordHistoryId())); //NOI18N - } - - // Update user list - this.updateList(event.getPasswordHistory().getUserPasswordHistoryUser()); - } - - /** - * Listens to fired event when user updated personal data - *

- * @param event Event being fired - */ - public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) { - // Check parameter - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); //NOI18N - } else if (event.getUpdatedUser() == null) { - // Throw NPE again - throw new NullPointerException("event.updatedUser is null"); //NOI18N - } else if (event.getUpdatedUser().getUserId() == null) { - // ... and again - throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N - } else if (event.getUpdatedUser().getUserId() < 1) { - // Invalid value - throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId())); //NOI18N - } - - // Update user list - this.updateList(event.getUpdatedUser()); - } - - @Override - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List allUsers () { - return this.allUsers; - } - /** * Event observer for when a user name should be cleared *

@@ -592,9 +333,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements // Required personal data must be set assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N - // Create new user instance - final User user = new LoginUser(); - // Is user name required? if (!this.isUserNameRequired()) { // Generate pseudo-random user name @@ -613,10 +351,13 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements this.setUserPasswordRepeat(randomPassword); } + // Create new user instance + final User user = new LoginUser(); + // Set user name profile mode and locale user.setUserName(this.getUserName()); user.setUserProfileMode(this.getUserProfileMode()); - user.setUserLocale(this.getLocale()); + user.setUserLocale(this.localizationController.getLocale()); // Is multiple registration page if ((createContactData) || (!this.featureController.isFeatureEnabled("user_register_multiple_page"))) { //NOI18N @@ -696,47 +437,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements return "user_contact_data_saved"; //NOI18N } - @Override - public User findUserById (final Long userId) throws UserNotFoundException { - // Validate parameter - if (null == userId) { - // Throw NPE - throw new NullPointerException("userId is null"); //NOI18N - } else if (userId < 1) { - // Throw IAE - throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N - } else if (!this.userCache.containsKey(userId)) { - // Not found - throw new UserNotFoundException(userId); - } - - // Get it from cache - final User user = this.userCache.get(userId); - - // Return it - return user; - } - - /** - * Getter for filtered users list - *

- * @return Filtered users list - */ - @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List getFilteredUsers () { - return this.filteredUsers; - } - - /** - * Setter for filtered users list - *

- * @param filteredUsers Filtered users list - */ - @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") - public void setFilteredUsers (final List filteredUsers) { - this.filteredUsers = filteredUsers; - } - /** * Getter for user id *

@@ -831,90 +531,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements ((this.getUserPasswordRepeat() == null) || (this.getUserPasswordRepeat().isEmpty()))); } - @Override - public boolean ifUserIdExists (final Long userId) { - // Validate parameter - if (null == userId) { - // Throw NPE - throw new NullPointerException("userId is null"); //NOI18N - } else if (userId < 1) { - // Throw IAE - throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N - } - - // Check if key is there - boolean isFound = this.userCache.containsKey(userId); - - // Return flag - return isFound; - } - - /** - * Post-initialization of this class - */ - @PostConstruct - public void init () { - // Is cache there? - if (!this.userCache.iterator().hasNext()) { - // Get whole list from EJB - final List users = this.userBean.allUsers(); - - // Add all - for (final User user : users) { - // Add it to cache - this.userCache.put(user.getUserId(), user); - } - } - - // Is cache filled and list is empty - if ((this.userCache.iterator().hasNext()) && (this.allUsers.isEmpty())) { - // Build up list - for (final Cache.Entry currentEntry : this.userCache) { - // Add to list - this.allUsers.add(currentEntry.getValue()); - } - - // Sort list - this.allUsers.sort(new Comparator() { - @Override - public int compare (final User user1, final User user2) { - return user1.getUserId() > user2.getUserId() ? 1 : user1.getUserId() < user2.getUserId() ? -1 : 0; - } - }); - } - } - - @Override - public boolean isContactFound (final Contact contact) { - // The contact must be valid - if (null == contact) { - // Throw NPE - throw new NullPointerException("contact is null"); //NOI18N - } else if (contact.getContactId() == null) { - // Throw again ... - throw new NullPointerException("contact.contactId is null"); //NOI18N - } else if (contact.getContactId() < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid", contact.getContactId())); //NOI18N - } - - // Default is not found - boolean isFound = false; - - // Loop through all entries - for (final User currentUser : this.allUsers()) { - // Compare both objects - if (Objects.equals(contact, currentUser.getUserContact())) { - // Found it - isFound = true; - break; - } - } - - // Return status - return isFound; - } - @Override public boolean isRequiredChangePersonalDataSet () { return ((this.getUserProfileMode() != null) && @@ -947,25 +563,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements return ((this.getUserId() == null) || (this.getUserId() == 0)); } - @Override - public boolean isUserNameRegistered (final User user) { - // Default is not found - boolean isFound = false; - - // Determine it - for (final User currentUser : this.allUsers()) { - // Is same name found? - if (Objects.equals(user.getUserName(), currentUser.getUserName())) { - // Yes, then set flag and abort loop - isFound = true; - break; - } - } - - // Return flag - return isFound; - } - @Override public boolean isUserNameRequired () { // Get context parameter @@ -978,98 +575,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements return isRequired; } - @Override - public User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException { - // Parameter must be valid - if (null == emailAddress) { - // Throw NPE - throw new NullPointerException("emailAddress is null"); //NOI18N - } else if (emailAddress.isEmpty()) { - // Not valid - throw new IllegalArgumentException("emailAddress is empty"); //NOI18N - } - - // Init variable - User user = null; - - // Try to lookup it in visible user list - for (final Cache.Entry currentUser : this.userCache) { - // Contact should be set - if (currentUser.getValue().getUserContact() == null) { - // Contact is null - throw new NullPointerException(MessageFormat.format("currentUser.userContact is null for user id {0}", currentUser.getKey())); //NOI18N - } else if (currentUser.getValue().getUserContact().getContactEmailAddress() == null) { - // Email address should be set - throw new NullPointerException(MessageFormat.format("currentUser.userContact.contactEmailAddress is null for user id {0}", currentUser.getKey())); //NOI18N - } - - // Is the email address found? - if (Objects.equals(currentUser.getValue().getUserContact().getContactEmailAddress(), emailAddress)) { - // Copy to other variable - user = currentUser.getValue(); - break; - } - } - - // Is it still null? - if (null == user) { - // Not visible for the current user - throw new UserEmailAddressNotFoundException(emailAddress); - } - - // Return it - return user; - } - - @Override - public User lookupUserById (final Long userId) throws UserNotFoundException { - // Parameter must be valid - if (null == userId) { - // Throw NPE - throw new NullPointerException("userId is null"); //NOI18N - } else if (userId < 1) { - // Not valid - throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N - } - - // Init variable - User user = null; - - // Try to lookup it in visible user list - for (final Cache.Entry currentUser : this.userCache) { - // Is the user id found? - if (Objects.equals(currentUser.getKey(), userId)) { - // Copy to other variable - user = currentUser.getValue(); - break; - } - } - - // Is it still null? - if (null == user) { - // Not visible for the current user - throw new UserNotFoundException(userId); - } - - // Return it - return user; - } - - /** - * Clears this bean - */ - private void clear () { - // Clear all data - // - personal data - this.setUserId(null); - this.setUserProfileMode(null); - - // - other data - this.clearUserName(); - this.clearUserPasswords(); - this.setLocale(null); - } - /** * Clears user name */ @@ -1108,77 +613,4 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements this.setUserProfileMode(user.getUserProfileMode()); } - /** - * Getter for locale instance - *

- * @return Locale instance - */ - private Locale getLocale () { - return this.locale; - } - - /** - * Setter for locale instance - *

- * @param locale Locale instance - */ - private void setLocale (final Locale locale) { - this.locale = locale; - } - - /** - * Removes user from all lists - *

- * @param user User to remove - */ - private void removeFromList (final User user) { - // The user should be valid - if (null == user) { - // Throw NPE - throw new NullPointerException("user is null"); //NOI18N - } else if (user.getUserId() == null) { - // ... again NPE - throw new NullPointerException("user.userId is null"); //NOI18N - } else if (user.getUserId() < 1) { - // Invalid id - throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N - } - - // Remove it from lists - this.allUsers().remove(user); - this.userCache.remove(user.getUserId()); - } - - /** - * Updates list with given user instance - *

- * @param user User instance - */ - private void updateList (final User user) { - // The user should be valid - if (null == user) { - // Throw NPE - throw new NullPointerException("user is null"); //NOI18N - } else if (user.getUserId() == null) { - // ... again NPE - throw new NullPointerException("user.userId is null"); //NOI18N - } else if (user.getUserId() < 1) { - // Invalid id - throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is invalid", user.getUserId())); //NOI18N - } else if (user.getUserContact() == null) { - // Throw again ... - throw new NullPointerException("user.userContact is null"); //NOI18N - } else if (user.getUserContact().getContactId() == null) { - // Throw again ... - throw new NullPointerException("user.userContact.contactId is null"); //NOI18N - } else if (user.getUserContact().getContactId() < 1) { - // Throw again ... - throw new NullPointerException(MessageFormat.format("user.userContact.contactId={0} is invalid.", user.getUserContact().getContactId())); //NOI18N - } - - // Add/update user - this.userCache.put(user.getUserId(), user); - this.allUsers.add(user); - } - } diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java index edc0d531..8faebffb 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java @@ -17,10 +17,6 @@ package org.mxchange.jfinancials.beans.user; import java.io.Serializable; -import java.util.List; -import org.mxchange.jcontacts.model.contact.Contact; -import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; -import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; /** @@ -38,27 +34,6 @@ public interface FinancialsUserWebRequestController extends Serializable { @Deprecated public static final Integer MINIMUM_PASSWORD_LENGTH = 5; - /** - * Returns a user instance by given primary key. If not found, a proper - * exception is thrown. - *

- * @param userId User id - *

- * @return User instance - *

- * @throws UserNotFoundException If the user is not found - */ - User findUserById (final Long userId) throws UserNotFoundException; - - /** - * Checks if given user id exists - *

- * @param userId User id to check - *

- * @return Whether the user id exists - */ - boolean ifUserIdExists (final Long userId); - /** * Getter for clear-text user password *

@@ -76,56 +51,6 @@ public interface FinancialsUserWebRequestController extends Serializable { */ boolean ifBothPasswordsEmptyAllowed (); - /** - * All users - *

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

- * @param contact Contact to check - *

- * @return Whether the contact is a user - */ - boolean isContactFound (final Contact contact); - - /** - * Checks whether given user instance name is used - *

- * @param user User instance name to check - *

- * @return Whether it is already used - */ - boolean isUserNameRegistered (final User user); - - /** - * Tries to lookup user by given id number. If the user is not found or the - * account status is not CONFIRMED proper exceptions are thrown. - *

- * @param userId User id - *

- * @return User instance - *

- * @throws UserNotFoundException If the user is not found - */ - User lookupUserById (final Long userId) throws UserNotFoundException; - - /** - * Tries to lookup user by given email address. If the user is not found a - * proper exceptions is thrown. - *

- * @param emailAddress Email address - *

- * @return User instance - *

- * @throws UserEmailAddressNotFoundException If the user's email address is - * not found - */ - User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException; - /** * Creates an instance from all properties *

diff --git a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java index 47f6e8ea..7bcbdcf8 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java @@ -97,7 +97,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -122,7 +122,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterAdminDeletedUserEvent (@Observes final ObservableAdminDeletedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -147,7 +147,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -172,7 +172,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterAdminLockedUserEvent (@Observes final ObservableAdminLockedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -197,7 +197,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterAdminUnlockedUserEvent (@Observes final ObservableAdminUnlockedUserEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -222,7 +222,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being updated */ public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -274,7 +274,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -299,7 +299,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -324,7 +324,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event instance */ public void afterUserLogoutEvent (@Observes final ObservableUserLogoutEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -349,7 +349,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -374,7 +374,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp * @param event Event being fired */ public void afterUserResendConfirmationLinkEvent (@Observes final ObservableUserResendLinkAccountEvent event) { - // event should not be null + // Event and contained entity instance should not be null if (null == event) { // Throw NPE throw new NullPointerException("event is null"); //NOI18N @@ -544,11 +544,8 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp */ @PostConstruct public void init () { - // Get whole list from EJB - final List userActivities = this.userActivityBean.fetchAllUserActivityLog(); - // Put all in map, per-user - for (final LogableUserActivity userActivity : userActivities) { + for (final LogableUserActivity userActivity : this.userActivityBean.fetchAllUserActivityLog()) { // Is the list there? if (!this.userActivityCache.containsKey(userActivity.getActivityUser())) { // Init list 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 fdbd7ddb..ead0a818 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java @@ -29,7 +29,7 @@ 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.BaseFinancialsBean; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; import org.mxchange.jusercore.events.user.created.CreatedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; @@ -80,17 +80,17 @@ public class FinancialsConfirmationLinkWebRequestBean extends BaseFinancialsBean private Event userConfirmedEvent; /** - * User controller + * Event for when a user instance was created */ + @Any @Inject - private FinancialsUserWebRequestController userController; + private Event userCreatedEvent; /** - * Event for when a user instance was created + * User controller */ - @Any @Inject - private Event userCreatedEvent; + private FinancialsUserListWebViewController userListController; /** * Default constructor @@ -125,7 +125,7 @@ public class FinancialsConfirmationLinkWebRequestBean extends BaseFinancialsBean User user = null; // Then loop through all - for (final User currentUser : this.userController.allUsers()) { + for (final User currentUser : this.userListController.getAllUsers()) { // Same confirmation key? if (Objects.equals(this.getConfirmationKey(), currentUser.getUserConfirmKey())) { // Found it, then set it and abort loop diff --git a/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewController.java new file mode 100644 index 00000000..aad39e38 --- /dev/null +++ b/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewController.java @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2016 - 2020 Free Software Foundation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.beans.user.list; + +import java.io.Serializable; +import java.util.List; +import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; +import org.mxchange.jusercore.exceptions.UserNotFoundException; +import org.mxchange.jusercore.model.user.User; + +/** + * An interface for user beans + *

+ * @author Roland Häder + */ +public interface FinancialsUserListWebViewController extends Serializable { + + /** + * Returns a user instance by given primary key. If not found, a proper + * exception is thrown. + *

+ * @param userId User id + *

+ * @return User instance + *

+ * @throws UserNotFoundException If the user is not found + */ + User findUserById (final Long userId) throws UserNotFoundException; + + /** + * All users + *

+ * @return A list of all public user profiles + */ + List getAllUsers (); + + /** + * Checks if given user id exists + *

+ * @param userId User id to check + *

+ * @return Whether the user id exists + */ + boolean ifUserIdExists (final Long userId); + + /** + * Checks whether given user instance name is used + *

+ * @param user User instance name to check + *

+ * @return Whether it is already used + */ + boolean isUserNameRegistered (final User user); + + /** + * Tries to lookup user by given id number. If the user is not found or the + * account status is not CONFIRMED proper exceptions are thrown. + *

+ * @param userId User id + *

+ * @return User instance + *

+ * @throws UserNotFoundException If the user is not found + */ + User lookupUserById (final Long userId) throws UserNotFoundException; + + /** + * Tries to lookup user by given email address. If the user is not found a + * proper exceptions is thrown. + *

+ * @param emailAddress Email address + *

+ * @return User instance + *

+ * @throws UserEmailAddressNotFoundException If the user's email address is + * not found + */ + User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException; + +} diff --git a/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewtBean.java b/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewtBean.java new file mode 100644 index 00000000..0f7db169 --- /dev/null +++ b/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewtBean.java @@ -0,0 +1,588 @@ +/* + * Copyright (C) 2016 - 2020 Free Software Foundation + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +package org.mxchange.jfinancials.beans.user.list; + +import fish.payara.cdi.jsr107.impl.NamedCache; +import java.text.MessageFormat; +import java.util.Comparator; +import java.util.LinkedList; +import java.util.List; +import java.util.Objects; +import javax.annotation.PostConstruct; +import javax.cache.Cache; +import javax.ejb.EJB; +import javax.enterprise.event.Observes; +import javax.faces.view.ViewScoped; +import javax.inject.Inject; +import javax.inject.Named; +import org.mxchange.jfinancials.beans.BaseFinancialsBean; +import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; +import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent; +import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent; +import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent; +import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent; +import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent; +import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent; +import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; +import org.mxchange.jusercore.exceptions.UserNotFoundException; +import org.mxchange.jusercore.model.user.User; +import org.mxchange.jusercore.model.user.UserSessionBeanRemote; +import org.mxchange.juserlogincore.events.confirmation.ObservableUserConfirmedAccountEvent; +import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent; +import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent; + +/** + * A user list bean (controller) + *

+ * @author Roland Häder + */ +@Named ("userListController") +@ViewScoped +public class FinancialsUserListWebViewtBean extends BaseFinancialsBean implements FinancialsUserListWebViewController { + + /** + * Serial number + */ + private static final long serialVersionUID = 542_145_347_918L; + + /** + * List of all users + */ + private final List allUsers; + + /** + * List of filtered users + */ + private List filteredUsers; + + /** + * Selected user instance + */ + private User selectedUser; + + /** + * Remote user bean + */ + @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote") + private UserSessionBeanRemote userBean; + + /** + * A list of all user profiles + */ + @Inject + @NamedCache (cacheName = "userCache") + private transient Cache userCache; + + /** + * Default constructor + */ + public FinancialsUserListWebViewtBean () { + // Call super constructor + super(); + + // Init list + this.allUsers = new LinkedList<>(); + } + + /** + * Event observer for newly added users by administrator + *

+ * @param event Event being fired + */ + public void afterAdminAddedUserEvent (@Observes final ObservableAdminAddedUserEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getAddedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.addedUser is null"); //NOI18N + } else if (event.getAddedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.addedUser.userId is null"); //NOI18N + } else if (event.getAddedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getAddedUser(), event.getAddedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getAddedUser()); + } + + /** + * Event observer for deleted user accounts (by administrator) + *

+ * @param event Event being fired + */ + public void afterAdminDeletedUserEvent (@Observes final ObservableAdminDeletedUserEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getDeletedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.deletedUser is null"); //NOI18N + } else if (event.getDeletedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.deletedUser.userId is null"); //NOI18N + } else if (event.getDeletedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getDeletedUser(), event.getDeletedUser().getUserId())); //NOI18N + } + + // Update user list + this.removeFromList(event.getDeletedUser()); + } + + /** + * Event observer for linked users with existing contact data + *

+ * @param event Event being fired + */ + public void afterAdminLinkedUserEvent (@Observes final ObservableAdminLinkedUserEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getLinkedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.linkedUser is null"); //NOI18N + } else if (event.getLinkedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.linkedUser.userId is null"); //NOI18N + } else if (event.getLinkedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLinkedUser(), event.getLinkedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getLinkedUser()); + } + + /** + * Event observer for locked users + *

+ * @param event Event being fired + */ + public void afterAdminLockedUserEvent (@Observes final ObservableAdminLockedUserEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getLockedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.lockedUser is null"); //NOI18N + } else if (event.getLockedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.lockedUser.userId is null"); //NOI18N + } else if (event.getLockedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLockedUser(), event.getLockedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getLockedUser()); + } + + /** + * Event observer for unlocked users + *

+ * @param event Event being fired + */ + public void afterAdminUnlockedUserEvent (@Observes final ObservableAdminUnlockedUserEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getUnlockedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.unlockedUser is null"); //NOI18N + } else if (event.getUnlockedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.unlockedUser.userId is null"); //NOI18N + } else if (event.getUnlockedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUnlockedUser(), event.getUnlockedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getUnlockedUser()); + } + + /** + * Event observer for updated user data by administrator + *

+ * @param event Event being updated + */ + public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getUpdatedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.updatedUser is null"); //NOI18N + } else if (event.getUpdatedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N + } else if (event.getUpdatedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getUpdatedUser(), event.getUpdatedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getUpdatedUser()); + } + + /** + * Event observer when user confirmed account. + *

+ * @param event Event being fired + */ + public void afterUserConfirmedAccountEvent (@Observes final ObservableUserConfirmedAccountEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getConfirmedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.confirmedUser is null"); //NOI18N + } else if (event.getConfirmedUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.confirmedUser.userId is null"); //NOI18N + } else if (event.getConfirmedUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getConfirmedUser(), event.getConfirmedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getConfirmedUser()); + } + + /** + * Event observer for new user registrations + *

+ * @param event User registration event + */ + public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) { + // Event and contained entity instance should not be null + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getRegisteredUser() == null) { + // Throw NPE again + throw new NullPointerException("event.registeredUser is null"); //NOI18N + } else if (event.getRegisteredUser().getUserId() == null) { + // userId is null + throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N + } else if (event.getRegisteredUser().getUserId() < 1) { + // Not avalid id + throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getRegisteredUser()); + } + + /** + * Method being call after user's password has been updated (and history + * entry has been created). + *

+ * @param event Event being observed + */ + public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) { + // Check parameter + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getPasswordHistory() == null) { + // Throw NPE again + throw new NullPointerException("event.passwordHistory is null"); //NOI18N + } else if (event.getPasswordHistory().getUserPasswordHistoryId() == null) { + // ... and again + throw new NullPointerException("event.passwordHistory.userPasswordHistoryId is null"); //NOI18N + } else if (event.getPasswordHistory().getUserPasswordHistoryId() < 1) { + // Invalid value + throw new IllegalArgumentException(MessageFormat.format("event.passwordHistory.userPasswordHistoryId={0} is in valid", event.getPasswordHistory().getUserPasswordHistoryId())); //NOI18N + } + + // Update user list + this.updateList(event.getPasswordHistory().getUserPasswordHistoryUser()); + } + + /** + * Listens to fired event when user updated personal data + *

+ * @param event Event being fired + */ + public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) { + // Check parameter + if (null == event) { + // Throw NPE + throw new NullPointerException("event is null"); //NOI18N + } else if (event.getUpdatedUser() == null) { + // Throw NPE again + throw new NullPointerException("event.updatedUser is null"); //NOI18N + } else if (event.getUpdatedUser().getUserId() == null) { + // ... and again + throw new NullPointerException("event.updatedUser.userId is null"); //NOI18N + } else if (event.getUpdatedUser().getUserId() < 1) { + // Invalid value + throw new IllegalArgumentException(MessageFormat.format("event.updatedUser.userId={0} is in valid", event.getUpdatedUser().getUserId())); //NOI18N + } + + // Update user list + this.updateList(event.getUpdatedUser()); + } + + @Override + public User findUserById (final Long userId) throws UserNotFoundException { + // Validate parameter + if (null == userId) { + // Throw NPE + throw new NullPointerException("userId is null"); //NOI18N + } else if (userId < 1) { + // Throw IAE + throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N + } else if (!this.userCache.containsKey(userId)) { + // Not found + throw new UserNotFoundException(userId); + } + + // Get it from cache + final User user = this.userCache.get(userId); + + // Return it + return user; + } + + @Override + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getAllUsers () { + return this.allUsers; + } + + /** + * Getter for filtered users list + *

+ * @return Filtered users list + */ + @SuppressWarnings ("ReturnOfCollectionOrArrayField") + public List getFilteredUsers () { + return this.filteredUsers; + } + + /** + * Setter for filtered users list + *

+ * @param filteredUsers Filtered users list + */ + @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") + public void setFilteredUsers (final List filteredUsers) { + this.filteredUsers = filteredUsers; + } + + /** + * Getter for selected user instance + *

+ * @return Selected user instance + */ + public User getSelectedUser () { + return this.selectedUser; + } + + /** + * Setter for selected user instance + *

+ * @param selectedUser Selected user instance + */ + public void setSelectedUser (final User selectedUser) { + this.selectedUser = selectedUser; + } + + @Override + public boolean ifUserIdExists (final Long userId) { + // Validate parameter + if (null == userId) { + // Throw NPE + throw new NullPointerException("userId is null"); //NOI18N + } else if (userId < 1) { + // Throw IAE + throw new IllegalArgumentException("userId=" + userId + " is invalid."); //NOI18N + } + + // Check if key is there + boolean isFound = this.userCache.containsKey(userId); + + // Return flag + return isFound; + } + + /** + * Post-initialization of this class + */ + @PostConstruct + public void initializeList () { + // Is cache there? + if (!this.userCache.iterator().hasNext()) { + // Add all + for (final User user : this.userBean.allUsers()) { + // Add it to cache + this.userCache.put(user.getUserId(), user); + } + } + + // Is cache filled and list is empty + if ((this.userCache.iterator().hasNext()) && (this.getAllUsers().isEmpty())) { + // Build up list + for (final Cache.Entry currentEntry : this.userCache) { + // Add to list + this.getAllUsers().add(currentEntry.getValue()); + } + + // Sort list + this.getAllUsers().sort(new Comparator() { + @Override + public int compare (final User user1, final User user2) { + return user1.getUserId() > user2.getUserId() ? 1 : user1.getUserId() < user2.getUserId() ? -1 : 0; + } + }); + + // Set full list + this.setFilteredUsers(this.getAllUsers()); + } + } + + @Override + public boolean isUserNameRegistered (final User user) { + // Default is not found + boolean isFound = false; + + // Determine it + for (final User currentUser : this.getAllUsers()) { + // Is same name found? + if (Objects.equals(user.getUserName(), currentUser.getUserName())) { + // Yes, then set flag and abort loop + isFound = true; + break; + } + } + + // Return flag + return isFound; + } + + @Override + public User lookupUserByEmailAddress (final String emailAddress) throws UserEmailAddressNotFoundException { + // Parameter must be valid + if (null == emailAddress) { + // Throw NPE + throw new NullPointerException("emailAddress is null"); //NOI18N + } else if (emailAddress.isEmpty()) { + // Not valid + throw new IllegalArgumentException("emailAddress is empty"); //NOI18N + } + + // Init variable + User user = null; + + // Try to lookup it in visible user list + for (final Cache.Entry currentUser : this.userCache) { + // Contact should be set + if (currentUser.getValue().getUserContact() == null) { + // Contact is null + throw new NullPointerException(MessageFormat.format("currentUser.userContact is null for user id {0}", currentUser.getKey())); //NOI18N + } else if (currentUser.getValue().getUserContact().getContactEmailAddress() == null) { + // Email address should be set + throw new NullPointerException(MessageFormat.format("currentUser.userContact.contactEmailAddress is null for user id {0}", currentUser.getKey())); //NOI18N + } + + // Is the email address found? + if (Objects.equals(currentUser.getValue().getUserContact().getContactEmailAddress(), emailAddress)) { + // Copy to other variable + user = currentUser.getValue(); + break; + } + } + + // Is it still null? + if (null == user) { + // Not visible for the current user + throw new UserEmailAddressNotFoundException(emailAddress); + } + + // Return it + return user; + } + + @Override + public User lookupUserById (final Long userId) throws UserNotFoundException { + // Parameter must be valid + if (null == userId) { + // Throw NPE + throw new NullPointerException("userId is null"); //NOI18N + } else if (userId < 1) { + // Not valid + throw new IllegalArgumentException(MessageFormat.format("userId={0} is not valid.", userId)); //NOI18N + } + + // Init variable + User user = null; + + // Try to lookup it in visible user list + for (final Cache.Entry currentUser : this.userCache) { + // Is the user id found? + if (Objects.equals(currentUser.getKey(), userId)) { + // Copy to other variable + user = currentUser.getValue(); + break; + } + } + + // Is it still null? + if (null == user) { + // Not visible for the current user + throw new UserNotFoundException(userId); + } + + // Return it + return user; + } + + /** + * Removes user from all lists + *

+ * @param user User to remove + */ + private void removeFromList (final User user) { + // Remove it from lists + this.getAllUsers().remove(user); + this.userCache.remove(user.getUserId()); + } + + /** + * Updates list with given user instance + *

+ * @param user User instance + */ + private void updateList (final User user) { + // Add/update user + this.userCache.put(user.getUserId(), user); + this.getAllUsers().add(user); + } + +} diff --git a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java index 9499f343..b949dd3c 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java @@ -31,6 +31,7 @@ import org.mxchange.jfinancials.beans.BaseFinancialsBean; import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; 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; @@ -101,6 +102,12 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp @Inject private FinancialsUserWebRequestController userController; + /** + * User list controller + */ + @Inject + private FinancialsUserListWebViewController userListController; + /** * An event being fired when a user password was changed */ @@ -149,7 +156,7 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp } else if (!this.userController.isRequiredPersonalDataSet()) { // Not all required fields are set throw new FaceletException("Not all required fields are set."); //NOI18N - } else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(user))) { //NOI18N + } else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userListController.isUserNameRegistered(user))) { //NOI18N // Is multi-page enabled? if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N // User name is already used, should not happen here @@ -264,7 +271,7 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp if (null == user) { // user must be set throw new NullPointerException("user is null after createUserInstance() was called"); //NOI18N - } else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(user))) { //NOI18N + } else if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userListController.isUserNameRegistered(user))) { //NOI18N // User name is already used, so clear it this.clearUserNameEvent.fire(new ClearUserNameEvent()); diff --git a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java index 97471dd3..5822c83e 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java @@ -16,19 +16,17 @@ */ package org.mxchange.jfinancials.beans.user.resendlink; -import java.util.Locale; import javax.ejb.EJB; import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; -import javax.enterprise.event.Observes; import javax.enterprise.inject.Any; import javax.faces.application.FacesMessage; import javax.inject.Inject; import javax.inject.Named; -import org.mxchange.jcoreee.events.locale.ObservableLocaleChangeEvent; import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsBean; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.localization.FinancialsLocalizationSessionController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; import org.mxchange.jusercore.exceptions.UserEmailAddressNotFoundException; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.exceptions.UserStatusConfirmedException; @@ -59,9 +57,10 @@ public class FinancialsResendLinkWebRequestBean extends BaseFinancialsBean imple private String emailAddress; /** - * Locale instance + * Localization controller */ - private Locale locale; + @Inject + private FinancialsLocalizationSessionController localizationController; /** * EJB for resending confirmation link @@ -73,7 +72,7 @@ public class FinancialsResendLinkWebRequestBean extends BaseFinancialsBean imple * Regular user controller */ @Inject - private FinancialsUserWebRequestController userController; + private FinancialsUserListWebViewController userListController; /** * Event being fired after confirmation link is being sent @@ -90,26 +89,6 @@ public class FinancialsResendLinkWebRequestBean extends BaseFinancialsBean imple super(); } - /** - * Observer method for events being fired when the application's locale has - * been changed. - *

- * @param event Event being fired - */ - public void afterLocaleChangeEvent (@Observes final ObservableLocaleChangeEvent event) { - // Is the parameter valid? - if (null == event) { - // Throw NPE - throw new NullPointerException("event is null"); - } else if (event.getLocale() == null) { - // Throw NPE again - throw new NullPointerException("event.locale is null"); - } - - // Set it here - this.setLocale(event.getLocale()); - } - /** * Resends (new) confirmation link to given email address, if found. * Otherwise an exception is thrown. On success a redirect takes place. @@ -128,7 +107,7 @@ public class FinancialsResendLinkWebRequestBean extends BaseFinancialsBean imple try { // Is the email address really not used? - user = this.userController.lookupUserByEmailAddress(this.getEmailAddress()); + user = this.userListController.lookupUserByEmailAddress(this.getEmailAddress()); } catch (final UserEmailAddressNotFoundException ex) { // Always clear bean this.clear(); @@ -166,7 +145,7 @@ public class FinancialsResendLinkWebRequestBean extends BaseFinancialsBean imple final String baseUrl = FacesUtils.generateBaseUrl(); // Call EJB and return redirect target - managedUser = this.resendLinkBean.resendConfirmationLink(user, this.getLocale(), baseUrl); + managedUser = this.resendLinkBean.resendConfirmationLink(user, this.localizationController.getLocale(), baseUrl); } catch (final UserNotFoundException ex) { // User not found this.showFacesMessage("form_resend_link:resendEmailAddress", "ERROR_USER_NOT_FOUND", FacesMessage.SEVERITY_ERROR); //NOI18N @@ -213,22 +192,4 @@ public class FinancialsResendLinkWebRequestBean extends BaseFinancialsBean imple this.setEmailAddress(null); } - /** - * Getter for locale instance - *

- * @return Locale instance - */ - private Locale getLocale () { - return this.locale; - } - - /** - * Setter for locale instance - *

- * @param locale Locale instance - */ - private void setLocale (final Locale locale) { - this.locale = locale; - } - } diff --git a/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java b/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java index f5074612..18ecbb94 100644 --- a/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java @@ -22,8 +22,8 @@ import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import javax.faces.convert.ConverterException; import javax.faces.convert.FacesConverter; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestBean; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewtBean; import org.mxchange.jusercore.exceptions.UserNotFoundException; import org.mxchange.jusercore.model.user.User; @@ -38,14 +38,14 @@ public class FinancialsUserConverter implements Converter { /** * User backing bean */ - private static FinancialsUserWebRequestController USER_CONTROLLER; + private static FinancialsUserListWebViewController USER_LIST_CONTROLLER; @Override public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // Is the instance there? - if (null == USER_CONTROLLER) { + if (null == USER_LIST_CONTROLLER) { // Get bean from CDI directly - USER_CONTROLLER = CDI.current().select(FinancialsUserWebRequestBean.class).get(); + USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewtBean.class).get(); } // Is the value null or empty? @@ -65,7 +65,7 @@ public class FinancialsUserConverter implements Converter { final Long userId = Long.valueOf(submittedValue); // Try to get user instance from it - user = USER_CONTROLLER.findUserById(userId); + user = USER_LIST_CONTROLLER.findUserById(userId); } catch (final NumberFormatException ex) { // Throw again throw new ConverterException(ex); diff --git a/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java b/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java index 3a50709c..0279469e 100644 --- a/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java +++ b/src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java @@ -24,8 +24,8 @@ import javax.faces.context.FacesContext; import javax.faces.validator.FacesValidator; import javax.faces.validator.ValidatorException; import org.mxchange.jcoreee.validator.number.BaseNumberValidator; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestBean; -import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController; +import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewtBean; /** * A validator for user ids @@ -38,7 +38,7 @@ public class FinancialsUserIdValidator extends BaseNumberValidator { /** * User backing bean */ - private static FinancialsUserWebRequestController USER_CONTROLLER; + private static FinancialsUserListWebViewController USER_LIST_CONTROLLER; /** * Serial number @@ -54,16 +54,16 @@ public class FinancialsUserIdValidator extends BaseNumberValidator { super.preValidate(context, component, value, requiredFields, false); // Is the instance there? - if (null == USER_CONTROLLER) { + if (null == USER_LIST_CONTROLLER) { // Get bean from CDI directly - USER_CONTROLLER = CDI.current().select(FinancialsUserWebRequestBean.class).get(); + USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewtBean.class).get(); } // Cast value final Long userId = (Long) value; // Define variable - final Boolean ifUserExists = USER_CONTROLLER.ifUserIdExists(userId); + final Boolean ifUserExists = USER_LIST_CONTROLLER.ifUserIdExists(userId); // Is the user id valid? if (!ifUserExists) { diff --git a/src/java/org/mxchange/localization/generic_de_DE.properties b/src/java/org/mxchange/localization/generic_de_DE.properties index 86d78d02..9b5722b8 100644 --- a/src/java/org/mxchange/localization/generic_de_DE.properties +++ b/src/java/org/mxchange/localization/generic_de_DE.properties @@ -330,8 +330,10 @@ ENTRY_UPDATED_HEADER=Aktualisiert: ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE=Editieren oder l\u00f6schen des Handyanbieters ADMIN_USER_DATA_ENTER_PASSWORD=Passwort eingeben: ADMIN_USER_DATA_ENTER_PASSWORD_REPEAT=Passwort wiederholen: -ADMIN_LIST_USER_ID=Benutzer-Id: -ADMIN_LIST_USER_NAME=Benutzername: +DATA_USER_ID=Benutzer-Id: +DATA_USER_NAME=Benutzername: +#@TODO Please fix German umlauts! +CHANGE=Aendern? ADMIN_LIST_USER_PERSONAL_TITLE=Anrede: ADMIN_LIST_USER_FIRST_NAME=Vorname: ADMIN_LIST_USER_FAMILY_NAME=Nachname: @@ -351,14 +353,12 @@ ERROR_PARAMETER_USER_ID_NOT_SET=Fehler: Benutzer-Id nicht gesetzt (Parameter: us ERROR_USER_NOT_FOUND=Fehler: Benutzereintrag nicht gefunden. ADMIN_TABLE_SUMMARY_SHOW_USER_DATA=Diese Tabelle zeigt ein Benutzerprofil f\u00fcr administrative Zwecke an. ADMIN_SHOW_USER_HEADER=Benutzer {0} (Nummer {1}): -ADMIN_USER_ID=Benutzer-Id: -ADMIN_USER_NAME=Benutzername: ADMIN_USER_CREATED=Wann Benutzer erstellt: ADMIN_USER_UPDATED=Wann Benutzerdaten ge\u00e4ndert: ADMIN_USER_ACCOUNT_STATUS=Account-Status: ADMIN_USER_PROFILE_MODE=Profilmodus: -ADMIN_USER_LAST_LOCKED=Zuletzt gesperrt: -ADMIN_USER_LAST_LOCKED_REASON=Letzter Sperrgrund: +DATA_USER_LAST_LOCKED=Zuletzt gesperrt: +DATA_USER_LAST_LOCKED_REASON=Letzter Sperrgrund: ADMIN_CONTACT_IS_OWN_CONTACT=Eigenes Account: ADMIN_CONTACT_PERSONAL_TITLE=Anrede: ADMIN_CONTACT_ACADEMIC_TITLE=Akademischer Titel: diff --git a/src/java/org/mxchange/localization/generic_en_US.properties b/src/java/org/mxchange/localization/generic_en_US.properties index 2997970b..91dab17d 100644 --- a/src/java/org/mxchange/localization/generic_en_US.properties +++ b/src/java/org/mxchange/localization/generic_en_US.properties @@ -313,8 +313,8 @@ ENTRY_UPDATED_HEADER=Updated: ADMIN_LINK_EDIT_DELETE_MOBILE_PROVIDER_TITLE=Edit or delete mobile provider ADMIN_USER_DATA_ENTER_PASSWORD=Enter password: ADMIN_USER_DATA_ENTER_PASSWORD_REPEAT=Repeat password: -ADMIN_LIST_USER_ID=User id: -ADMIN_LIST_USER_NAME=User name: +DATA_USER_ID=User id: +DATA_USER_NAME=User name: ADMIN_LIST_USER_PERSONAL_TITLE=Gender: ADMIN_LIST_USER_FIRST_NAME=First name: ADMIN_LIST_USER_FAMILY_NAME=Family name: @@ -331,14 +331,12 @@ ERROR_PARAMETER_USER_ID_NOT_SET=Error: User id not set (parameter userId). ERROR_USER_NOT_FOUND=Error: User entry not found. ADMIN_TABLE_SUMMARY_SHOW_USER_DATA=This table shows a single user profile for administrative purposes. ADMIN_SHOW_USER_HEADER=User {0} (id {1}): -ADMIN_USER_ID=User id: -ADMIN_USER_NAME=User name: ADMIN_USER_CREATED=When user created: ADMIN_USER_UPDATED=When user data updated: ADMIN_USER_ACCOUNT_STATUS=Account status: ADMIN_USER_PROFILE_MODE=Profile mode: -ADMIN_USER_LAST_LOCKED=Last locked: -ADMIN_USER_LAST_LOCKED_REASON=Last lock reason: +DATA_USER_LAST_LOCKED=Last locked: +DATA_USER_LAST_LOCKED_REASON=Last lock reason: ADMIN_CONTACT_IS_OWN_CONTACT=Own account: ADMIN_CONTACT_PERSONAL_TITLE=Gender: ADMIN_CONTACT_ACADEMIC_TITLE=Academic title: @@ -1125,3 +1123,4 @@ BARCODE=Barcode: ADMIN_CONTACT_DETAILS_HEADER=Contact data of {0} {1} {2}: ADMIN_DEPARTMENT_DETAILS_HEADER=Data of department {0} (Id {1}): ADMIN_HEADQUARTER_DETAILS_HEADER=Headquarter of {0} (Id {1})): +CHANGE=Change? diff --git a/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl b/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl index 126dbca0..f919ad5d 100644 --- a/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl +++ b/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl @@ -89,7 +89,7 @@ - + - + @@ -65,7 +65,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl b/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl index 367fd341..23db73bd 100644 --- a/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl +++ b/web/WEB-INF/templates/admin/user/admin_show_user_data_mini.tpl @@ -23,7 +23,7 @@ - + - + diff --git a/web/admin/basic_data/admin_basic_data_list.xhtml b/web/admin/basic_data/admin_basic_data_list.xhtml index 7eca15cf..71952482 100644 --- a/web/admin/basic_data/admin_basic_data_list.xhtml +++ b/web/admin/basic_data/admin_basic_data_list.xhtml @@ -234,7 +234,7 @@ - + - + diff --git a/web/admin/user/admin_user_export.xhtml b/web/admin/user/admin_user_export.xhtml index 3b845988..6a8bb38d 100644 --- a/web/admin/user/admin_user_export.xhtml +++ b/web/admin/user/admin_user_export.xhtml @@ -22,7 +22,7 @@ - - + + - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + - + + + + + + + @@ -194,6 +267,33 @@ + + + + + + + + + + + + + + + + diff --git a/web/admin/user/admin_user_unlock.xhtml b/web/admin/user/admin_user_unlock.xhtml index 3cee469f..0958cd5f 100644 --- a/web/admin/user/admin_user_unlock.xhtml +++ b/web/admin/user/admin_user_unlock.xhtml @@ -84,7 +84,7 @@

- +
@@ -96,7 +96,7 @@
- +
diff --git a/web/guest/user/user_list.xhtml b/web/guest/user/user_list.xhtml index 5222b035..66a2339d 100644 --- a/web/guest/user/user_list.xhtml +++ b/web/guest/user/user_list.xhtml @@ -32,7 +32,7 @@