]> git.mxchange.org Git - jfinancials-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 17 Apr 2020 14:54:20 +0000 (16:54 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 17 Apr 2020 14:54:20 +0000 (16:54 +0200)
- heavy rewrite on (almost?) all admin-list-foo views, to use @ViewScoped beans
  and working JSR107 caching
- also sorted out mixed usage of userController (or so?) as the login and
  register backing beans can surely have their own properties
- rewrote web/WEB-INF/resources/tags/admin/dropdown/ to have it included back
  in views again, was a bad idea

Signed-off-by: Roland Häder <roland@mxchange.org>
123 files changed:
src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/business/branchoffice/list/FinancialsBranchOfficeListWebViewController.java
src/java/org/mxchange/jfinancials/beans/business/department/list/FinancialsDepartmentListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestController.java
src/java/org/mxchange/jfinancials/beans/business/employee/list/FinancialsEmployeeListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/business/employee/list/FinancialsEmployeeListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/business/headquarter/list/FinancialsHeadquarterListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestController.java
src/java/org/mxchange/jfinancials/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestController.java
src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java
src/java/org/mxchange/jfinancials/beans/contact/list/FinancialsContactListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsContactMobileWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsContactMobileWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/country/list/FinancialsCountryListWebViewBean.java
src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java
src/java/org/mxchange/jfinancials/beans/mobile/FinancialsAdminMobileWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/mobile/FinancialsAdminMobileWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/mobile/list/FinancialsMobileListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/mobile/list/FinancialsMobileListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestController.java
src/java/org/mxchange/jfinancials/beans/mobileprovider/list/FinancialsMobileProviderListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/mobileprovider/list/FinancialsMobileProviderListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java
src/java/org/mxchange/jfinancials/beans/phone/list/FinancialsPhoneListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/phone/list/FinancialsPhoneListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java
src/java/org/mxchange/jfinancials/beans/user/action/FinancialsUserActionWebRequestBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/user/action/FinancialsUserActionWebRequestController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/email_address/list/FinancialsEmailChangeListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/user/email_address/list/FinancialsEmailChangeListWebViewController.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewBean.java [new file with mode: 0644]
src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewtBean.java [deleted file]
src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java
src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java
src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java
src/java/org/mxchange/jfinancials/converter/business/employee/FinancialsEmployeeConverter.java
src/java/org/mxchange/jfinancials/converter/business/opening_time/FinancialsCompanyOpeningTimeConverter.java
src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java
src/java/org/mxchange/jfinancials/converter/landline/FinancialsLandLineNumberConverter.java
src/java/org/mxchange/jfinancials/converter/mobile/FinancialsMobileNumberConverter.java
src/java/org/mxchange/jfinancials/converter/mobileprovider/FinancialsMobileProviderConverter.java
src/java/org/mxchange/jfinancials/converter/user/FinancialsUserConverter.java
src/java/org/mxchange/jfinancials/validator/emailaddress/employee/FinancialsEmployeeEmailAddressValidator.java
src/java/org/mxchange/jfinancials/validator/user/FinancialsUserIdValidator.java
src/java/org/mxchange/localization/generic_de_DE.properties
src/java/org/mxchange/localization/generic_en_US.properties
web/WEB-INF/links.jsf.taglib.xml
web/WEB-INF/resources/tags/admin/columns/admin_contact_data_columns.tpl
web/WEB-INF/resources/tags/admin/dropdown/basic_data/admin_basic_data_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/branch_office/admin_branch_office_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/country/admin_country_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/department/admin_department_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/employee/admin_employee_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/fax/admin_fax_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/headquarter/admin_headquarter_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/landline/admin_landline_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/mobile/admin_mobile_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/mobile_provider/admin_mobile_provider_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/dropdown/opening_time/admin_opening_time_links.tpl [deleted file]
web/WEB-INF/resources/tags/admin/form_data/mobile/admin_edit_form_mobile_data.tpl
web/WEB-INF/resources/tags/admin/panel_grids/fax/admin_fax_data.tpl
web/WEB-INF/resources/tags/admin/panel_grids/landline/admin_landline_data.tpl
web/WEB-INF/resources/tags/admin/panel_grids/mobile/admin_mobile_data.tpl
web/WEB-INF/resources/tags/input/panel_grid/mobile_input_panel_grid.tpl
web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl [deleted file]
web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl
web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl
web/WEB-INF/templates/admin/department/admin_form_department_data.tpl
web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl
web/WEB-INF/templates/admin/fax/admin_form_add_contact_fax.tpl
web/WEB-INF/templates/admin/headquarter/admin_form_headquarter.tpl
web/WEB-INF/templates/admin/landline/admin_form_add_contact_landline.tpl
web/WEB-INF/templates/admin/mobile/admin_form_add_contact_mobile.tpl
web/WEB-INF/templates/contact/form_contact_data.tpl
web/WEB-INF/templates/guest/user/guest_login_form.tpl
web/WEB-INF/templates/guest/user/register/guest_form_register_page1.tpl
web/WEB-INF/templates/guest/user/register/guest_form_register_page2.tpl
web/WEB-INF/templates/guest/user/register/guest_form_register_single.tpl
web/WEB-INF/web.xml
web/WEB-INF/widgets.jsf.taglib.xml
web/admin/basic_data/admin_basic_data_list.xhtml
web/admin/branch_office/admin_branch_office_list.xhtml
web/admin/contact/admin_contact_export.xhtml
web/admin/contact/admin_contact_list.xhtml
web/admin/contact/unlink/admin_contact_mobile_unlink.xhtml
web/admin/country/admin_country_list.xhtml
web/admin/department/admin_department_list.xhtml
web/admin/employee/admin_employee_list.xhtml
web/admin/fax/admin_fax_list.xhtml
web/admin/fax/admin_fax_show.xhtml
web/admin/headquarter/admin_headquarter_list.xhtml
web/admin/landline/admin_landline_list.xhtml
web/admin/mobile/admin_contact_mobile_list.xhtml
web/admin/mobile/admin_mobile_edit.xhtml
web/admin/mobile/admin_mobile_list.xhtml
web/admin/mobile/admin_mobile_show.xhtml
web/admin/mobile_provider/admin_mobile_provider_list.xhtml
web/admin/opening_time/admin_opening_time_list.xhtml
web/admin/user/admin_user_export.xhtml
web/guest/user/user_profile.xhtml
web/user/login_user_change_personal_data.xhtml

index f281a4645304adc1c379fa2c4e628858dc0198ce..272f47fbcab9473f1d8f69f1dc05046a3fd65e6a 100644 (file)
@@ -198,7 +198,7 @@ public class FinancialsBasicDataListWebViewBean extends BaseFinancialsBean imple
                // Is cache there?
                if (!this.basicDataCache.iterator().hasNext()) {
                        // Add all
-                       for (final BasicData basicData : this.basicDataBean.allBusinessBasicData()) {
+                       for (final BasicData basicData : this.basicDataBean.fetchAllBusinessBasicData()) {
                                // Add it to cache
                                this.basicDataCache.put(basicData.getBasicDataId(), basicData);
                        }
index 34779f7b68992272c4236a4a1f983da1a7e844ec..65a8311a71d82cfa136ab31a5f9ac719b4adc0bf 100644 (file)
@@ -922,7 +922,7 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea
         */
        private boolean isBranchOfficeCreatedByRequiredData (final BranchOffice branchOffice) {
                // Get full list from other bean
-               final List<BranchOffice> branchOffices = this.branchOfficeListController.allBranchOffices();
+               final List<BranchOffice> branchOffices = this.branchOfficeListController.getAllBranchOffices();
 
                // Default is not found
                boolean isFound = false;
index 5d56953a570a2ba350950ce9ddb2b915cc4b42f2..6e8f32a4afd633a4b7391d5ef069e5fb5bddfc74 100644 (file)
@@ -115,13 +115,7 @@ public class FinancialsBranchOfficeListWebViewBean extends BaseFinancialsBean im
 
                // Add instance to cache
                this.branchOfficeCache.put(event.getBranchOffice().getBranchId(), event.getBranchOffice());
-               this.allBranchOffices.add(event.getBranchOffice());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<BranchOffice> allBranchOffices () {
-               return this.allBranchOffices;
+               this.getAllBranchOffices().add(event.getBranchOffice());
        }
 
        @Override
@@ -145,6 +139,12 @@ public class FinancialsBranchOfficeListWebViewBean extends BaseFinancialsBean im
                return branchOffice;
        }
 
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<BranchOffice> getAllBranchOffices () {
+               return this.allBranchOffices;
+       }
+
        /**
         * Getter for a list of filtered branch offices
         * <p>
@@ -191,22 +191,22 @@ public class FinancialsBranchOfficeListWebViewBean extends BaseFinancialsBean im
                // Is cache there?
                if (!this.branchOfficeCache.iterator().hasNext()) {
                        // Add all
-                       for (final BranchOffice branchOffice : this.branchOfficeBean.allBranchOffices()) {
+                       for (final BranchOffice branchOffice : this.branchOfficeBean.fetchAllBranchOffices()) {
                                // Add it to cache
                                this.branchOfficeCache.put(branchOffice.getBranchId(), branchOffice);
                        }
                }
 
                // Is the list empty, but filled cache?
-               if (this.allBranchOffices.isEmpty() && this.branchOfficeCache.iterator().hasNext()) {
+               if (this.getAllBranchOffices().isEmpty() && this.branchOfficeCache.iterator().hasNext()) {
                        // Build up list
                        for (final Cache.Entry<Long, BranchOffice> currentEntry : this.branchOfficeCache) {
                                // Add to list
-                               this.allBranchOffices.add(currentEntry.getValue());
+                               this.getAllBranchOffices().add(currentEntry.getValue());
                        }
 
                        // Sort list
-                       this.allBranchOffices.sort(new Comparator<BranchOffice>() {
+                       this.getAllBranchOffices().sort(new Comparator<BranchOffice>() {
                                @Override
                                public int compare (final BranchOffice branchOffice1, final BranchOffice branchOffice2) {
                                        return branchOffice1.getBranchId() > branchOffice2.getBranchId() ? 1 : branchOffice1.getBranchId() < branchOffice2.getBranchId() ? -1 : 0;
@@ -230,7 +230,7 @@ public class FinancialsBranchOfficeListWebViewBean extends BaseFinancialsBean im
                boolean isFound = false;
 
                // Check all entries
-               for (final BranchOffice branchOffice : this.allBranchOffices()) {
+               for (final BranchOffice branchOffice : this.getAllBranchOffices()) {
                        // Is email address used?
                        if (Objects.equals(branchOffice.getBranchEmailAddress(), emailAddress)) {
                                // Found it
index d9e0b91bb2b988b8af558b4903ab901156a5d382..6401b27ef600bda9cd53f81da8e4dd6f71e44223 100644 (file)
@@ -43,7 +43,7 @@ public interface FinancialsBranchOfficeListWebViewController extends Serializabl
         * <p>
         * @return A list of all branch offices
         */
-       List<BranchOffice> allBranchOffices ();
+       List<BranchOffice> getAllBranchOffices ();
 
        /**
         * Tries to find a branch office with given id number
index 30815f8631bb149978f4bff8d255cde475848935..dd4a6e535df9cfaa1851fc46a01978966c8efefd 100644 (file)
@@ -195,7 +195,7 @@ public class FinancialsDepartmentListWebViewBean extends BaseFinancialsBean impl
                // Is cache there?
                if (!this.departmentCache.iterator().hasNext()) {
                        // Add all
-                       for (final Department department : this.departmentBean.allDepartments()) {
+                       for (final Department department : this.departmentBean.fetchAllDepartments()) {
                                // Add it to cache
                                this.departmentCache.put(department.getDepartmentId(), department);
                        }
index a1c0afb6261173bb1998f767e9f6986c5a80a34d..17f337c421add3392daae07b906fdf4a5d229b0d 100644 (file)
@@ -40,6 +40,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jfinancials.beans.business.employee.list.FinancialsEmployeeListWebViewController;
 
 /**
  * A request-scoped bean for administrative purposes for administrative employee
@@ -69,6 +70,12 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im
        @EJB (lookup = "java:global/jfinancials-ejb/adminEmployee!org.mxchange.jcontactsbusiness.model.employee.AdminEmployeeSessionBeanRemote")
        private AdminEmployeeSessionBeanRemote adminEmployeeBean;
 
+       /**
+        * Administrative list-all-employees controller
+        */
+       @Inject
+       private FinancialsEmployeeListWebViewController adminEmployeeListController;
+
        /**
         * Assigned basic data instance
         */
@@ -429,7 +436,7 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im
                boolean isFound = false;
 
                // Check all employees
-               for (final Employable otherEmployee : this.employeeController.allEmployees()) {
+               for (final Employable otherEmployee : this.adminEmployeeListController.getAllEmployees()) {
                        // Is same found?
                        if (Employees.isSameEmployeeFound(employee, otherEmployee)) {
                                // Okay, found it
index 2dbc4548c5f461683066727099fbef3d5a2e0753..7bdca52ee60e15f1f5f175c7b09ff73cd0ef1f48 100644 (file)
  */
 package org.mxchange.jfinancials.beans.business.employee;
 
-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.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 
 /**
@@ -49,171 +34,12 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme
         */
        private static final long serialVersionUID = 12_886_968_547_361L;
 
-       /**
-        * List of all employees
-        */
-       private final List<Employable> allEmployees;
-
-       /**
-        * EJB for general company employee purposes
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote")
-       private EmployeeSessionBeanRemote employeeBean;
-
-       /**
-        * List of all company employees
-        */
-       @Inject
-       @NamedCache (cacheName = "companyEmployeeCache")
-       private Cache<Long, Employable> employeeCache;
-
-       /**
-        * A list of filtered employees
-        */
-       private List<Employable> filteredEmployees;
-
        /**
         * Default constructor
         */
        public FinancialsEmployeeWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init list
-               this.allEmployees = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being fired when an employee has been added
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterEmployeeAddedEvent (@Observes final ObservableEmployeeAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getEmployee() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.employee is null"); //NOI18N
-               } else if (event.getEmployee().getEmployeeId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.employee.employeeId is null"); //NOI18N
-               } else if (event.getEmployee().getEmployeeId() < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("event.employee.employeeId={0} is invalid", event.getEmployee().getEmployeeId())); //NOI18N
-               }
-
-               // Add employee to cache and list
-               this.employeeCache.put(event.getEmployee().getEmployeeId(), event.getEmployee());
-               this.allEmployees.add(event.getEmployee());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Employable> allEmployees () {
-               return this.allEmployees;
-       }
-
-       @Override
-       public Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException {
-               // Validate parameter
-               if (null == employeeId) {
-                       // Throw NPE
-                       throw new NullPointerException("employeeId is null"); //NOI18N
-               } else if (employeeId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is invalid", employeeId)); //NOI18N
-               } else if (!this.employeeCache.containsKey(employeeId)) {
-                       // Not found
-                       throw new EmployeeNotFoundException(employeeId);
-               }
-
-               // Get it from cache
-               final Employable employee = this.employeeCache.get(employeeId);
-
-               // Return it
-               return employee;
-       }
-
-       /**
-        * Getter for filtered list of employees
-        * <p>
-        * @return Filtered list of employees
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<Employable> getFilteredEmployees () {
-               return this.filteredEmployees;
-       }
-
-       /**
-        * Getter for filtered list of employees
-        * <p>
-        * @param filteredEmployees Filtered list of employees
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredEmployees (final List<Employable> filteredEmployees) {
-               this.filteredEmployees = filteredEmployees;
-       }
-
-       /**
-        * Initialization method
-        */
-       @PostConstruct
-       public void init () {
-               // Is cache there?
-               if (!this.employeeCache.iterator().hasNext()) {
-                       // Add all
-                       for (final Employable employee : this.employeeBean.allEmployees()) {
-                               // Add it to cache
-                               this.employeeCache.put(employee.getEmployeeId(), employee);
-                       }
-               }
-
-               // Is cache filled and list is empty
-               if ((this.employeeCache.iterator().hasNext()) && (this.allEmployees.isEmpty())) {
-                       // Build up list
-                       for (final Cache.Entry<Long, Employable> currentEntry : this.employeeCache) {
-                               // Add to list
-                               this.allEmployees.add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.allEmployees.sort(new Comparator<Employable>() {
-                               @Override
-                               public int compare (final Employable employee1, final Employable employee2) {
-                                       return employee1.getEmployeeId() > employee2.getEmployeeId() ? 1 : employee1.getEmployeeId() < employee2.getEmployeeId() ? -1 : 0;
-                               }
-                       });
-               }
-       }
-
-       @Override
-       public Boolean isEmailAddressRegistered (final String emailAddress) {
-               // Validate parameter
-               if (null == emailAddress) {
-                       // Throw NPE
-                       throw new NullPointerException("emailAddress is null"); //NOI18N
-               } else if (emailAddress.isEmpty()) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
-               }
-
-               // Default is not found
-               boolean isFound = false;
-
-               // Check all entries
-               for (final Employable basicData : this.allEmployees()) {
-                       // Is email address used?
-                       if (Objects.equals(basicData.getEmployeeEmailAddress(), emailAddress)) {
-                               // Found it
-                               isFound = true;
-                               break;
-                       }
-               }
-
-               // Return flag
-               return isFound;
        }
 
 }
index e85589067abcedbaeb116d7e00f99afddbc663da..9605286f421425d64cd546115f8d62155e4ed3ab 100644 (file)
@@ -17,9 +17,6 @@
 package org.mxchange.jfinancials.beans.business.employee;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.employee.Employable;
 
 /**
  * An interface for request-scoped general company employee beans
@@ -28,31 +25,4 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable;
  */
 public interface FinancialsEmployeeWebRequestController extends Serializable {
 
-       /**
-        * Validates if given email address is already in use by an employee
-        * <p>
-        * @param emailAddress Email address to be validated
-        * <p>
-        * @return Whether the email address is already used
-        */
-       Boolean isEmailAddressRegistered (final String emailAddress);
-
-       /**
-        * Returns a list of all company employees
-        * <p>
-        * @return List of all company employees
-        */
-       List<Employable> allEmployees ();
-
-       /**
-        * Finds a company employee by given employee id
-        * <p>
-        * @param employeeId Employable id to find company employee instance for
-        * <p>
-        * @return Company employee instance
-        * <p>
-        * @throws EmployeeNotFoundException If the company employee was not found
-        */
-       Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException;
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/list/FinancialsEmployeeListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/employee/list/FinancialsEmployeeListWebViewBean.java
new file mode 100644 (file)
index 0000000..966e432
--- /dev/null
@@ -0,0 +1,243 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.business.employee.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.jcontactsbusiness.events.employee.added.ObservableEmployeeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+import org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+
+/**
+ * A view-scoped bean for listing purposes for e.g. administrative employee
+ * purposes.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("employeeListController")
+@ViewScoped
+public class FinancialsEmployeeListWebViewBean extends BaseFinancialsBean implements FinancialsEmployeeListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 12_886_968_547_362L;
+
+       /**
+        * List of all employees
+        */
+       private final List<Employable> allEmployees;
+
+       /**
+        * EJB for general company employee purposes
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/employee!org.mxchange.jcontactsbusiness.model.employee.EmployeeSessionBeanRemote")
+       private EmployeeSessionBeanRemote employeeBean;
+
+       /**
+        * List of all company employees
+        */
+       @Inject
+       @NamedCache (cacheName = "companyEmployeeCache")
+       private transient Cache<Long, Employable> employeeCache;
+
+       /**
+        * A list of filtered employees
+        */
+       private List<Employable> filteredEmployees;
+
+       /**
+        * Currently selected employee
+        */
+       private Employable selectedEmployee;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsEmployeeListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allEmployees = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when an employee has been added
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterEmployeeAddedEvent (@Observes final ObservableEmployeeAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getEmployee() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.employee is null"); //NOI18N
+               } else if (event.getEmployee().getEmployeeId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.employee.employeeId is null"); //NOI18N
+               } else if (event.getEmployee().getEmployeeId() < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("event.employee.employeeId={0} is invalid", event.getEmployee().getEmployeeId())); //NOI18N
+               }
+
+               // Add employee to cache and list
+               this.employeeCache.put(event.getEmployee().getEmployeeId(), event.getEmployee());
+               this.getAllEmployees().add(event.getEmployee());
+       }
+
+       @Override
+       public Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException {
+               // Validate parameter
+               if (null == employeeId) {
+                       // Throw NPE
+                       throw new NullPointerException("employeeId is null"); //NOI18N
+               } else if (employeeId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is invalid", employeeId)); //NOI18N
+               } else if (!this.employeeCache.containsKey(employeeId)) {
+                       // Not found
+                       throw new EmployeeNotFoundException(employeeId);
+               }
+
+               // Get it from cache
+               final Employable employee = this.employeeCache.get(employeeId);
+
+               // Return it
+               return employee;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Employable> getAllEmployees () {
+               return this.allEmployees;
+       }
+
+       /**
+        * Getter for filtered list of employees
+        * <p>
+        * @return Filtered list of employees
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<Employable> getFilteredEmployees () {
+               return this.filteredEmployees;
+       }
+
+       /**
+        * Getter for filtered list of employees
+        * <p>
+        * @param filteredEmployees Filtered list of employees
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredEmployees (final List<Employable> filteredEmployees) {
+               this.filteredEmployees = filteredEmployees;
+       }
+
+       /**
+        * Getter for currently selected employee
+        * <p>
+        * @return Currently selected employee
+        */
+       public Employable getSelectedEmployee () {
+               return this.selectedEmployee;
+       }
+
+       /**
+        * Setter for currently selected employee
+        * <p>
+        * @param selectedEmployee Currently selected employee
+        */
+       public void setSelectedEmployee (final Employable selectedEmployee) {
+               this.selectedEmployee = selectedEmployee;
+       }
+
+       /**
+        * Initialization method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.employeeCache.iterator().hasNext()) {
+                       // Add all
+                       for (final Employable employee : this.employeeBean.fetchAllEmployees()) {
+                               // Add it to cache
+                               this.employeeCache.put(employee.getEmployeeId(), employee);
+                       }
+               }
+
+               // Is cache filled and list is empty
+               if ((this.employeeCache.iterator().hasNext()) && (this.getAllEmployees().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, Employable> currentEntry : this.employeeCache) {
+                               // Add to list
+                               this.getAllEmployees().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllEmployees().sort(new Comparator<Employable>() {
+                               @Override
+                               public int compare (final Employable employee1, final Employable employee2) {
+                                       return employee1.getEmployeeId() > employee2.getEmployeeId() ? 1 : employee1.getEmployeeId() < employee2.getEmployeeId() ? -1 : 0;
+                               }
+                       });
+               }
+       }
+
+       @Override
+       public Boolean isEmailAddressRegistered (final String emailAddress) {
+               // Validate parameter
+               if (null == emailAddress) {
+                       // Throw NPE
+                       throw new NullPointerException("emailAddress is null"); //NOI18N
+               } else if (emailAddress.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("emailAddress is empty"); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Check all entries
+               for (final Employable basicData : this.getAllEmployees()) {
+                       // Is email address used?
+                       if (Objects.equals(basicData.getEmployeeEmailAddress(), emailAddress)) {
+                               // Found it
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/list/FinancialsEmployeeListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/business/employee/list/FinancialsEmployeeListWebViewController.java
new file mode 100644 (file)
index 0000000..306bb46
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.business.employee.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.employee.Employable;
+
+/**
+ * An interface for request-scoped administrative company employee beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsEmployeeListWebViewController extends Serializable {
+
+       /**
+        * Returns a list of all company employees
+        * <p>
+        * @return List of all company employees
+        */
+       List<Employable> getAllEmployees ();
+
+       /**
+        * Validates if given email address is already in use by an employee
+        * <p>
+        * @param emailAddress Email address to be validated
+        * <p>
+        * @return Whether the email address is already used
+        */
+       Boolean isEmailAddressRegistered (final String emailAddress);
+
+       /**
+        * Finds a company employee by given employee id
+        * <p>
+        * @param employeeId Employable id to find company employee instance for
+        * <p>
+        * @return Company employee instance
+        * <p>
+        * @throws EmployeeNotFoundException If the company employee was not found
+        */
+       Employable findEmployeeById (final Long employeeId) throws EmployeeNotFoundException;
+
+}
index e4f579d6465459ff1c83d89c326e432e70b2f432..93dac70198604b7f8cfb310d3e4a650a284de4a0 100644 (file)
@@ -192,7 +192,7 @@ public class FinancialsHeadquarterListWebViewBean extends BaseFinancialsBean imp
                // Is cache there?
                if (!this.headquarterCache.iterator().hasNext()) {
                        // Add all
-                       for (final Headquarter headquarter : this.headquarterBean.allHeadquarters()) {
+                       for (final Headquarter headquarter : this.headquarterBean.fetchAllHeadquarters()) {
                                // Add it to cache
                                this.headquarterCache.put(headquarter.getHeadquarterId(), headquarter);
                        }
index bcfcbabf8aadcd737f6944ce2cceae2150483fb6..bbdc934c5c4a543ae07f8869bdbbb30fdb4a63b8 100644 (file)
@@ -91,7 +91,7 @@ public class FinancialsAdminOpeningTimeWebRequestBean extends BaseFinancialsBean
         * method will validate if the openingTime's address is already registered
         * and if found, it will output a proper faces message.
         */
-       public void addOpeningTimes () {
+       public void addOpeningTime () {
                // Get instance
                final OpeningTime openingTime = this.createOpeningTimes();
 
index 5399bec3aae91509abeafca9266a1ba576f6a5ec..1d4c33b7482ff5cc89498869d77a18e08752a03d 100644 (file)
  */
 package org.mxchange.jfinancials.beans.business.opening_time;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontactsbusiness.events.opening_time.added.ObservableOpeningTimeAddedEvent;
-import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 
@@ -48,144 +36,18 @@ public class FinancialsOpeningTimeWebRequestBean extends BaseFinancialsBean impl
         */
        private static final long serialVersionUID = 5_028_697_360_462L;
 
-       /**
-        * A list of all opening times
-        */
-       private final List<OpeningTime> allOpeningTimes;
-
-       /**
-        * A list of filtered opening times
-        */
-       private List<OpeningTime> filteredOpeningTimes;
-
        /**
         * EJB for administrative purposes
         */
        @EJB (lookup = "java:global/jfinancials-ejb/openingTimes!org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote")
        private OpeningTimeSessionBeanRemote openingTimesBean;
 
-       /**
-        * A list of all opening times (globally)
-        */
-       @Inject
-       @NamedCache (cacheName = "openingTimesCache")
-       private Cache<Long, OpeningTime> openingTimesCache;
-
        /**
         * Default constructor
         */
        public FinancialsOpeningTimeWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init list
-               this.allOpeningTimes = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being thrown when a new opening time has been added
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterOpeningTimeAddedEvent (@Observes final ObservableOpeningTimeAddedEvent event) {
-               // Validate parameter
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null");
-               } else if (event.getOpeningTime() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.openingTime is null");
-               } else if (event.getOpeningTime().getOpeningId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("event.openingTime.openingId is null");
-               } else if (event.getOpeningTime().getOpeningId() < 1) {
-                       // Throw it again
-                       throw new NullPointerException(MessageFormat.format("event.openingTime.openingId={0} is invalid", event.getOpeningTime().getOpeningId()));
-               }
-
-               // Add to cache and list
-               this.openingTimesCache.put(event.getOpeningTime().getOpeningId(), event.getOpeningTime());
-               this.allOpeningTimes.add(event.getOpeningTime());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<OpeningTime> allOpeningTimes () {
-               return this.allOpeningTimes;
-       }
-
-       @Override
-       public OpeningTime findOpeningTimeById (final Long openingId) throws OpeningTimeNotFoundException {
-               // Validate parameter
-               if (null == openingId) {
-                       // Throw NPE
-                       throw new NullPointerException("openingId is null"); //NOI18N
-               } else if (openingId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("openingId=" + openingId + " is invalid"); //NOI18N
-               } else if (!this.openingTimesCache.containsKey(openingId)) {
-                       // Not found
-                       throw new OpeningTimeNotFoundException(openingId);
-               }
-
-               // Get it from cache
-               final OpeningTime opening = this.openingTimesCache.get(openingId);
-
-               // Return it
-               return opening;
-       }
-
-       /**
-        * Getter for a list of filtered opening times
-        * <p>
-        * @return Filtered opening times
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<OpeningTime> getFilteredOpeningTimes () {
-               return this.filteredOpeningTimes;
-       }
-
-       /**
-        * Setter for a list of filtered opening times
-        * <p>
-        * @param filteredOpeningTimes Filtered opening times
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredOpeningTimes (final List<OpeningTime> filteredOpeningTimes) {
-               this.filteredOpeningTimes = filteredOpeningTimes;
-       }
-
-       /**
-        * Initializer method
-        */
-       @PostConstruct
-       public void initializeList () {
-               // Is cache there?
-               if (!this.openingTimesCache.iterator().hasNext()) {
-                       // Add all
-                       for (final OpeningTime openingTime : this.openingTimesBean.allOpeningTimes()) {
-                               // Add it to cache
-                               this.openingTimesCache.put(openingTime.getOpeningId(), openingTime);
-                       }
-               }
-
-               // Is the list empty, but filled cache?
-               if (this.allOpeningTimes.isEmpty() && this.openingTimesCache.iterator().hasNext()) {
-                       // Build up list
-                       for (final Cache.Entry<Long, OpeningTime> currentEntry : this.openingTimesCache) {
-                               // Add to list
-                               this.allOpeningTimes.add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.allOpeningTimes.sort(new Comparator<OpeningTime>() {
-                               @Override
-                               public int compare (final OpeningTime openingTime1, final OpeningTime openingTime2) {
-                                       return openingTime1.getOpeningId() > openingTime2.getOpeningId() ? 1 : openingTime1.getOpeningId() < openingTime2.getOpeningId() ? -1 : 0;
-                               }
-                       }
-                       );
-               }
        }
 
 }
index a2eb53cf5bacfa026b49fae2f5bb22d4c9301865..0f312792f7df4d8c9eac5feec8017af095c04364 100644 (file)
@@ -17,9 +17,6 @@
 package org.mxchange.jfinancials.beans.business.opening_time;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
-import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
 
 /**
  * An interface for general opening times controller
@@ -28,24 +25,4 @@ import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
  */
 public interface FinancialsOpeningTimeWebRequestController extends Serializable {
 
-       /**
-        * Returns a list of all opening times
-        * <p>
-        * @return A list of all opening times
-        */
-       List<OpeningTime> allOpeningTimes ();
-
-       /**
-        * Retrieves a single company department entity for given id number or
-        * throws a proper exception if not found.
-        * <p>
-        * @param openingId Company department id to lookup
-        * <p>
-        * @return Company department instance
-        * <p>
-        * @throws OpeningTimeNotFoundException If the id number could not be looked
-        * up and solved into an entity
-        */
-       OpeningTime findOpeningTimeById (final Long openingId) throws OpeningTimeNotFoundException;
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewBean.java
new file mode 100644 (file)
index 0000000..d82c040
--- /dev/null
@@ -0,0 +1,218 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.business.opening_time.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontactsbusiness.events.opening_time.added.ObservableOpeningTimeAddedEvent;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+
+/**
+ * A general bean for opening times
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("openingTimeListController")
+@ViewScoped
+public class FinancialsOpeningTimeListWebViewBean extends BaseFinancialsBean implements FinancialsOpeningTimeListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 5_028_697_360_467L;
+
+       /**
+        * A list of all opening times
+        */
+       private final List<OpeningTime> allOpeningTimes;
+
+       /**
+        * A list of filtered opening times
+        */
+       private List<OpeningTime> filteredOpeningTimes;
+
+       /**
+        * EJB for administrative purposes
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/openingTimes!org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimeSessionBeanRemote")
+       private OpeningTimeSessionBeanRemote openingTimesBean;
+
+       /**
+        * A list of all opening times (globally)
+        */
+       @Inject
+       @NamedCache (cacheName = "openingTimesCache")
+       private transient Cache<Long, OpeningTime> openingTimesCache;
+
+       /**
+        * Selected opening-time instance
+        */
+       private OpeningTime selectedOpeningTime;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsOpeningTimeListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allOpeningTimes = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being thrown when a new opening time has been added
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterOpeningTimeAddedEvent (@Observes final ObservableOpeningTimeAddedEvent event) {
+               // Validate parameter
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null");
+               } else if (event.getOpeningTime() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.openingTime is null");
+               } else if (event.getOpeningTime().getOpeningTimeId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("event.openingTime.openingTimeId is null");
+               } else if (event.getOpeningTime().getOpeningTimeId() < 1) {
+                       // Throw it again
+                       throw new NullPointerException(MessageFormat.format("event.openingTime.openingTimeId={0} is invalid", event.getOpeningTime().getOpeningTimeId()));
+               }
+
+               // Add to cache and list
+               this.openingTimesCache.put(event.getOpeningTime().getOpeningTimeId(), event.getOpeningTime());
+               this.getAllOpeningTimes().add(event.getOpeningTime());
+       }
+
+       @Override
+       public OpeningTime findOpeningTimeById (final Long openingTimeId) throws OpeningTimeNotFoundException {
+               // Validate parameter
+               if (null == openingTimeId) {
+                       // Throw NPE
+                       throw new NullPointerException("openingTimeId is null"); //NOI18N
+               } else if (openingTimeId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("openingTimeId=" + openingTimeId + " is invalid"); //NOI18N
+               } else if (!this.openingTimesCache.containsKey(openingTimeId)) {
+                       // Not found
+                       throw new OpeningTimeNotFoundException(openingTimeId);
+               }
+
+               // Get it from cache
+               final OpeningTime opening = this.openingTimesCache.get(openingTimeId);
+
+               // Return it
+               return opening;
+       }
+
+       /**
+        * Returns a list of all opening times
+        * <p>
+        * @return A list of all opening times
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getAllOpeningTimes () {
+               return this.allOpeningTimes;
+       }
+
+       /**
+        * Getter for a list of filtered opening times
+        * <p>
+        * @return Filtered opening times
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<OpeningTime> getFilteredOpeningTimes () {
+               return this.filteredOpeningTimes;
+       }
+
+       /**
+        * Setter for a list of filtered opening times
+        * <p>
+        * @param filteredOpeningTimes Filtered opening times
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredOpeningTimes (final List<OpeningTime> filteredOpeningTimes) {
+               this.filteredOpeningTimes = filteredOpeningTimes;
+       }
+
+       /**
+        * Getter for selected open-time instance
+        * <p>
+        * @return Selected open-time instance
+        */
+       public OpeningTime getSelectedOpeningTime () {
+               return this.selectedOpeningTime;
+       }
+
+       /**
+        * Setter for selected open-time instance
+        * <p>
+        * @param selectedOpeningTime Selected open-time instance
+        */
+       public void setSelectedOpeningTime (final OpeningTime selectedOpeningTime) {
+               this.selectedOpeningTime = selectedOpeningTime;
+       }
+
+       /**
+        * Initializer method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.openingTimesCache.iterator().hasNext()) {
+                       // Add all
+                       for (final OpeningTime openingTime : this.openingTimesBean.fetchAllOpeningTimes()) {
+                               // Add it to cache
+                               this.openingTimesCache.put(openingTime.getOpeningTimeId(), openingTime);
+                       }
+               }
+
+               // Is the list empty, but filled cache?
+               if (this.getAllOpeningTimes().isEmpty() && this.openingTimesCache.iterator().hasNext()) {
+                       // Build up list
+                       for (final Cache.Entry<Long, OpeningTime> currentEntry : this.openingTimesCache) {
+                               // Add to list
+                               this.getAllOpeningTimes().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllOpeningTimes().sort(new Comparator<OpeningTime>() {
+                               @Override
+                               public int compare (final OpeningTime openingTime1, final OpeningTime openingTime2) {
+                                       return openingTime1.getOpeningTimeId() > openingTime2.getOpeningTimeId() ? 1 : openingTime1.getOpeningTimeId() < openingTime2.getOpeningTimeId() ? -1 : 0;
+                               }
+                       }
+                       );
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/list/FinancialsOpeningTimeListWebViewController.java
new file mode 100644 (file)
index 0000000..cadae50
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2017 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.business.opening_time.list;
+
+import java.io.Serializable;
+import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
+import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
+
+/**
+ * An interface for general opening times controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsOpeningTimeListWebViewController extends Serializable {
+
+       /**
+        * Retrieves a single opening-time entity for given id number or throws a
+        * proper exception if not found.
+        * <p>
+        * @param openingTimeId Opening time id to lookup
+        * <p>
+        * @return Company department instance
+        * <p>
+        * @throws OpeningTimeNotFoundException If the id number could not be looked
+        * up and solved into an entity
+        */
+       OpeningTime findOpeningTimeById (final Long openingTimeId) throws OpeningTimeNotFoundException;
+
+}
index 0860406914b5fa4486232d071f0c2b3202b33234..01d2e2c847887ea715117e24c071b2eb39175e20 100644 (file)
@@ -342,9 +342,9 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp
                // Is the cell phone set?
                if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
                        // ... cmobile data
-                       this.setMobileId(contact.getContactMobileNumber().getPhoneId());
+                       this.setMobileId(contact.getContactMobileNumber().getMobileId());
                        this.setMobileProvider(contact.getContactMobileNumber().getMobileProvider());
-                       this.setMobileNumber(contact.getContactMobileNumber().getPhoneNumber());
+                       this.setMobileNumber(contact.getContactMobileNumber().getMobileNumber());
                }
 
                // Is the fax set?
@@ -397,13 +397,8 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp
                // Create new instance
                final Contact contact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
 
-               // Is contact id set?
-               if (this.getContactId() instanceof Long) {
-                       // Set it, too
-                       contact.setContactId(this.getContactId());
-               }
-
                // Add all others
+               contact.setContactId(this.getContactId());
                contact.setContactTitle(this.getAcademicTitle());
                contact.setContactBirthday(this.getBirthday());
                contact.setContactStreet(this.getStreet());
@@ -463,10 +458,10 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp
                // Is the provider set?
                if ((mobile instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
                        // Is the number set?
-                       if (mobile.getPhoneNumber() == null) {
+                       if (mobile.getMobileNumber() == null) {
                                // Is null
                                throw new NullPointerException("cmobile.phoneNumber is null"); //NOI18N
-                       } else if (mobile.getPhoneNumber() < 1) {
+                       } else if (mobile.getMobileNumber() < 1) {
                                // Abort here
                                throw new IllegalArgumentException("cmobile.phoneNumber is zero or below."); //NOI18N
                        }
@@ -530,7 +525,7 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp
                                         "%s%d%d", //NOI18N
                                         mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
                                         mobileNumber.getMobileProvider().getProviderDialPrefix(),
-                                        mobileNumber.getPhoneNumber()
+                                        mobileNumber.getMobileNumber()
                         );
 
                // Return it
@@ -679,12 +674,6 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp
                return "admin"; //NOI18N
        }
 
-       @Override
-       @Deprecated
-       public void setControllerType (final String controllerType) {
-               throw new UnsupportedOperationException("Setting controller type is not supported."); //NOI18N
-       }
-
        /**
         * Getter for email address
         * <p>
index f5a6e4b8731141ee7d3a3f56e3a4a8fe54d420d1..2b86bce83c76655502825e56830ff7bc78e5e556 100644 (file)
@@ -45,14 +45,4 @@ public interface FinancialsAdminContactWebRequestController extends Serializable
         */
        String getControllerType ();
 
-       /**
-        * Setter for controller type
-        * <p>
-        * @param controllerType Controller type
-        * <p>
-        * @deprecated Don't use this method
-        */
-       @Deprecated
-       void setControllerType (final String controllerType);
-
 }
index bf31d213dc35457bb3976e33fe0cc2ce55de270c..51bdd48255d2d27e0f79dd70c5781ab7ccf8c8d5 100644 (file)
@@ -44,6 +44,7 @@ import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
+import org.mxchange.jusercore.events.user.update.pre.ObservablePreUserPersonalDataUpdatedEvent;
 import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
 import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
 
@@ -142,21 +143,6 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
         */
        private String houseNumberExtension;
 
-       /**
-        * Whether a fax entry has been unlinked
-        */
-       private boolean isFaxUnlinked;
-
-       /**
-        * Whether a land-line number has been unlinked
-        */
-       private boolean isLandLineUnlinked;
-
-       /**
-        * Whether a mobile entry has been unlinked
-        */
-       private boolean isMobileUnlinked;
-
        /**
         * Phone number area code
         */
@@ -287,7 +273,27 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
                }
 
                // Copy all data to this bean
-               this.copyContact(event.getLoggedInUser().getUserContact());
+               this.copyFromContact(event.getLoggedInUser().getUserContact());
+       }
+
+       /**
+        * Observes events being fired before an updated of personal data done by a
+        * user has started.
+        * <p>
+        * @param event Event being observed
+        */
+       public void beforeUserUpdatedPersonalDataEvent (@Observes final ObservablePreUserPersonalDataUpdatedEvent event) {
+               // Is the instance valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUpdatedUser() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event.updatedUser is null"); //NOI18N
+               }
+
+               // Set all
+               this.copyToContact(event.getUpdatedUser().getUserContact());
        }
 
        @Override
@@ -308,81 +314,14 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
                // Required personal data must be set
                assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
 
-               // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
-               DialableMobileNumber mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
-
                // Create new contact
-               Contact contact = new UserContact(this.getPersonalTitle(), this.getFirstName(), this.getFamilyName());
-               contact.setContactStreet(this.getStreet());
-               contact.setContactHouseNumber(this.getHouseNumber());
-               contact.setContactHouseNumberExtension(this.getHouseNumberExtension());
-               contact.setContactZipCode(this.getZipCode());
-               contact.setContactCity(this.getCity());
-               contact.setContactCountry(this.getCountry());
-               contact.setContactEmailAddress(this.getEmailAddress());
-               contact.setContactBirthday(this.getBirthday());
-               contact.setContactComment(this.getComment());
-
-               // Don't set null or wrong references
-               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
-                       // Now the number must be given
-                       if (phone.getPhoneAreaCode() == null) {
-                               // Is null
-                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
-                       } else if (phone.getPhoneAreaCode() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (phone.getPhoneNumber() == null) {
-                               // Is null
-                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
-                       } else if (phone.getPhoneNumber() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
-                       }
-
-                       // Set phone number
-                       contact.setContactLandLineNumber(phone);
-               }
-
-               // Don't set null or wrong references
-               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
-                       // Now the number must be given
-                       if (fax.getPhoneAreaCode() == null) {
-                               // Is null
-                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
-                       } else if (fax.getPhoneAreaCode() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
-                       } else if (fax.getPhoneNumber() == null) {
-                               // Is null
-                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
-                       } else if (fax.getPhoneNumber() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
-                       }
-
-                       // Set fax number
-                       contact.setContactFaxNumber(fax);
-               }
+               final Contact contact = new UserContact(
+                                         this.getPersonalTitle(),
+                                         this.getFirstName(),
+                                         this.getFamilyName()
+                         );
 
-               // Is the provider set?
-               if ((mobile instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
-                       // Is the number set?
-                       if (mobile.getPhoneNumber() == null) {
-                               // Is null
-                               throw new NullPointerException("mobile.phoneNumber is null"); //NOI18N
-                       } else if (mobile.getPhoneNumber() < 1) {
-                               // Abort here
-                               throw new IllegalArgumentException("mobile.phoneNumber is zero or below."); //NOI18N
-                       }
-
-                       // Set mobile number
-                       contact.setContactMobileNumber(mobile);
-               }
-
-               // Return it
+               // Return instance
                return contact;
        }
 
@@ -402,7 +341,7 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
                }
 
                // Get contact instance
-               Contact contact = this.userLoginController.getLoggedInUser().getUserContact();
+               final Contact contact = this.userLoginController.getLoggedInUser().getUserContact();
 
                // It should be there, so run some tests on it
                assert (contact instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
@@ -421,16 +360,16 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
                contact.setContactCountry(this.getCountry());
 
                // Update contact's mobile number
-               this.isMobileUnlinked = Contacts.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
+               final boolean isMobileUnlinked = Contacts.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber());
 
                // Update contact's land-line number
-               this.isLandLineUnlinked = Contacts.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               final boolean isLandLineUnlinked = Contacts.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
 
                // Update contact's fax number
-               this.isFaxUnlinked = Contacts.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+               final boolean isFaxUnlinked = Contacts.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Send it to the EJB
-               this.contactBean.updateContactData(contact, this.isMobileUnlinked, this.isLandLineUnlinked, this.isFaxUnlinked);
+               this.contactBean.updateContactData(contact, isMobileUnlinked, isLandLineUnlinked, isFaxUnlinked);
 
                // All fine
                return "contact_data_saved"; //NOI18N
@@ -909,24 +848,6 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
                return (Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat()));
        }
 
-       @Override
-       public void updateContactDataFromController (final Contact contact) {
-               // Is the instance valid?
-               if (null == contact) {
-                       // Throw NPE
-                       throw new NullPointerException("contact is null"); //NOI18N
-               } else if (contact.getContactId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("contact.contactId is null"); //NOI18N
-               } else if (contact.getContactId() < 1) {
-                       // Not valid id number
-                       throw new IllegalArgumentException(MessageFormat.format("contact.contactId={0} is not valid.", contact.getContactId())); //NOI18N
-               }
-
-               // Set all
-               this.copyContact(contact);
-       }
-
        /**
         * Clears this bean
         */
@@ -961,11 +882,11 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
        }
 
        /**
-        * Copies given contact into the controller
+        * Copies given contact data into the controller
         * <p>
         * @param contact Contact instance
         */
-       private void copyContact (final Contact contact) {
+       private void copyFromContact (final Contact contact) {
                // Copy all fields:
                // - base data
                this.setPersonalTitle(contact.getContactPersonalTitle());
@@ -983,26 +904,111 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen
                this.setComment(contact.getContactComment());
 
                // Get mobile, phone and fax instance
-               DialableMobileNumber mobile = contact.getContactMobileNumber();
-               DialableFaxNumber fax = contact.getContactFaxNumber();
-               DialableLandLineNumber phone = contact.getContactLandLineNumber();
+               final DialableFaxNumber fax = contact.getContactFaxNumber();
+               final DialableLandLineNumber landLine = contact.getContactLandLineNumber();
+               final DialableMobileNumber mobile = contact.getContactMobileNumber();
 
-               // - contact data
-               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneAreaCode() > 0)) {
-                       this.setLandLineCountry(phone.getPhoneCountry());
-                       this.setLandLineAreaCode(phone.getPhoneAreaCode());
-                       this.setLandLineNumber(phone.getPhoneNumber());
+               // Is a fax number set?
+               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
+                       // Copy elements
+                       this.setFaxCountry(fax.getPhoneCountry());
+                       this.setFaxAreaCode(fax.getPhoneAreaCode());
+                       this.setFaxNumber(fax.getPhoneNumber());
+               }
+
+               // Is a land-line number set?
+               if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneAreaCode() > 0)) {
+                       // Copy elements
+                       this.setLandLineCountry(landLine.getPhoneCountry());
+                       this.setLandLineAreaCode(landLine.getPhoneAreaCode());
+                       this.setLandLineNumber(landLine.getPhoneNumber());
                }
 
+               // Is a mobile number set?
                if ((mobile instanceof DialableMobileNumber) && (mobile.getMobileProvider() instanceof MobileProvider)) {
+                       // Copy elements
                        this.setMobileProvider(mobile.getMobileProvider());
-                       this.setMobileNumber(mobile.getPhoneNumber());
+                       this.setMobileNumber(mobile.getMobileNumber());
                }
+       }
 
-               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneAreaCode() > 0)) {
-                       this.setFaxCountry(fax.getPhoneCountry());
-                       this.setFaxAreaCode(fax.getPhoneAreaCode());
-                       this.setFaxNumber(fax.getPhoneNumber());
+       /**
+        * Copies all fields from this backing bean into given instance.
+        * <p>
+        * @param contact An instance of a Contact class
+        */
+       private void copyToContact (final Contact contact) {
+               // Set other elements
+               contact.setContactStreet(this.getStreet());
+               contact.setContactHouseNumber(this.getHouseNumber());
+               contact.setContactHouseNumberExtension(this.getHouseNumberExtension());
+               contact.setContactZipCode(this.getZipCode());
+               contact.setContactCity(this.getCity());
+               contact.setContactCountry(this.getCountry());
+               contact.setContactEmailAddress(this.getEmailAddress());
+               contact.setContactBirthday(this.getBirthday());
+               contact.setContactComment(this.getComment());
+
+               // Generate phone number
+               final DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber());
+               final DialableMobileNumber mobile = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+               final DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+
+               // Don't set null or wrong references
+               if ((landLine instanceof DialableLandLineNumber) && (landLine.getPhoneCountry() instanceof Country) && (this.getLandLineAreaCode() != null) && (this.getLandLineNumber() != null) && (this.getLandLineAreaCode() > 0) && (this.getLandLineNumber() > 0)) {
+                       // Now the number must be given
+                       if (landLine.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
+                       } else if (landLine.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (landLine.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
+                       } else if (landLine.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set phone number
+                       contact.setContactLandLineNumber(landLine);
+               }
+
+               // Don't set null or wrong references
+               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
+                       // Now the number must be given
+                       if (fax.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
+                       } else if (fax.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (fax.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
+                       } else if (fax.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set fax number
+                       contact.setContactFaxNumber(fax);
+               }
+
+               // Is the provider set?
+               if ((mobile instanceof DialableMobileNumber) && (this.getMobileProvider() instanceof MobileProvider) && (this.getMobileNumber() != null) && (this.getMobileNumber() > 0)) {
+                       // Is the number set?
+                       if (mobile.getMobileNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("mobile.phoneNumber is null"); //NOI18N
+                       } else if (mobile.getMobileNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("mobile.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set mobile number
+                       contact.setContactMobileNumber(mobile);
                }
        }
 
index a164d11587294fcdcf864988cb1b2c0f6eb309ef..ee1144b8bd439a1989ea95efdb851c8112079b4c 100644 (file)
@@ -43,13 +43,6 @@ public interface FinancialsContactWebRequestController extends Serializable {
         */
        void clearEmailAddresses ();
 
-       /**
-        * Updates all data from bean in given contact instance
-        * <p>
-        * @param userContact Contact instance to update
-        */
-       void updateContactDataFromController (final Contact userContact);
-
        /**
         * Creates an instance from all properties
         * <p>
index 7b6079f1a6ce8cbdff9edbd90c849d8381ada88f..a37f175a644a16a8f40ca5a4b84f640724e6c99c 100644 (file)
@@ -31,6 +31,9 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote;
@@ -120,6 +123,108 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
                this.uniqueAddContact(event.getAddedContact());
        }
 
+       /**
+        * Event observer for unlinked fax contact by administrators
+        * <p>
+        * @param event Unlinked fax contact event
+        */
+       public void afterAdminUnlinkedFaxContactDataEvent (@Observes final ObservableAdminUnlinkedFaxNumberEvent 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.getUnlinkedFaxNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.unlinkedFaxNumber is null"); //NOI18N
+               } else if (event.getUnlinkedFaxNumber().getPhoneId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.unlinkedFaxNumber.contactId is null"); //NOI18N
+               } else if (event.getUnlinkedFaxNumber().getPhoneId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedFaxNumber(), event.getUnlinkedFaxNumber().getPhoneId())); //NOI18N
+               }
+
+               // Remove it from any entry
+               for (final Cache.Entry<Long, Contact> entry : this.contactCache) {
+                       // Get contact instance from it
+                       final Contact contact = entry.getValue();
+
+                       // Is the number matching?
+                       if (Objects.equals(event.getUnlinkedFaxNumber(), contact.getContactFaxNumber())) {
+                               // Yes, then unset it
+                               contact.setContactFaxNumber(null);
+                       }
+               }
+       }
+
+       /**
+        * Event observer for unlinked land-line contact by administrators
+        * <p>
+        * @param event Unlinked land-line contact event
+        */
+       public void afterAdminUnlinkedLandLineContactDataEvent (@Observes final ObservableAdminUnlinkedLandLineNumberEvent 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.getUnlinkedLandLineNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.unlinkedLandLineNumber is null"); //NOI18N
+               } else if (event.getUnlinkedLandLineNumber().getPhoneId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.unlinkedLandLineNumber.contactId is null"); //NOI18N
+               } else if (event.getUnlinkedLandLineNumber().getPhoneId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedLandLineNumber(), event.getUnlinkedLandLineNumber().getPhoneId())); //NOI18N
+               }
+
+               // Remove it from any entry
+               for (final Cache.Entry<Long, Contact> entry : this.contactCache) {
+                       // Get contact instance from it
+                       final Contact contact = entry.getValue();
+
+                       // Is the number matching?
+                       if (Objects.equals(event.getUnlinkedLandLineNumber(), contact.getContactLandLineNumber())) {
+                               // Yes, then unset it
+                               contact.setContactLandLineNumber(null);
+                       }
+               }
+       }
+
+       /**
+        * Event observer for unlinked mobile contact by administrators
+        * <p>
+        * @param event Unlinked mobile contact event
+        */
+       public void afterAdminUnlinkedMobileContactDataEvent (@Observes final ObservableAdminUnlinkedMobileNumberEvent 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.getUnlinkedMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.unlinkedMobileNumber is null"); //NOI18N
+               } else if (event.getUnlinkedMobileNumber().getMobileId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.unlinkedMobileNumber.contactId is null"); //NOI18N
+               } else if (event.getUnlinkedMobileNumber().getMobileId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedMobileNumber(), event.getUnlinkedMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Remove it from any entry
+               for (final Cache.Entry<Long, Contact> entry : this.contactCache) {
+                       // Get contact instance from it
+                       final Contact contact = entry.getValue();
+
+                       // Is the number matching?
+                       if (Objects.equals(event.getUnlinkedMobileNumber(), contact.getContactMobileNumber())) {
+                               // Yes, then unset it
+                               contact.setContactMobileNumber(null);
+                       }
+               }
+       }
+
        /**
         * Event observer for updated contact data by administrators
         * <p>
@@ -238,7 +343,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
                                         "%s%d%d", //NOI18N
                                         mobileNumber.getMobileProvider().getProviderCountry().getCountryExternalDialPrefix(),
                                         mobileNumber.getMobileProvider().getProviderDialPrefix(),
-                                        mobileNumber.getPhoneNumber()
+                                        mobileNumber.getMobileNumber()
                         );
 
                // Return it
@@ -324,7 +429,7 @@ public class FinancialsContactListWebViewBean extends BaseFinancialsBean impleme
                // Is cache there?
                if (!this.contactCache.iterator().hasNext()) {
                        // Add all
-                       for (final Contact contact : this.contactBean.allContacts()) {
+                       for (final Contact contact : this.contactBean.fetchAllContacts()) {
                                // Add it to cache
                                this.contactCache.put(contact.getContactId(), contact);
                        }
diff --git a/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestBean.java
new file mode 100644 (file)
index 0000000..bde080e
--- /dev/null
@@ -0,0 +1,531 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.contact.mobile;
+
+import java.text.MessageFormat;
+import java.util.Date;
+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.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
+import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController;
+import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
+import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+
+/**
+ * An administrative contact mobile controller (bean)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminContactMobileController")
+@RequestScoped
+public class FinancialsAdminContactMobileWebRequestBean extends BaseFinancialsBean implements FinancialsAdminContactMobileWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_919L;
+
+       /**
+        * Administrative EJB for phone number
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/adminContactPhone!org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote")
+       private AdminContactsPhoneSessionBeanRemote adminContactPhoneBean;
+
+       /**
+        * Event being fired when a mobile number has been linked
+        */
+       @Inject
+       @Any
+       private Event<ObservableAdminLinkedMobileNumberEvent> adminLinkedMobileNumberEvent;
+
+       /**
+        * Administrative phone controller
+        */
+       @Inject
+       private FinancialsAdminPhoneWebRequestController adminPhoneController;
+
+       /**
+        * Contact instance
+        */
+       private Contact contact;
+
+       /**
+        * When mobile number has been created
+        */
+       private Date mobileEntryCreated;
+
+       /**
+        * When mobile number has been updated
+        */
+       private Date mobileEntryUpdated;
+
+       /**
+        * Phone id (primary key)
+        */
+       private Long mobileId;
+
+       /**
+        * Mobile number
+        */
+       private Long mobileNumber;
+
+       /**
+        * Event being fired when administrator unlinks mobile from contact
+        */
+       @Inject
+       @Any
+       private Event<ObservableAdminUnlinkedMobileNumberEvent> mobileNumberUnlinkedEvent;
+
+       /**
+        * Mobile provider
+        */
+       private MobileProvider mobileProvider;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsAdminContactMobileWebRequestBean () {
+               // Call super constructor
+               super();
+
+               // String caller = MessageFormat.format("{0}.{1}", Thread.currentThread().getStackTrace()[3].getClassName(), Thread.currentThread().getStackTrace()[3].getMethodName());
+               // System.out.println(MessageFormat.format("{0}: Constructed, caller: {1}", this.getClass().getSimpleName(), caller));
+       }
+
+       /**
+        * Observes events being fired when an administrator has added a new
+        * contact.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+               // The event must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedContact is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+               }
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Event observer for newly added users by administrator
+        * <p>
+        * @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
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Event observer for updated contact data by administrators
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent 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.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observer for events being fired when a bean helper has successfully
+        * created a contact instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedContactEvent (@Observes final ObservableCreatedContactEvent event) {
+               // Log message
+               //* NOISY-DEBUG: */ System.out.println(MessageFormat.format("AdminContactController::afterCreatedContactEvent(): contact={0} - CALLED!", contact)); //NOI18N
+
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE again
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getCreatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdContact is null"); //NOI18N //NOI18N
+               } else if (event.getCreatedContact().getContactId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdContact.contactId is null"); //NOI18N //NOI18N
+               } else if (event.getCreatedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalStateException(MessageFormat.format("event.createdContact.contactId={0} is not valid.", event.getCreatedContact().getContactId())); //NOI18N
+               }
+
+               // Set it here
+               this.setContact(event.getCreatedContact());
+       }
+
+       /**
+        * Observes events being fired when a bean helper has successfully created a
+        * mobile number instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() == null) {
+                       // Throw NPE yet again
+                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() < 1) {
+                       // Throw NPE yet again
+                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Get fax number from event
+               final DialableMobileNumber number = event.getMobileNumber();
+
+               // Copy all data to this bean
+               this.setMobileId(number.getMobileId());
+               this.setMobileProvider(number.getMobileProvider());
+               this.setMobileNumber(number.getMobileNumber());
+               this.setMobileEntryCreated(number.getMobileEntryCreated());
+               this.setMobileEntryUpdated(number.getMobileEntryUpdated());
+       }
+
+       /**
+        * Links mobile number to contact from bean helper as "main mobile number".
+        * <p>
+        * @return Redirect outcome
+        */
+       public String doLinkMainMobileNumber () {
+               // Get contact from helper
+               final Contact targetContact = this.getContact();
+
+               // Is all data properly set?
+               if (null == targetContact) {
+                       // Throw NPE
+                       throw new NullPointerException("targetContact is null"); //NOI18N
+               } else if (targetContact.getContactId() == null) {
+                       // Throw it again
+                       throw new NullPointerException("targetContact.contactId is null"); //NOI18N
+               } else if (targetContact.getContactId() < 1) {
+                       // Is not valid
+                       throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
+               } else if (this.getMobileProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.mobileProvider is null"); //NOI18N
+               } else if (this.getMobileProvider().getProviderId() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
+               } else if (this.getMobileProvider().getProviderId() < 1) {
+                       // Throw NPE
+                       throw new NullPointerException(MessageFormat.format("this.mobileProvider.providerId={0} is invalid", this.getMobileProvider().getProviderId())); //NOI18N
+               } else if (this.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.mobileNumber is null"); //NOI18N
+               } else if (this.getMobileNumber() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber={0} is invalid", this.getMobileNumber())); //NOI18N
+               }
+
+               // Init instance
+               final Contact updatedContact;
+               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+               // Try it again
+               try {
+                       // Link it, too
+                       updatedContact = this.adminContactPhoneBean.linkNewMobileNumberWithContact(targetContact, number);
+               } catch (final PhoneNumberAlreadyLinkedException ex) {
+                       // Throw again as cause
+                       this.showFacesMessage("form_add_contact_mobile:mobileNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
+                       return ""; //NOI18N
+               }
+
+               // Fire event
+               this.adminLinkedMobileNumberEvent.fire(new AdminLinkedMobileNumberEvent(updatedContact, number));
+
+               // Return to contact profile
+               return "admin_show_contact"; //NOI18N
+       }
+
+       /**
+        * Getter for contact instance
+        * <p>
+        * @return Contact instance
+        */
+       public Contact getContact () {
+               return this.contact;
+       }
+
+       /**
+        * Setter for contact instance
+        * <p>
+        * @param contact Contact instance
+        */
+       public void setContact (final Contact contact) {
+               this.contact = contact;
+       }
+
+       /**
+        * Setter for phone id
+        * <p>
+        * @return Phone id
+        */
+       public Long getMobileId () {
+               return this.mobileId;
+       }
+
+       /**
+        * Getter for phone id
+        * <p>
+        * @param mobileId Phone id
+        */
+       public void setMobileId (final Long mobileId) {
+               this.mobileId = mobileId;
+       }
+
+       /**
+        * Getter for mobile number
+        * <p>
+        * @return Mobile number
+        */
+       public Long getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       /**
+        * Setter for mobile number
+        * <p>
+        * @param mobileNumber Mobile number
+        */
+       public void setMobileNumber (final Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       /**
+        * Getter for mobile provider
+        * <p>
+        * @return Mobile provider
+        */
+       public MobileProvider getMobileProvider () {
+               return this.mobileProvider;
+       }
+
+       /**
+        * Setter for mobile provider
+        * <p>
+        * @param mobileProvider Mobile provider
+        */
+       public void setMobileProvider (final MobileProvider mobileProvider) {
+               this.mobileProvider = mobileProvider;
+       }
+
+       /**
+        * Unlinks mobile data with current contact
+        * <p>
+        * @return Redirect outcome
+        */
+       public String unlinkMobileContactData () {
+               // Create fax number instance
+               final DialableMobileNumber number = this.createMobileNumber();
+
+               // Is all data set
+               if (number == null) {
+                       // Not set, throw NPE
+                       throw new NullPointerException("number is null"); //NOI18N
+               } else if (number.getMobileId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("number.phoneId is null"); //NOI18N
+               } else if (number.getMobileId() < 1) {
+                       // Invalid number
+                       throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getMobileId())); //NOI18N
+               } else if (number.getMobileProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("number.mobileProvider is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("number.mobileProvider.providerId is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() < 1) {
+                       // Id not valid
+                       throw new IllegalArgumentException(MessageFormat.format("number.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+               } else if (number.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("number.phoneNumber is null"); //NOI18N
+               } else if (number.getMobileNumber() < 1) {
+                       // Throw it again ...
+                       throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
+               } else if (this.getContact() == null) {
+                       // ... and throw again
+                       throw new NullPointerException("this.contact is null"); //NOI18N
+               } else if (this.getContact().getContactId() == null) {
+                       // ... and again ...
+                       throw new NullPointerException("this.contact.contactId is null"); //NOI18N
+               } else if (this.getContact().getContactId() < 1) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
+               }
+
+               // Init contact instance
+               final Contact updatedContact;
+
+               try {
+                       // Unlink it and return contact without mobile instance
+                       updatedContact = this.adminContactPhoneBean.unlinkMobileDataFromContact(this.getContact(), number);
+               } catch (final PhoneNumberNotLinkedException ex) {
+                       // Did not work
+                       this.showFacesMessage("form_unlink_contact_mobile:mobileNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
+                       return ""; //NOI18N
+               }
+
+               // Fire event
+               this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, number));
+
+               // All fine here
+               return "admin_show_contact"; //NOI18N
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all data
+       }
+
+       /**
+        * Returns an instance of a DialableMobileNumber from all fields stored in
+        * this bean.
+        * <p>
+        * @return An instance of a DialableMobileNumber class
+        */
+       private DialableMobileNumber createMobileNumber () {
+               // Initialize it
+               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+               // Add all other data
+               number.setMobileEntryCreated(this.getMobileEntryCreated());
+               number.setMobileEntryUpdated(this.getMobileEntryUpdated());
+
+               // Is id number set?
+               if (this.getMobileId() instanceof Long) {
+                       // Set it
+                       number.setMobileId(this.getMobileId());
+               }
+
+               // Return it
+               return number;
+       }
+
+       /**
+        * Getter for mobile entry created
+        * <p>
+        * @return Mobile entry created
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       private Date getMobileEntryCreated () {
+               return this.mobileEntryCreated;
+       }
+
+       /**
+        * Setter for mobile entry created
+        * <p>
+        * @param mobileEntryCreated Mobile entry created
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       private void setMobileEntryCreated (final Date mobileEntryCreated) {
+               this.mobileEntryCreated = mobileEntryCreated;
+       }
+
+       /**
+        * Getter for mobile entry updated
+        * <p>
+        * @return Mobile entry updated
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       private Date getMobileEntryUpdated () {
+               return this.mobileEntryUpdated;
+       }
+
+       /**
+        * Setter for mobile entry updated
+        * <p>
+        * @param mobileEntryUpdated Mobile entry updated
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       private void setMobileEntryUpdated (final Date mobileEntryUpdated) {
+               this.mobileEntryUpdated = mobileEntryUpdated;
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsAdminContactMobileWebRequestController.java
new file mode 100644 (file)
index 0000000..0e0f0b2
--- /dev/null
@@ -0,0 +1,30 @@
+
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.contact.mobile;
+
+import org.mxchange.jfinancials.beans.contact.phone.*;
+import java.io.Serializable;
+
+/**
+ * An interface for user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsAdminContactMobileWebRequestController extends Serializable {
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsContactMobileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsContactMobileWebRequestBean.java
new file mode 100644 (file)
index 0000000..a3ef276
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.contact.mobile;
+
+import java.text.MessageFormat;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.contact.list.FinancialsContactListWebViewController;
+import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+
+/**
+ * A general contact bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("contactMobileController")
+@RequestScoped
+public class FinancialsContactMobileWebRequestBean extends BaseFinancialsBean implements FinancialsContactMobileWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_916L;
+
+       /**
+        * An instance of a contact-list controller
+        */
+       @Inject
+       private FinancialsContactListWebViewController contactListController;
+
+       /**
+        * Chosen mobile number
+        */
+       private DialableMobileNumber mobileNumber;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsContactMobileWebRequestBean () {
+               // Call super constructor
+               super();
+       }
+
+       /**
+        * Observes events being fired when an administrator has added a new
+        * contact.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+               // The event must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedContact is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+               }
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Event observer for newly added users by administrator
+        * <p>
+        * @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
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Event observer for updated contact data by administrators
+        * <p>
+        * @param event Updated contact data event
+        */
+       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent 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.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when a bean helper has successfully created a
+        * mobile number instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() == null) {
+                       // Throw NPE yet again
+                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() < 1) {
+                       // Throw NPE yet again
+                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Set it here
+               this.setMobileNumber(event.getMobileNumber());
+       }
+
+       /**
+        * Getter for all contacts having current mobile number linked
+        * <p>
+        * @return List of all linked contacts
+        */
+       public List<Contact> allCurrentMobileNumberContacts () {
+               // Get id
+               final DialableMobileNumber dialableMobileNumber = this.getMobileNumber();
+
+               // Init list
+               final List<Contact> contacts = new LinkedList<>();
+
+               // "Walk" through all contacts
+               for (final Contact contact : this.contactListController.getAllContacts()) {
+                       // Is mobile instance the same?
+                       if (Objects.equals(contact.getContactMobileNumber(), dialableMobileNumber)) {
+                               // Found one
+                               contacts.add(contact);
+                       }
+               }
+
+               // Return now-cached list
+               return contacts;
+       }
+
+       /**
+        * Getter for chosen mobile number
+        * <p>
+        * @return mobile number
+        */
+       public DialableMobileNumber getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       /**
+        * Setter for chosen mobile number
+        * <p>
+        * @param mobileNumber mobile number
+        */
+       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all data
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsContactMobileWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/contact/mobile/FinancialsContactMobileWebRequestController.java
new file mode 100644 (file)
index 0000000..1501a46
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.contact.mobile;
+
+import org.mxchange.jfinancials.beans.contact.phone.*;
+import java.io.Serializable;
+
+/**
+ * An interface for user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsContactMobileWebRequestController extends Serializable {
+
+}
index ad5d0103ad401f1699429d6d256ef030e7bee6cc..549b7e5a84cc913877f45675015a17ea62971921 100644 (file)
@@ -37,10 +37,6 @@ import org.mxchange.jcontacts.events.landline.linked.AdminLinkedLandLineNumberEv
 import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.landline.unlinked.AdminUnlinkedLandLineNumberEvent;
 import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.linked.AdminLinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.AdminUnlinkedMobileNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.phone.AdminContactsPhoneSessionBeanRemote;
 import org.mxchange.jcountry.model.data.Country;
@@ -48,16 +44,12 @@ import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 import org.mxchange.jfinancials.beans.phone.FinancialsAdminPhoneWebRequestController;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
-import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
 import org.mxchange.jphone.exceptions.phone.PhoneNumberAlreadyLinkedException;
 import org.mxchange.jphone.exceptions.phone.PhoneNumberNotLinkedException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 
 /**
@@ -99,13 +91,6 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
        @Any
        private Event<ObservableAdminLinkedLandLineNumberEvent> adminLinkedLandLineNumberEvent;
 
-       /**
-        * Event being fired when a mobile number has been linked
-        */
-       @Inject
-       @Any
-       private Event<ObservableAdminLinkedMobileNumberEvent> adminLinkedMobileNumberEvent;
-
        /**
         * Administrative phone controller
         */
@@ -162,29 +147,12 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
        private Event<ObservableAdminUnlinkedLandLineNumberEvent> landLineNumberUnlinkedEvent;
 
        /**
-        * Mobile number
-        */
-       private Long mobileNumber;
-
-       /**
-        * Event being fired when administrator unlinks mobile from contact
-        */
-       @Inject
-       @Any
-       private Event<ObservableAdminUnlinkedMobileNumberEvent> mobileNumberUnlinkedEvent;
-
-       /**
-        * Mobile provider
-        */
-       private MobileProvider mobileProvider;
-
-       /**
-        * When fax number has been created
+        * When phone number has been created
         */
        private Date phoneEntryCreated;
 
        /**
-        * When fax number has been updated
+        * When phone number has been updated
         */
        private Date phoneEntryUpdated;
 
@@ -377,39 +345,6 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
                this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
        }
 
-       /**
-        * Observes events being fired when a bean helper has successfully created a
-        * mobile number instance.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
-               // The event instance must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
-               } else if (event.getMobileNumber().getPhoneId() == null) {
-                       // Throw NPE yet again
-                       throw new NullPointerException("event.mobileNumber.phoneId is null"); //NOI18N
-               } else if (event.getMobileNumber().getPhoneId() < 1) {
-                       // Throw NPE yet again
-                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.phoneId={0} is invalid", event.getMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Get fax number from event
-               final DialableMobileNumber number = event.getMobileNumber();
-
-               // Copy all data to this bean
-               this.setPhoneId(number.getPhoneId());
-               this.setMobileProvider(number.getMobileProvider());
-               this.setMobileNumber(number.getPhoneNumber());
-               this.setPhoneEntryCreated(number.getPhoneEntryCreated());
-               this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
-       }
-
        /**
         * Links fax number to contact from bean helper as "main fax number".
         * <p>
@@ -537,63 +472,6 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
                return "admin_show_contact"; //NOI18N
        }
 
-       /**
-        * Links mobile number to contact from bean helper as "main mobile number".
-        * <p>
-        * @return Redirect outcome
-        */
-       public String doLinkMainMobileNumber () {
-               // Get contact from helper
-               final Contact targetContact = this.getContact();
-
-               // Is all data properly set?
-               if (null == targetContact) {
-                       // Throw NPE
-                       throw new NullPointerException("targetContact is null"); //NOI18N
-               } else if (targetContact.getContactId() == null) {
-                       // Throw it again
-                       throw new NullPointerException("targetContact.contactId is null"); //NOI18N
-               } else if (targetContact.getContactId() < 1) {
-                       // Is not valid
-                       throw new IllegalArgumentException(MessageFormat.format("targetContact.contactId={0} is not valid", targetContact.getContactId())); //NOI18N
-               } else if (this.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.mobileProvider is null"); //NOI18N
-               } else if (this.getMobileProvider().getProviderId() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
-               } else if (this.getMobileProvider().getProviderId() < 1) {
-                       // Throw NPE
-                       throw new NullPointerException(MessageFormat.format("this.mobileProvider.providerId={0} is invalid", this.getMobileProvider().getProviderId())); //NOI18N
-               } else if (this.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.mobileNumber is null"); //NOI18N
-               } else if (this.getMobileNumber() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber={0} is invalid", this.getMobileNumber())); //NOI18N
-               }
-
-               // Init instance
-               final Contact updatedContact;
-               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-
-               // Try it again
-               try {
-                       // Link it, too
-                       updatedContact = this.adminContactPhoneBean.linkNewMobileNumberWithContact(targetContact, number);
-               } catch (final PhoneNumberAlreadyLinkedException ex) {
-                       // Throw again as cause
-                       this.showFacesMessage("form_add_contact_mobile:mobileNumber", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
-                       return ""; //NOI18N
-               }
-
-               // Fire event
-               this.adminLinkedMobileNumberEvent.fire(new AdminLinkedMobileNumberEvent(updatedContact, number));
-
-               // Return to contact profile
-               return "admin_show_contact"; //NOI18N
-       }
-
        /**
         * Getter for contact instance
         * <p>
@@ -720,42 +598,6 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
                this.landLineNumber = landLineNumber;
        }
 
-       /**
-        * Getter for mobile number
-        * <p>
-        * @return Mobile number
-        */
-       public Long getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       /**
-        * Setter for mobile number
-        * <p>
-        * @param mobileNumber Mobile number
-        */
-       public void setMobileNumber (final Long mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
-       /**
-        * Getter for mobile provider
-        * <p>
-        * @return Mobile provider
-        */
-       public MobileProvider getMobileProvider () {
-               return this.mobileProvider;
-       }
-
-       /**
-        * Setter for mobile provider
-        * <p>
-        * @param mobileProvider Mobile provider
-        */
-       public void setMobileProvider (final MobileProvider mobileProvider) {
-               this.mobileProvider = mobileProvider;
-       }
-
        /**
         * Setter for phone id
         * <p>
@@ -884,70 +726,6 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
                return "admin_show_contact"; //NOI18N
        }
 
-       /**
-        * Unlinks mobile data with current contact
-        * <p>
-        * @return Redirect outcome
-        */
-       public String unlinkMobileContactData () {
-               // Create fax number instance
-               final DialableMobileNumber number = this.createMobileNumber();
-
-               // Is all data set
-               if (number == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("number is null"); //NOI18N
-               } else if (number.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("number.phoneId is null"); //NOI18N
-               } else if (number.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("number.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
-               } else if (number.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("number.mobileProvider is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("number.mobileProvider.providerId is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("number.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
-               } else if (number.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("number.phoneNumber is null"); //NOI18N
-               } else if (number.getPhoneNumber() < 1) {
-                       // Throw it again ...
-                       throw new NullPointerException(MessageFormat.format("number.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
-               } else if (this.getContact() == null) {
-                       // ... and throw again
-                       throw new NullPointerException("this.contact is null"); //NOI18N
-               } else if (this.getContact().getContactId() == null) {
-                       // ... and again ...
-                       throw new NullPointerException("this.contact.contactId is null"); //NOI18N
-               } else if (this.getContact().getContactId() < 1) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.contact.contactId={0} is invalid.", this.getContact().getContactId())); //NOI18N
-               }
-
-               // Init contact instance
-               final Contact updatedContact;
-
-               try {
-                       // Unlink it and return contact without mobile instance
-                       updatedContact = this.adminContactPhoneBean.unlinkMobileDataFromContact(this.getContact(), number);
-               } catch (final PhoneNumberNotLinkedException ex) {
-                       // Did not work
-                       this.showFacesMessage("form_unlink_contact_mobile:mobileNumberId", ex, FacesMessage.SEVERITY_ERROR); //NOI18N
-                       return ""; //NOI18N
-               }
-
-               // Fire event
-               this.mobileNumberUnlinkedEvent.fire(new AdminUnlinkedMobileNumberEvent(updatedContact, number));
-
-               // All fine here
-               return "admin_show_contact"; //NOI18N
-       }
-
        /**
         * Clears this bean
         */
@@ -967,12 +745,7 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
                // Set all other fields
                number.setPhoneEntryCreated(this.getPhoneEntryCreated());
                number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
-
-               // Is id number there?
-               if (this.getPhoneId() instanceof Long) {
-                       // Set it
-                       number.setPhoneId(this.getPhoneId());
-               }
+               number.setPhoneId(this.getPhoneId());
 
                // Return it
                return number;
@@ -991,36 +764,7 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
                // Add all other data
                number.setPhoneEntryCreated(this.getPhoneEntryCreated());
                number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
-
-               // Is id number set?
-               if (this.getPhoneId() instanceof Long) {
-                       // Set it
-                       number.setPhoneId(this.getPhoneId());
-               }
-
-               // Return it
-               return number;
-       }
-
-       /**
-        * Returns an instance of a DialableMobileNumber from all fields stored in
-        * this bean.
-        * <p>
-        * @return An instance of a DialableMobileNumber class
-        */
-       private DialableMobileNumber createMobileNumber () {
-               // Initialize it
-               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
-
-               // Add all other data
-               number.setPhoneEntryCreated(this.getPhoneEntryCreated());
-               number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
-
-               // Is id number set?
-               if (this.getPhoneId() instanceof Long) {
-                       // Set it
-                       number.setPhoneId(this.getPhoneId());
-               }
+               number.setPhoneId(this.getPhoneId());
 
                // Return it
                return number;
@@ -1029,7 +773,7 @@ public class FinancialsAdminContactPhoneWebRequestBean extends BaseFinancialsBea
        /**
         * Getter for phone entry created
         * <p>
-        * @param faxNumberEntryCreated Phone entry created
+        * @return Phone entry created
         */
        @SuppressWarnings ("ReturnOfDateField")
        private Date getPhoneEntryCreated () {
index 48f48fef9e19bac1e87df770d11b4c644440fcbe..ec2780985a13cfdc1b33a47a2f637473535bcf22 100644 (file)
  */
 package org.mxchange.jfinancials.beans.contact.phone;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Objects;
-import javax.cache.Cache;
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.event.Observes;
 import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
 import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.events.fax.unlinked.ObservableAdminUnlinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.unlinked.ObservableAdminUnlinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.unlinked.ObservableAdminUnlinkedMobileNumberEvent;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 import org.mxchange.jfinancials.beans.contact.list.FinancialsContactListWebViewController;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.landline.created.ObservableCreatedLandLineNumberEvent;
-import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.model.phonenumbers.DialableNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 
 /**
@@ -63,15 +55,6 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp
        @Inject
        private FinancialsContactListWebViewController contactListController;
 
-       /**
-        * "Cache" for contact's mobile, land-line and fax numbers. Currently one
-        * per each type is supported. Maybe later this will change into a OneToMany
-        * relationship (one contact, many numbers).
-        */
-       @Inject
-       @NamedCache (cacheName = "contactsPhoneCache")
-       private Cache<DialableNumber, List<Contact>> contactsPhoneCache;
-
        /**
         * fax number
         */
@@ -82,11 +65,6 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp
         */
        private DialableLandLineNumber landLineNumber;
 
-       /**
-        * Chosen mobile number
-        */
-       private DialableMobileNumber mobileNumber;
-
        /**
         * Default constructor
         */
@@ -146,90 +124,6 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp
                this.clear();
        }
 
-       /**
-        * Event observer for unlinked fax contact by administrators
-        * <p>
-        * @param event Unlinked fax contact event
-        */
-       public void afterAdminUnlinkedFaxContactDataEvent (@Observes final ObservableAdminUnlinkedFaxNumberEvent 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.getUnlinkedFaxNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.unlinkedFaxNumber is null"); //NOI18N
-               } else if (event.getUnlinkedFaxNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.unlinkedFaxNumber.contactId is null"); //NOI18N
-               } else if (event.getUnlinkedFaxNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedFaxNumber(), event.getUnlinkedFaxNumber().getPhoneId())); //NOI18N
-               }
-
-               // Remove it from list
-               this.contactsPhoneCache.remove(event.getUnlinkedFaxNumber());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Event observer for unlinked land-line contact by administrators
-        * <p>
-        * @param event Unlinked land-line contact event
-        */
-       public void afterAdminUnlinkedLandLineContactDataEvent (@Observes final ObservableAdminUnlinkedLandLineNumberEvent 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.getUnlinkedLandLineNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.unlinkedLandLineNumber is null"); //NOI18N
-               } else if (event.getUnlinkedLandLineNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.unlinkedLandLineNumber.contactId is null"); //NOI18N
-               } else if (event.getUnlinkedLandLineNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedLandLineNumber(), event.getUnlinkedLandLineNumber().getPhoneId())); //NOI18N
-               }
-
-               // Remove it from list
-               this.contactsPhoneCache.remove(event.getUnlinkedLandLineNumber());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Event observer for unlinked mobile contact by administrators
-        * <p>
-        * @param event Unlinked mobile contact event
-        */
-       public void afterAdminUnlinkedMobileContactDataEvent (@Observes final ObservableAdminUnlinkedMobileNumberEvent 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.getUnlinkedMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.unlinkedMobileNumber is null"); //NOI18N
-               } else if (event.getUnlinkedMobileNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.unlinkedMobileNumber.contactId is null"); //NOI18N
-               } else if (event.getUnlinkedMobileNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUnlinkedMobileNumber(), event.getUnlinkedMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Remove it from list
-               this.contactsPhoneCache.remove(event.getUnlinkedMobileNumber());
-
-               // Clear all data
-               this.clear();
-       }
-
        /**
         * Event observer for updated contact data by administrators
         * <p>
@@ -307,64 +201,29 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp
                this.setLandLineNumber(event.getLandLineNumber());
        }
 
-       /**
-        * Observes events being fired when a bean helper has successfully created a
-        * mobile number instance.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
-               // The event instance must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
-               } else if (event.getMobileNumber().getPhoneId() == null) {
-                       // Throw NPE yet again
-                       throw new NullPointerException("event.mobileNumber.phoneId is null"); //NOI18N
-               } else if (event.getMobileNumber().getPhoneId() < 1) {
-                       // Throw NPE yet again
-                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.phoneId={0} is invalid", event.getMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Set it here
-               this.setMobileNumber(event.getMobileNumber());
-       }
-
        /**
         * Getter for all contacts having current fax number linked
         * <p>
         * @return List of all linked contacts
         */
-       public List<Contact> getAllCurrentFaxNumberContacts () {
+       public List<Contact> allCurrentFaxNumberContacts () {
                // Get id
                final DialableFaxNumber number = this.getFaxNumber();
 
-               // Is cache there?
-               if (this.contactsPhoneCache.containsKey(number)) {
-                       // Return cached version
-                       return this.contactsPhoneCache.get(number);
-               } else {
-                       // Ask bean
-                       final List<Contact> list = new LinkedList<>();
+               // Init list
+               final List<Contact> contacts = new LinkedList<>();
 
-                       // "Walk" through all contacts
-                       for (final Contact contact : this.contactListController.getAllContacts()) {
-                               // Is mobile instance the same?
-                               if (Objects.equals(contact.getContactFaxNumber(), number)) {
-                                       // Found one
-                                       list.add(contact);
-                               }
+               // "Walk" through all contacts
+               for (final Contact contact : this.contactListController.getAllContacts()) {
+                       // Is mobile instance the same?
+                       if (Objects.equals(contact.getContactFaxNumber(), number)) {
+                               // Found one
+                               contacts.add(contact);
                        }
-
-                       // Store result in cache
-                       this.contactsPhoneCache.put(number, list);
-
-                       // Return now-cached list
-                       return list;
                }
+
+               // Return now-cached list
+               return contacts;
        }
 
        /**
@@ -373,66 +232,23 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp
         * @return List of all linked contacts
         */
        public List<Contact> allCurrentLandLineNumberContacts () {
-               // Get id
+               // Get it locally
                final DialableLandLineNumber number = this.getLandLineNumber();
 
-               // Is cache there?
-               if (this.contactsPhoneCache.containsKey(number)) {
-                       // Return cached version
-                       return this.contactsPhoneCache.get(number);
-               } else {
-                       // Ask bean
-                       final List<Contact> list = new LinkedList<>();
+               // Init list
+               final List<Contact> contacts = new LinkedList<>();
 
-                       // "Walk" through all contacts
-                       for (final Contact contact : this.contactListController.getAllContacts()) {
-                               // Is mobile instance the same?
-                               if (Objects.equals(contact.getContactLandLineNumber(), number)) {
-                                       // Found one
-                                       list.add(contact);
-                               }
+               // "Walk" through all contacts
+               for (final Contact contact : this.contactListController.getAllContacts()) {
+                       // Is mobile instance the same?
+                       if (Objects.equals(contact.getContactLandLineNumber(), number)) {
+                               // Found one
+                               contacts.add(contact);
                        }
-
-                       // Store result in cache
-                       this.contactsPhoneCache.put(number, list);
-
-                       // Return now-cached list
-                       return list;
                }
-       }
-
-       /**
-        * Getter for all contacts having current mobile number linked
-        * <p>
-        * @return List of all linked contacts
-        */
-       public List<Contact> allCurrentMobileNumberContacts () {
-               // Get id
-               final DialableMobileNumber number = this.getMobileNumber();
-
-               // Is cache there?
-               if (this.contactsPhoneCache.containsKey(number)) {
-                       // Return cached version
-                       return this.contactsPhoneCache.get(number);
-               } else {
-                       // Ask bean
-                       final List<Contact> list = new LinkedList<>();
-
-                       // "Walk" through all contacts
-                       for (final Contact contact : this.contactListController.getAllContacts()) {
-                               // Is mobile instance the same?
-                               if (Objects.equals(contact.getContactMobileNumber(), number)) {
-                                       // Found one
-                                       list.add(contact);
-                               }
-                       }
 
-                       // Store result in cache
-                       this.contactsPhoneCache.put(number, list);
-
-                       // Return now-cached list
-                       return list;
-               }
+               // Return now-cached list
+               return contacts;
        }
 
        /**
@@ -471,24 +287,6 @@ public class FinancialsContactPhoneWebRequestBean extends BaseFinancialsBean imp
                this.landLineNumber = landLineNumber;
        }
 
-       /**
-        * Getter for chosen mobile number
-        * <p>
-        * @return mobile number
-        */
-       public DialableMobileNumber getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       /**
-        * Setter for chosen mobile number
-        * <p>
-        * @param mobileNumber mobile number
-        */
-       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
        /**
         * Clears this bean
         */
index f772c1fcd7cb88fafd8dae2aa52f169028aae433..f9859958944ec45e7c1a7e31dffed97ef2db5830 100644 (file)
@@ -186,7 +186,7 @@ public class FinancialsCountryListWebViewBean extends BaseFinancialsBean impleme
                // Is cache there?
                if (!this.countryCache.iterator().hasNext()) {
                        // Add all
-                       for (final Country country : this.countryBean.allCountries()) {
+                       for (final Country country : this.countryBean.fetchAllCountries()) {
                                // Add it to cache
                                this.countryCache.put(country.getCountryId(), country);
                        }
index c94a402b597a75f51ef28ad42b310c94ceff1ad7..6b6aa2b23d0887eb0e61aa6b547018cc622d7bf2 100644 (file)
@@ -74,6 +74,12 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F
        @Inject
        private Event<ObservableCreatedContactEvent> contactCreatedEvent;
 
+       /**
+        * Regular user controller
+        */
+       @Inject
+       private FinancialsContactListWebViewController contactListController;
+
        /**
         * Fax number
         */
@@ -121,12 +127,6 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F
         */
        private User user;
 
-       /**
-        * Regular user controller
-        */
-       @Inject
-       private FinancialsContactListWebViewController contactListController;
-
        /**
         * Event for when a user instance was created
         */
@@ -383,12 +383,12 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F
                if (this.getMobileNumber() == null) {
                        // Throw NPE
                        throw new NullPointerException("this.mobileNumber is null"); //NOI18N
-               } else if (this.getMobileNumber().getPhoneId() == null) {
+               } else if (this.getMobileNumber().getMobileId() == null) {
                        // Throw again
-                       throw new NullPointerException("this.mobileNumber.phoneId is null"); //NOI18N
-               } else if (this.getMobileNumber().getPhoneId() < 1) {
+                       throw new NullPointerException("this.mobileNumber.mobileId is null"); //NOI18N
+               } else if (this.getMobileNumber().getMobileId() < 1) {
                        // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneId={0} is not valid", this.getMobileNumber().getPhoneId())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileId={0} is not valid", this.getMobileNumber().getMobileId())); //NOI18N
                } else if (this.getMobileNumber().getMobileProvider() == null) {
                        // Throw NPE again
                        throw new NullPointerException("this.mobileNumber.mobileProvider is null"); //NOI18N
@@ -398,12 +398,12 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F
                } else if (this.getMobileNumber().getMobileProvider().getProviderId() < 1) {
                        // Invalid id
                        throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileProvider.providerId={0} is invalid", this.getMobileNumber().getMobileProvider().getProviderId())); //NOI18N
-               } else if (this.getMobileNumber().getPhoneNumber() == null) {
+               } else if (this.getMobileNumber().getMobileNumber() == null) {
                        // Throw NPE again ...
-                       throw new NullPointerException("this.mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (this.getMobileNumber().getPhoneNumber() < 1) {
+                       throw new NullPointerException("this.mobileNumber.mobileNumber is null"); //NOI18N
+               } else if (this.getMobileNumber().getMobileNumber() < 1) {
                        // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.phoneNumber={0} is not valid", this.getMobileNumber().getPhoneNumber())); //NOI18N
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileNumber.mobileNumber={0} is not valid", this.getMobileNumber().getMobileNumber())); //NOI18N
                }
 
                // Fire event
@@ -495,7 +495,19 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F
                // Is a branch office instance given?
                if (branchOffice instanceof BranchOffice) {
                        // This should not happen:
-                       assert (branchOffice.getBranchCompany() instanceof BasicData) : "branchOffice.branchCompany is null"; //NOI18N
+                       if (branchOffice.getBranchId() == null) {
+                               // Throw NPE
+                               throw new NullPointerException("branchOffice.branchId is null"); //NOI18N
+                       } else if (branchOffice.getBranchId() < 1) {
+                               // Throw IAE
+                               throw new IllegalArgumentException(MessageFormat.format("branchOffice.branchId={0} is invalid.", branchOffice.getBranchId())); //NOI18N
+                       } else if (branchOffice.getBranchCompany() == null) {
+                               // Throw NPE
+                               throw new NullPointerException("branchOffice.branchCompany is null"); //NOI18N
+                       } else if (branchOffice.getBranchCountry() == null) {
+                               // Throw NPE again
+                               throw new NullPointerException("branchOffice.branchCountry is null"); //NOI18N
+                       }
 
                        // Yes, then append all data
                        sb.append(this.renderBasicData(branchOffice.getBranchCompany(), true));
@@ -719,7 +731,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F
                        sb.append(" ("); //NOI18N
                        sb.append(mobileNumber.getMobileProvider().getProviderDialPrefix());
                        sb.append(") "); //NOI18N
-                       sb.append(mobileNumber.getPhoneNumber());
+                       sb.append(mobileNumber.getMobileNumber());
                }
 
                // Return it
diff --git a/src/java/org/mxchange/jfinancials/beans/mobile/FinancialsAdminMobileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/mobile/FinancialsAdminMobileWebRequestBean.java
new file mode 100644 (file)
index 0000000..8851f63
--- /dev/null
@@ -0,0 +1,423 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.mobile;
+
+import java.text.MessageFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+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.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.mobile.list.FinancialsMobileListWebViewController;
+import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
+import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
+import org.mxchange.jphone.events.mobile.deleted.AdminMobileNumberDeletedEvent;
+import org.mxchange.jphone.events.mobile.remove.AdminMobileNumberRemovedFromListEvent;
+import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
+import org.mxchange.jphone.events.mobile.updated.AdminMobileNumberUpdatedEvent;
+import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
+import org.mxchange.jphone.model.phonenumbers.mobile.AdminMobileSessionBeanRemote;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+
+/**
+ * Administrative bean (controller) for mobile numbers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("adminMobileController")
+@RequestScoped
+public class FinancialsAdminMobileWebRequestBean extends BaseFinancialsBean implements FinancialsAdminMobileWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 184_598_175_371_269_017L;
+
+       /**
+        * Remote EJB for phone number (administrative)
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/adminMobile!org.mxchange.jphone.model.phonenumbers.mobile.AdminMobileSessionBeanRemote")
+       private AdminMobileSessionBeanRemote adminMobileBean;
+
+       /**
+        * When the phone entry has been created (persisted)
+        */
+       private Date mobileEntryCreated;
+
+       /**
+        * When the phone entry has been updated
+        */
+       private Date mobileEntryUpdated;
+
+       /**
+        * Mobile id (aka primary key)
+        */
+       private Long mobileId;
+
+       /**
+        * Generic hone controller
+        */
+       @Inject
+       private FinancialsMobileListWebViewController mobileListController;
+
+       /**
+        * Mobile number
+        */
+       private Long mobileNumber;
+
+       /**
+        * Event being fired when an administrator has deleted mobile number
+        */
+       @Inject
+       @Any
+       private Event<AdminDeletedMobileNumberEvent> mobileNumberDeletedEvent;
+
+       /**
+        * Event being fired when an administrator has updated land-line number
+        */
+       @Inject
+       @Any
+       private Event<AdminUpdatedMobileNumberEvent> mobileNumberUpdatedEvent;
+
+       /**
+        * Mobile provider
+        */
+       private MobileProvider mobileProvider;
+
+       /**
+        * Event being fired when a list of all unused mobile numbers is being
+        * created.
+        */
+       @Inject
+       @Any
+       private Event<AdminRemoveMobileNumberFromListEvent> removeLinkedMobileNumbersEvent;
+
+       /**
+        * Chosen mobile number
+        */
+       private DialableMobileNumber selectedMobileNumber;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsAdminMobileWebRequestBean () {
+               // Call super constructor
+               super();
+       }
+
+       /**
+        * Observes events being fired when a bean helper has successfully created a
+        * mobile number instance.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
+               // The event instance must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() == null) {
+                       // Throw NPE yet again
+                       throw new NullPointerException("event.mobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getMobileNumber().getMobileId() < 1) {
+                       // Throw NPE yet again
+                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.mobileId={0} is invalid", event.getMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Get fax number from event
+               final DialableMobileNumber number = event.getMobileNumber();
+
+               // Copy all data to this bean
+               this.setMobileId(number.getMobileId());
+               this.setMobileProvider(number.getMobileProvider());
+               this.setMobileNumber(number.getMobileNumber());
+               this.setMobileEntryCreated(number.getMobileEntryCreated());
+               this.setMobileEntryUpdated(number.getMobileEntryUpdated());
+       }
+
+       /**
+        * Returns a list of all unused ("non-linked") mobile numbers
+        * <p>
+        * @return List with all unused mobile numbers
+        */
+       public List<DialableMobileNumber> allNonLinkedMobileNumbers () {
+               // Get list of all mobile numbers
+               final List<DialableMobileNumber> numbers = this.mobileListController.getAllMobileNumbers();
+
+               // Visit all controllers to reduce the list
+               this.removeLinkedMobileNumbersEvent.fire(new AdminMobileNumberRemovedFromListEvent(numbers));
+
+               // Return it
+               return numbers;
+       }
+
+       /**
+        * Deletes given mobile entry data
+        */
+       public void deleteMobileData () {
+               // Get mobile number from helper
+               final DialableMobileNumber number = this.createMobileNumber();
+
+               // Is all data set
+               if (number == null) {
+                       // Not set, throw NPE
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (number.getMobileId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18N
+               } else if (number.getMobileId() < 1) {
+                       // Invalid number
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is not valid", number.getMobileId())); //NOI18N
+               } else if (number.getMobileProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() < 1) {
+                       // Id not valid
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+               } else if (number.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
+               } else if (number.getMobileNumber() < 1) {
+                       // Throw NPE again
+                       throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
+               }
+
+               // Call EJB
+               this.adminMobileBean.deleteMobileData(number);
+
+               // Fire event
+               this.mobileNumberDeletedEvent.fire(new AdminMobileNumberDeletedEvent(number));
+       }
+
+       /**
+        * Changes mobile entry data
+        * <p>
+        * @return Redirect outcome
+        */
+       public String doUpdateMobileNumber () {
+               // Get mobile number from helper
+               final DialableMobileNumber number = this.createMobileNumber();
+
+               // Is all data set
+               if (number == null) {
+                       // Not set, throw NPE
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (number.getMobileId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18N
+               } else if (number.getMobileId() < 1) {
+                       // Invalid number
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is not valid", number.getMobileId())); //NOI18N
+               } else if (number.getMobileProvider() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() == null) {
+                       // ... throw again
+                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
+               } else if (number.getMobileProvider().getProviderId() < 1) {
+                       // Id not valid
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
+               } else if (number.getMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("mobileNumber.mobileNumber is null"); //NOI18N
+               } else if (number.getMobileNumber() < 1) {
+                       // Throw NPE again
+                       throw new NullPointerException(MessageFormat.format("mobileNumber.mobileNumber={0} is not valid.", number.getMobileNumber())); //NOI18N
+               } else if (this.getMobileProvider() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("this.mobileProvider is null"); //NOI18N
+               } else if (this.getMobileProvider().getProviderId() == null) {
+                       // Throw NPE again ...
+                       throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
+               } else if (this.getMobileProvider().getProviderId() < 0) {
+                       // Invalid id number
+                       throw new IllegalArgumentException(MessageFormat.format("this.mobileProvider.providerId={0} is not valid.", this.getMobileProvider().getProviderId())); //NOI18N
+               } else if (this.getMobileNumber() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("this.phoneNumber is null"); //NOI18N
+               }
+
+               // Is the mobile provider and number the same?
+               if ((Objects.equals(this.getMobileProvider(), number.getMobileProvider())) && (Objects.equals(this.getMobileNumber(), number.getMobileNumber()))) {
+                       // Show message
+                       this.showFacesMessage("form_edit_mobile:mobileNumber", "ERROR_ADMIN_NO_CHANGE_ENTERED", FacesMessage.SEVERITY_WARN); //NOI18N
+
+                       // No difference in both together, no need to edit
+                       return ""; //NOI18N
+               }
+
+               // Set all data
+               number.setMobileProvider(this.getMobileProvider());
+               number.setMobileNumber(this.getMobileNumber());
+
+               // Send to bean
+               final DialableMobileNumber updatedNumber = this.adminMobileBean.updateMobileData(number);
+
+               // Fire event
+               this.mobileNumberUpdatedEvent.fire(new AdminMobileNumberUpdatedEvent(updatedNumber));
+
+               // All fine, redirect
+               return "admin_show_mobile"; //NOI18N
+       }
+
+       /**
+        * Getter for phone entry created timestamp
+        * <p>
+        * @return Mobile entry created timestamp
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       public Date getMobileEntryCreated () {
+               return this.mobileEntryCreated;
+       }
+
+       /**
+        * Setter for phone entry created timestamp
+        * <p>
+        * @param mobileEntryCreated Mobile entry created timestamp
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setMobileEntryCreated (final Date mobileEntryCreated) {
+               this.mobileEntryCreated = mobileEntryCreated;
+       }
+
+       /**
+        * Getter for phone entry updated timestamp
+        * <p>
+        * @return Mobile entry updated timestamp
+        */
+       @SuppressWarnings ("ReturnOfDateField")
+       public Date getMobileEntryUpdated () {
+               return this.mobileEntryUpdated;
+       }
+
+       /**
+        * Setter for phone entry updated timestamp
+        * <p>
+        * @param mobileEntryUpdated Mobile entry updated timestamp
+        */
+       @SuppressWarnings ("AssignmentToDateFieldFromParameter")
+       public void setMobileEntryUpdated (final Date mobileEntryUpdated) {
+               this.mobileEntryUpdated = mobileEntryUpdated;
+       }
+
+       /**
+        * Getter for phone id
+        * <p>
+        * @return Mobile id
+        */
+       public Long getMobileId () {
+               return this.mobileId;
+       }
+
+       /**
+        * Setter for phone id
+        * <p>
+        * @param mobileId Mobile id
+        */
+       public void setMobileId (final Long mobileId) {
+               this.mobileId = mobileId;
+       }
+
+       /**
+        * Getter for dial number without prefix
+        * <p>
+        * @return Dial number without prefix
+        */
+       public Long getMobileNumber () {
+               return this.mobileNumber;
+       }
+
+       /**
+        * Setter for dial number without prefix
+        * <p>
+        * @param mobileNumber Dial number without prefix
+        */
+       public void setMobileNumber (final Long mobileNumber) {
+               this.mobileNumber = mobileNumber;
+       }
+
+       /**
+        * Getter for mobile provider
+        * <p>
+        * @return Mobile provider
+        */
+       public MobileProvider getMobileProvider () {
+               return this.mobileProvider;
+       }
+
+       /**
+        * Setter for mobile provider
+        * <p>
+        * @param mobileProvider Mobile provider
+        */
+       public void setMobileProvider (final MobileProvider mobileProvider) {
+               this.mobileProvider = mobileProvider;
+       }
+
+       /**
+        * Getter for chosen mobile number
+        * <p>
+        * @return mobile number
+        */
+       public DialableMobileNumber getSelectedMobileNumber () {
+               return this.selectedMobileNumber;
+       }
+
+       /**
+        * Setter for chosen mobile number
+        * <p>
+        * @param selectedMobileNumber mobile number
+        */
+       public void setSelectedMobileNumber (final DialableMobileNumber selectedMobileNumber) {
+               this.selectedMobileNumber = selectedMobileNumber;
+       }
+
+       /**
+        * Returns an instance of a DialableMobileNumber from all fields stored in
+        * this bean.
+        * <p>
+        * @return An instance of a DialableMobileNumber class
+        */
+       private DialableMobileNumber createMobileNumber () {
+               // Initialize it
+               final DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getMobileNumber());
+
+               // Add all other data
+               number.setMobileEntryCreated(this.getMobileEntryCreated());
+               number.setMobileEntryUpdated(this.getMobileEntryUpdated());
+               number.setMobileId(this.getMobileId());
+
+               // Return it
+               return number;
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/mobile/FinancialsAdminMobileWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/mobile/FinancialsAdminMobileWebRequestController.java
new file mode 100644 (file)
index 0000000..3a5a8f7
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.mobile;
+
+import java.io.Serializable;
+
+/**
+ * An interface for a request web controller (bean) for administrative phone
+ * number purposes.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsAdminMobileWebRequestController extends Serializable {
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/mobile/list/FinancialsMobileListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/mobile/list/FinancialsMobileListWebViewBean.java
new file mode 100644 (file)
index 0000000..5c6a03f
--- /dev/null
@@ -0,0 +1,426 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.mobile.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.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
+import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
+import org.mxchange.jphone.exceptions.mobile.MobileEntityNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+import org.mxchange.jphone.model.phonenumbers.mobile.MobileSessionBeanRemote;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+
+/**
+ * Administrative listing controller (bean) for mobile numbers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("mobileListController")
+@ViewScoped
+public class FinancialsMobileListWebViewBean extends BaseFinancialsBean implements FinancialsMobileListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 491_058_674_675_690_106L;
+
+       /**
+        * A list of all mobile numbers
+        */
+       private final List<DialableMobileNumber> allMobileNumbers;
+
+       /**
+        * A list of filtered mobile numbers
+        */
+       private List<DialableMobileNumber> filteredMobileNumbers;
+
+       /**
+        * General EJB for mobile numbers
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/mobile!org.mxchange.jphone.model.phonenumbers.mobile.MobileSessionBeanRemote")
+       private MobileSessionBeanRemote mobileBean;
+
+       /**
+        * Cache for mobile numbers
+        */
+       @Inject
+       @NamedCache (cacheName = "mobileNumberCache")
+       private transient Cache<Long, DialableMobileNumber> mobileNumberCache;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsMobileListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allMobileNumbers = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when an administrator has added a new
+        * contact.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+               // The event must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedContact is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and mobile number
+               this.updateContactMobileNumbers(event.getAddedContact());
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Event observer for newly added users by administrator
+        * <p>
+        * @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 contact's mobile, land-line and mobile number
+               this.updateContactMobileNumbers(event.getAddedUser().getUserContact());
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has deleted a land-line
+        * number
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminDeletedMobileNumberEvent (@Observes final AdminDeletedMobileNumberEvent 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.getDeletedMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.deletedMobileNumber is null"); //NOI18N
+               } else if (event.getDeletedMobileNumber().getMobileId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.deletedMobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getDeletedMobileNumber().getMobileId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("mobileId of contact={0} is not valid: {1}", event.getDeletedMobileNumber(), event.getDeletedMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and mobile number
+               this.getAllMobileNumbers().remove(event.getDeletedMobileNumber());
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has a linked a
+        * land-line number
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminLinkedMobileNumberEvent (@Observes final ObservableAdminLinkedMobileNumberEvent event) {
+               // Is the event fine?
+               if (event == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact is null"); //NOI18N
+               } else if (event.getContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
+               } else if (event.getContact().getContactId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException(MessageFormat.format("event.contact.contactId={0} is invalid", event.getContact().getContactId())); //NOI18N
+               } else if (event.getContact().getContactMobileNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactMobileNumber is null"); //NOI18N
+               } else if (event.getContact().getContactMobileNumber().getMobileId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactMobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getContact().getContactMobileNumber().getMobileId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException(MessageFormat.format("event.contact.contactMobileNumber.mobileId={0} is invalid", event.getContact().getContactMobileNumber().getMobileId())); //NOI18N
+               } else if (event.getLinkedMobileNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.linkedMobileNumer is null"); //NOI18N
+               }
+
+               // Is the id number in linked number not set?
+               if (event.getLinkedMobileNumber().getMobileId() == null) {
+                       // Then it is a new number, so add it from contact as there the id number has been set
+                       this.uniqueAddMobileNumber(event.getContact().getContactMobileNumber());
+               }
+       }
+
+       /**
+        * Observes events being fired when an administrator has updated contact
+        * data.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent 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.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and mobile number
+               this.updateContactMobileNumbers(event.getUpdatedContact());
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has updated a land-line
+        * number.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminUpdatedMobileNumberEvent (@Observes final AdminUpdatedMobileNumberEvent 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.getUpdatedMobileNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedMobileNumber is null"); //NOI18N
+               } else if (event.getUpdatedMobileNumber().getMobileId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.updatedMobileNumber.mobileId is null"); //NOI18N
+               } else if (event.getUpdatedMobileNumber().getMobileId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("mobileId of contact={0} is not valid: {1}", event.getUpdatedMobileNumber(), event.getUpdatedMobileNumber().getMobileId())); //NOI18N
+               }
+
+               // Uniquely add it
+               this.uniqueAddMobileNumber(event.getUpdatedMobileNumber());
+
+               // Clear it
+               this.clear();
+       }
+
+       @Override
+       public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws MobileEntityNotFoundException {
+               // Validate paramter
+               if (null == mobileNumberId) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumberId is null"); //NOI18N
+               } else if (mobileNumberId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumberId={0} is invalid.", mobileNumberId)); //NOI18N
+               } else if (!this.mobileNumberCache.containsKey(mobileNumberId)) {
+                       // Not found
+                       throw new MobileEntityNotFoundException(mobileNumberId);
+               }
+
+               // Get it from cache
+               final DialableMobileNumber mobileNumber = this.mobileNumberCache.get(mobileNumberId);
+
+               // Return it
+               return mobileNumber;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<DialableMobileNumber> getAllMobileNumbers () {
+               return this.allMobileNumbers;
+       }
+
+       /**
+        * Getter for filtered mobile numbers
+        * <p>
+        * @return Filtered mobile numbers
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<DialableMobileNumber> getFilteredMobileNumbers () {
+               return this.filteredMobileNumbers;
+       }
+
+       /**
+        * Setter for filtered mobile numbers
+        * <p>
+        * @param filteredMobileNumbers Filtered mobile numbers
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredMobileNumbers (final List<DialableMobileNumber> filteredMobileNumbers) {
+               this.filteredMobileNumbers = filteredMobileNumbers;
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.mobileNumberCache.iterator().hasNext()) {
+                       // Add all
+                       for (final DialableMobileNumber currentNumber : this.mobileBean.fetchAllMobileNumbers()) {
+                               // Add it to cache
+                               this.mobileNumberCache.put(currentNumber.getMobileId(), currentNumber);
+                       }
+               }
+
+               // Is cache filled and list is empty
+               if ((this.mobileNumberCache.iterator().hasNext()) && (this.getAllMobileNumbers().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, DialableMobileNumber> currentEntry : this.mobileNumberCache) {
+                               // Add to list
+                               this.getAllMobileNumbers().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllMobileNumbers().sort(new Comparator<DialableMobileNumber>() {
+                               @Override
+                               public int compare (final DialableMobileNumber mobileNumber1, final DialableMobileNumber mobileNumber2) {
+                                       return mobileNumber1.getMobileId() > mobileNumber2.getMobileId() ? 1 : mobileNumber1.getMobileId() < mobileNumber2.getMobileId() ? -1 : 0;
+                               }
+                       });
+
+                       // Set full list
+                       this.setFilteredMobileNumbers(this.getAllMobileNumbers());
+               }
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all data
+       }
+
+       /**
+        * Uniquely add given land-line number to this bean's list. First remove the
+        * old instance (by id number), then re-add it again.
+        * <p>
+        * @param mobileNumber Land-line number to add
+        */
+       private void uniqueAddMobileNumber (final DialableMobileNumber mobileNumber) {
+               // Make sure the parameter is valid
+               if (null == mobileNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileNumber is null"); //NOI18N
+               } else if (mobileNumber.getMobileId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("mobileNumber.mobileId is null"); //NOI18N
+               } else if (mobileNumber.getMobileId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileId={0} is not valid.", mobileNumber.getMobileId())); //NOI18N
+               }
+
+               // First remove it
+               if (!this.getAllMobileNumbers().remove(mobileNumber)) {
+                       // Did not work, try by id number
+                       for (final DialableMobileNumber currentNumber : this.getAllMobileNumbers()) {
+                               // Is id number the same?
+                               if (Objects.equals(currentNumber.getMobileId(), mobileNumber.getMobileId())) {
+                                       // Found it
+                                       this.getAllMobileNumbers().remove(currentNumber);
+                                       break;
+                               }
+                       }
+               }
+
+               // ... then add it
+               this.getAllMobileNumbers().add(mobileNumber);
+       }
+
+       /**
+        * Updates given contact's mobile number
+        * <p>
+        * @param contact Contact instance
+        */
+       private void updateContactMobileNumbers (final Contact contact) {
+               // Parameter 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) {
+                       // Id number is not valid
+               }
+
+               // Is land-line set?
+               if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
+                       // Unique-add it
+                       this.uniqueAddMobileNumber(contact.getContactMobileNumber());
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/mobile/list/FinancialsMobileListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/mobile/list/FinancialsMobileListWebViewController.java
new file mode 100644 (file)
index 0000000..18a38fb
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.mobile.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jphone.exceptions.mobile.MobileEntityNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
+
+/**
+ * An interface for a request web controller (bean) for administrative phone
+ * number purposes.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsMobileListWebViewController extends Serializable {
+
+       /**
+        * Returns a list of all mobile numbers. For performance reasons, the
+        * controller (bean) should be view-scoped as from user to user nothing
+        * changes. And the controller's post-construct method should load all
+        * numbers and cache it in the controller.
+        * <p>
+        * @return List of all mobile numbers
+        */
+       List<DialableMobileNumber> getAllMobileNumbers ();
+
+       /**
+        * Finds a mobile entry by given id number
+        * <p>
+        * @param mobileNumberId Mobile entry id number
+        * <p>
+        * @return A valid mobile instance
+        * <p>
+        * @throws MobileEntityNotFoundException If the entity was not found
+        */
+       DialableMobileNumber findMobileNumberById (Long mobileNumberId) throws MobileEntityNotFoundException;
+
+}
index 782d8314e2b348045299419344be6657c0852391..9b0623821f8d877ff2747c06a6ca776fcedb40e3 100644 (file)
@@ -27,6 +27,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.mobileprovider.list.FinancialsMobileProviderListWebViewController;
 import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
 import org.mxchange.jphone.events.mobileprovider.added.AdminMobileProviderAddedEvent;
 import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderAlreadyAddedException;
@@ -55,10 +56,10 @@ public class FinancialsAdminMobileProviderWebRequestBean extends BaseFinancialsB
        private AdminMobileProviderSessionBeanRemote adminRemoteBean;
 
        /**
-        * Regular bean
+        * Mobile provider list view
         */
        @Inject
-       private FinancialsMobileProviderWebRequestController mobileController;
+       private FinancialsMobileProviderListWebViewController mobileProviderListController;
 
        /**
         * Event being fired when the mobile provider was added
@@ -213,7 +214,7 @@ public class FinancialsAdminMobileProviderWebRequestBean extends BaseFinancialsB
                boolean isFound = false;
 
                // Loop through all
-               for (final MobileProvider currentMobileProvider : this.mobileController.allMobileProviders()) {
+               for (final MobileProvider currentMobileProvider : this.mobileProviderListController.getAllMobileProviders()) {
                        // Is the provider's dial prefix and country the same?
                        if (Objects.equals(mobileProvider, currentMobileProvider)) {
                                // Is the same, abort loop
index 184b68b20f40eb428c231b44abead117e20ae89e..ae5df376d3266184d02c26e3557de71dec1b6208 100644 (file)
  */
 package org.mxchange.jfinancials.beans.mobileprovider;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
-import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
 
 /**
@@ -48,144 +36,17 @@ public class FinancialsMobileProviderWebRequestBean extends BaseFinancialsBean i
         */
        private static final long serialVersionUID = 15_869_423_671_950_276L;
 
-       /**
-        * A list of all mobile providers
-        */
-       private final List<MobileProvider> allMobileProviders;
-
-       /**
-        * A list of filtered mobile providers
-        */
-       private List<MobileProvider> filteredMobileProviders;
-
        /**
         * Remote EJB for mobile providers (regular)
         */
        @EJB (lookup = "java:global/jfinancials-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
        private MobileProviderSingletonBeanRemote mobileProviderBean;
 
-       /**
-        * "Cached" list of mobile providers
-        */
-       @Inject
-       @NamedCache (cacheName = "mobileProviderCache")
-       private Cache<Long, MobileProvider> mobileProviderCache;
-
        /**
         * Default constructor
         */
        public FinancialsMobileProviderWebRequestBean () {
                // Call super constructor
                super();
-
-               // Init list
-               this.allMobileProviders = new LinkedList<>();
-       }
-
-       /**
-        * Observes events being fired after the administrator has added a new
-        * mobile provider
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminAddedMobileProviderEvent (@Observes final AdminAddedMobileProviderEvent event) {
-               // Is all valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedMobileProvider() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.addedMobileProvider is null"); //NOI18N
-               } else if (event.getAddedMobileProvider().getProviderId() == null) {
-                       // And again ...
-                       throw new NullPointerException("event.addedMobileProvider.providerId is null"); //NOI18N
-               } else if (event.getAddedMobileProvider().getProviderId() < 1) {
-                       // Id is invalid
-                       throw new IllegalArgumentException(MessageFormat.format("event.addedMobileProvider.providerId={0} is not valid.", event.getAddedMobileProvider().getProviderId())); //NOI18N
-               }
-
-               // Add it to the list
-               this.mobileProviderCache.put(event.getAddedMobileProvider().getProviderId(), event.getAddedMobileProvider());
-               this.allMobileProviders.add(event.getAddedMobileProvider());
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<MobileProvider> allMobileProviders () {
-               // Return it
-               return this.allMobileProviders;
-       }
-
-       @Override
-       public MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException {
-               // Validate parameter
-               if (null == mobileProviderId) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileProviderId is null"); //NOI18N
-               } else if (mobileProviderId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("mobileProviderId=" + mobileProviderId + " is invalid."); //NOI18N
-               } else if (!this.mobileProviderCache.containsKey(mobileProviderId)) {
-                       // Not found
-                       throw new MobileProviderNotFoundException(mobileProviderId);
-               }
-
-               // Get it from cache
-               final MobileProvider mobileProvider = this.mobileProviderCache.get(mobileProviderId);
-
-               // Return it
-               return mobileProvider;
-       }
-
-       /**
-        * Getter for filtered mobile provider list
-        * <p>
-        * @return Filtered mobile providers
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<MobileProvider> getFilteredMobileProviders () {
-               return this.filteredMobileProviders;
-       }
-
-       /**
-        * Getter for filtered mobile provider list
-        * <p>
-        * @param filteredMobileProviders Filtered mobile providers
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredMobileProviders (final List<MobileProvider> filteredMobileProviders) {
-               this.filteredMobileProviders = filteredMobileProviders;
-       }
-
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void initCache () {
-               // Is cache there?
-               if (!this.mobileProviderCache.iterator().hasNext()) {
-                       // Add all
-                       for (final MobileProvider mobileProvider : this.mobileProviderBean.allMobileProviders()) {
-                               // Add it to cache
-                               this.mobileProviderCache.put(mobileProvider.getProviderId(), mobileProvider);
-                       }
-               }
-
-               // Is the list empty, but filled cache?
-               if (this.allMobileProviders.isEmpty() && this.mobileProviderCache.iterator().hasNext()) {
-                       // Build up list
-                       for (final Cache.Entry<Long, MobileProvider> currentEntry : this.mobileProviderCache) {
-                               // Add to list
-                               this.allMobileProviders.add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.allMobileProviders.sort(new Comparator<MobileProvider>() {
-                               @Override
-                               public int compare (final MobileProvider mobileProvider1, final MobileProvider mobileProvider2) {
-                                       return mobileProvider1.getProviderId() > mobileProvider2.getProviderId() ? 1 : mobileProvider1.getProviderId() < mobileProvider2.getProviderId() ? -1 : 0;
-                               }
-                       });
-               }
        }
 }
index 4e8b5a4e4540fc0bb322fc635ee5ae8826ee72bd..e0f0a4cbc73ed2f4d82869b82dbc2abe8f5fe8f0 100644 (file)
@@ -17,9 +17,6 @@
 package org.mxchange.jfinancials.beans.mobileprovider;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 
 /**
  * An interface for general mobile provider controller
@@ -28,24 +25,4 @@ import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
  */
 public interface FinancialsMobileProviderWebRequestController extends Serializable {
 
-       /**
-        * Returns a mobile provider instance by given primary key. If not found, a
-        * proper exception is thrown.
-        * <p>
-        * @param mobileProviderId Primary key
-        * <p>
-        * @return Mobile provider instance
-        * <p>
-        * @throws MobileProviderNotFoundException If the primary key could not be
-        * found
-        */
-       MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException;
-
-       /**
-        * Returns a list of all mobile providers
-        * <p>
-        * @return A list of all mobile providers
-        */
-       List<MobileProvider> allMobileProviders ();
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/list/FinancialsMobileProviderListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/list/FinancialsMobileProviderListWebViewBean.java
new file mode 100644 (file)
index 0000000..8a5e1f1
--- /dev/null
@@ -0,0 +1,214 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.mobileprovider.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.text.MessageFormat;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.enterprise.event.Observes;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jphone.events.mobileprovider.added.AdminAddedMobileProviderEvent;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote;
+
+/**
+ * A views-scoped bean for mobile providers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("mobileProviderListController")
+@ViewScoped
+public class FinancialsMobileProviderListWebViewBean extends BaseFinancialsBean implements FinancialsMobileProviderListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 15_869_423_671_950_277L;
+
+       /**
+        * A list of all mobile providers
+        */
+       private final List<MobileProvider> allMobileProviders;
+
+       /**
+        * A list of filtered mobile providers
+        */
+       private List<MobileProvider> filteredMobileProviders;
+
+       /**
+        * Remote EJB for mobile providers (regular)
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/mobileProvider!org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProviderSingletonBeanRemote")
+       private MobileProviderSingletonBeanRemote mobileProviderBean;
+
+       /**
+        * "Cached" list of mobile providers
+        */
+       @Inject
+       @NamedCache (cacheName = "mobileProviderCache")
+       private transient Cache<Long, MobileProvider> mobileProviderCache;
+
+       /**
+        * Selected mobile provider instance
+        */
+       private MobileProvider selectedMobileProvider;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsMobileProviderListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allMobileProviders = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired after the administrator has added a new
+        * mobile provider
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedMobileProviderEvent (@Observes final AdminAddedMobileProviderEvent event) {
+               // Is all valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedMobileProvider() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedMobileProvider is null"); //NOI18N
+               } else if (event.getAddedMobileProvider().getProviderId() == null) {
+                       // And again ...
+                       throw new NullPointerException("event.addedMobileProvider.providerId is null"); //NOI18N
+               } else if (event.getAddedMobileProvider().getProviderId() < 1) {
+                       // Id is invalid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedMobileProvider.providerId={0} is not valid.", event.getAddedMobileProvider().getProviderId())); //NOI18N
+               }
+
+               // Add it to the list
+               this.mobileProviderCache.put(event.getAddedMobileProvider().getProviderId(), event.getAddedMobileProvider());
+               this.getAllMobileProviders().add(event.getAddedMobileProvider());
+       }
+
+       @Override
+       public MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException {
+               // Validate parameter
+               if (null == mobileProviderId) {
+                       // Throw NPE
+                       throw new NullPointerException("mobileProviderId is null"); //NOI18N
+               } else if (mobileProviderId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("mobileProviderId=" + mobileProviderId + " is invalid."); //NOI18N
+               } else if (!this.mobileProviderCache.containsKey(mobileProviderId)) {
+                       // Not found
+                       throw new MobileProviderNotFoundException(mobileProviderId);
+               }
+
+               // Get it from cache
+               final MobileProvider mobileProvider = this.mobileProviderCache.get(mobileProviderId);
+
+               // Return it
+               return mobileProvider;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<MobileProvider> getAllMobileProviders () {
+               // Return it
+               return this.allMobileProviders;
+       }
+
+       /**
+        * Getter for filtered mobile provider list
+        * <p>
+        * @return Filtered mobile providers
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<MobileProvider> getFilteredMobileProviders () {
+               return this.filteredMobileProviders;
+       }
+
+       /**
+        * Getter for filtered mobile provider list
+        * <p>
+        * @param filteredMobileProviders Filtered mobile providers
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredMobileProviders (final List<MobileProvider> filteredMobileProviders) {
+               this.filteredMobileProviders = filteredMobileProviders;
+       }
+
+       /**
+        * Getter for selected mobile provider instance
+        * <p>
+        * @return Selected mobile provider instance
+        */
+       public MobileProvider getSelectedMobileProvider () {
+               return this.selectedMobileProvider;
+       }
+
+       /**
+        * Setter for selected mobile provider instance
+        * <p>
+        * @param selectedMobileProvider Selected mobile provider instance
+        */
+       public void setSelectedMobileProvider (final MobileProvider selectedMobileProvider) {
+               this.selectedMobileProvider = selectedMobileProvider;
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.mobileProviderCache.iterator().hasNext()) {
+                       // Add all
+                       for (final MobileProvider mobileProvider : this.mobileProviderBean.fetchAllMobileProviders()) {
+                               // Add it to cache
+                               this.mobileProviderCache.put(mobileProvider.getProviderId(), mobileProvider);
+                       }
+               }
+
+               // Is the list empty, but filled cache?
+               if (this.getAllMobileProviders().isEmpty() && this.mobileProviderCache.iterator().hasNext()) {
+                       // Build up list
+                       for (final Cache.Entry<Long, MobileProvider> currentEntry : this.mobileProviderCache) {
+                               // Add to list
+                               this.getAllMobileProviders().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllMobileProviders().sort(new Comparator<MobileProvider>() {
+                               @Override
+                               public int compare (final MobileProvider mobileProvider1, final MobileProvider mobileProvider2) {
+                                       return mobileProvider1.getProviderId() > mobileProvider2.getProviderId() ? 1 : mobileProvider1.getProviderId() < mobileProvider2.getProviderId() ? -1 : 0;
+                               }
+                       });
+               }
+       }
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/list/FinancialsMobileProviderListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/list/FinancialsMobileProviderListWebViewController.java
new file mode 100644 (file)
index 0000000..fa03552
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.mobileprovider.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
+
+/**
+ * An interface for general mobile provider controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsMobileProviderListWebViewController extends Serializable {
+
+       /**
+        * Returns a mobile provider instance by given primary key. If not found, a
+        * proper exception is thrown.
+        * <p>
+        * @param mobileProviderId Primary key
+        * <p>
+        * @return Mobile provider instance
+        * <p>
+        * @throws MobileProviderNotFoundException If the primary key could not be
+        * found
+        */
+       MobileProvider findMobileProviderById (final Long mobileProviderId) throws MobileProviderNotFoundException;
+
+       /**
+        * Returns a list of all mobile providers
+        * <p>
+        * @return A list of all mobile providers
+        */
+       List<MobileProvider> getAllMobileProviders ();
+
+}
index c6ec1d8246b46a9b3ea6da394cd59fb9067e1561..d7cb2c7e30eb429821365631cb50ff0ee1cda281 100644 (file)
@@ -30,6 +30,7 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jcountry.model.data.Country;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.phone.list.FinancialsPhoneListWebViewController;
 import org.mxchange.jphone.events.fax.created.ObservableCreatedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
 import org.mxchange.jphone.events.fax.deleted.AdminFaxNumberDeletedEvent;
@@ -44,20 +45,11 @@ import org.mxchange.jphone.events.landline.removed.AdminLandLineNumberRemovedFro
 import org.mxchange.jphone.events.landline.removed.AdminRemoveLandLineNumberFromListEvent;
 import org.mxchange.jphone.events.landline.updated.AdminLandLineNumberUpdatedEvent;
 import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
-import org.mxchange.jphone.events.mobile.created.ObservableCreatedMobileNumberEvent;
-import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
-import org.mxchange.jphone.events.mobile.deleted.AdminMobileNumberDeletedEvent;
-import org.mxchange.jphone.events.mobile.remove.AdminMobileNumberRemovedFromListEvent;
 import org.mxchange.jphone.events.mobile.remove.AdminRemoveMobileNumberFromListEvent;
-import org.mxchange.jphone.events.mobile.updated.AdminMobileNumberUpdatedEvent;
-import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 import org.mxchange.jphone.model.phonenumbers.fax.FaxNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
-import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 import org.mxchange.jphone.model.phonenumbers.phone.AdminPhoneSessionBeanRemote;
 
 /**
@@ -118,41 +110,11 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
        @Any
        private Event<AdminUpdatedLandLineNumberEvent> landLineNumberUpdatedEvent;
 
-       /**
-        * Chosen mobile number
-        */
-       private DialableMobileNumber mobileNumber;
-
-       /**
-        * Event being fired when an administrator has deleted mobile number
-        */
-       @Inject
-       @Any
-       private Event<AdminDeletedMobileNumberEvent> mobileNumberDeletedEvent;
-
-       /**
-        * Event being fired when an administrator has updated land-line number
-        */
-       @Inject
-       @Any
-       private Event<AdminUpdatedMobileNumberEvent> mobileNumberUpdatedEvent;
-
-       /**
-        * Mobile provider
-        */
-       private MobileProvider mobileProvider;
-
        /**
         * Area code (city dial prefix)
         */
        private Integer phoneAreaCode;
 
-       /**
-        * Generic hone controller
-        */
-       @Inject
-       private FinancialsPhoneWebRequestController phoneController;
-
        /**
         * Country (for dial prefix)
         */
@@ -173,6 +135,12 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        private Long phoneId;
 
+       /**
+        * Generic hone controller
+        */
+       @Inject
+       private FinancialsPhoneListWebViewController phoneListController;
+
        /**
         * Phone number
         */
@@ -211,7 +179,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
 
        /**
         * Observes events being fired when a bean helper has successfully created a
-        * fax number instance.
+        * land-line number instance.
         * <p>
         * @param event Event being fired
         */
@@ -222,17 +190,17 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                        throw new NullPointerException("event is null"); //NOI18N
                } else if (event.getFaxNumber() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("event.faxNumber is null"); //NOI18N
+                       throw new NullPointerException("event.landLineNumber is null"); //NOI18N
                } else if (event.getFaxNumber().getPhoneId() == null) {
                        // Throw NPE yet again
-                       throw new NullPointerException("event.faxNumber.phoneId is null"); //NOI18N
+                       throw new NullPointerException("event.landLineNumber.phoneId is null"); //NOI18N
                } else if (event.getFaxNumber().getPhoneId() < 1) {
                        // Throw NPE yet again
-                       throw new NullPointerException(MessageFormat.format("event.faxNumber.phoneId={0} is invalid", event.getFaxNumber().getPhoneId())); //NOI18N
+                       throw new NullPointerException(MessageFormat.format("event.landLineNumber.phoneId={0} is invalid", event.getFaxNumber().getPhoneId())); //NOI18N
                }
 
                // Get fax number from event
-               DialableFaxNumber number = event.getFaxNumber();
+               final DialableFaxNumber number = event.getFaxNumber();
 
                // Copy all data to this bean
                this.setPhoneId(number.getPhoneId());
@@ -266,7 +234,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                }
 
                // Get fax number from event
-               DialableLandLineNumber number = event.getLandLineNumber();
+               final DialableLandLineNumber number = event.getLandLineNumber();
 
                // Copy all data to this bean
                this.setPhoneId(number.getPhoneId());
@@ -277,39 +245,6 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
        }
 
-       /**
-        * Observes events being fired when a bean helper has successfully created a
-        * mobile number instance.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterCreatedMobileNumberEvent (@Observes final ObservableCreatedMobileNumberEvent event) {
-               // The event instance must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.mobileNumber is null"); //NOI18N
-               } else if (event.getMobileNumber().getPhoneId() == null) {
-                       // Throw NPE yet again
-                       throw new NullPointerException("event.mobileNumber.phoneId is null"); //NOI18N
-               } else if (event.getMobileNumber().getPhoneId() < 1) {
-                       // Throw NPE yet again
-                       throw new NullPointerException(MessageFormat.format("event.mobileNumber.phoneId={0} is invalid", event.getMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Get fax number from event
-               DialableMobileNumber number = event.getMobileNumber();
-
-               // Copy all data to this bean
-               this.setPhoneId(number.getPhoneId());
-               this.setMobileProvider(number.getMobileProvider());
-               this.setPhoneNumber(number.getPhoneNumber());
-               this.setPhoneEntryCreated(number.getPhoneEntryCreated());
-               this.setPhoneEntryUpdated(number.getPhoneEntryUpdated());
-       }
-
        /**
         * Returns a list of all unused ("non-linked") land-line numbers
         * <p>
@@ -317,13 +252,13 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        public List<DialableFaxNumber> allNonLinkedFaxNumbers () {
                // Get list of all mobile numbers
-               List<DialableFaxNumber> list = this.phoneController.allFaxNumbers();
+               final List<DialableFaxNumber> numbers = this.phoneListController.getAllFaxNumbers();
 
                // Visit all controllers to reduce the list
-               this.removeLinkedFaxNumbersEvent.fire(new AdminFaxNumberRemovedFromListEvent(list));
+               this.removeLinkedFaxNumbersEvent.fire(new AdminFaxNumberRemovedFromListEvent(numbers));
 
                // Return it
-               return list;
+               return numbers;
        }
 
        /**
@@ -333,29 +268,13 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        public List<DialableLandLineNumber> allNonLinkedLandLineNumbers () {
                // Get list of all mobile numbers
-               List<DialableLandLineNumber> list = this.phoneController.allLandLineNumbers();
+               final List<DialableLandLineNumber> numbers = this.phoneListController.getAllLandLineNumbers();
 
                // Visit all controllers to reduce the list
-               this.removeLinkedLandLineNumbersEvent.fire(new AdminLandLineNumberRemovedFromListEvent(list));
+               this.removeLinkedLandLineNumbersEvent.fire(new AdminLandLineNumberRemovedFromListEvent(numbers));
 
                // Return it
-               return list;
-       }
-
-       /**
-        * Returns a list of all unused ("non-linked") mobile numbers
-        * <p>
-        * @return List with all unused mobile numbers
-        */
-       public List<DialableMobileNumber> allNonLinkedMobileNumbers () {
-               // Get list of all mobile numbers
-               List<DialableMobileNumber> list = this.phoneController.allMobileNumbers();
-
-               // Visit all controllers to reduce the list
-               this.removeLinkedMobileNumbersEvent.fire(new AdminMobileNumberRemovedFromListEvent(list));
-
-               // Return it
-               return list;
+               return numbers;
        }
 
        /**
@@ -364,7 +283,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        public void deleteFaxData () {
                // Get fax number from bean helper
-               DialableFaxNumber number = this.createFaxNumber();
+               final DialableFaxNumber number = this.createFaxNumber();
 
                // Is all data set
                if (number == null) {
@@ -411,7 +330,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        public void deleteLandLineData () {
                // Get land-line number from helper
-               DialableLandLineNumber number = this.createLandLineNumber();
+               final DialableLandLineNumber number = this.createLandLineNumber();
 
                // Is all data set
                if (number == null) {
@@ -453,47 +372,6 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                this.landLineNumberDeletedEvent.fire(new AdminLandLineNumberDeletedEvent(number));
        }
 
-       /**
-        * Deletes given mobile entry data
-        */
-       public void deleteMobileData () {
-               // Get mobile number from helper
-               DialableMobileNumber number = this.createMobileNumber();
-
-               // Is all data set
-               if (number == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (number.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (number.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
-               } else if (number.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
-               } else if (number.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (number.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
-               }
-
-               // Call EJB
-               this.adminPhoneBean.deleteMobileData(number);
-
-               // Fire event
-               this.mobileNumberDeletedEvent.fire(new AdminMobileNumberDeletedEvent(number));
-       }
-
        /**
         * Changes fax entry data
         * <p>
@@ -501,7 +379,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        public String doChangeFaxNumber () {
                // Get fax number from bean helper
-               DialableFaxNumber number = this.createFaxNumber();
+               final DialableFaxNumber number = this.createFaxNumber();
 
                // Is all data set
                if (number == null) {
@@ -551,7 +429,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                number.setPhoneNumber(this.getPhoneNumber());
 
                // Send to bean
-               DialableFaxNumber updatedNumber = this.adminPhoneBean.updateFaxData(number);
+               final DialableFaxNumber updatedNumber = this.adminPhoneBean.updateFaxData(number);
 
                // Fire event
                this.faxNumberUpdatedEvent.fire(new AdminFaxNumberUpdatedEvent(updatedNumber));
@@ -567,7 +445,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        public String doChangeLandLineNumber () {
                // Get land-line number from helper
-               DialableLandLineNumber number = this.createLandLineNumber();
+               final DialableLandLineNumber number = this.createLandLineNumber();
 
                // Is all data set
                if (number == null) {
@@ -617,7 +495,7 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                number.setPhoneNumber(this.getPhoneNumber());
 
                // Send to bean
-               DialableLandLineNumber updatedNumber = this.adminPhoneBean.updateLandLineData(number);
+               final DialableLandLineNumber updatedNumber = this.adminPhoneBean.updateLandLineData(number);
 
                // Fire event
                this.landLineNumberUpdatedEvent.fire(new AdminLandLineNumberUpdatedEvent(updatedNumber));
@@ -626,77 +504,6 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                return "admin_show_landline"; //NOI18N
        }
 
-       /**
-        * Changes mobile entry data
-        * <p>
-        * @return Redirect outcome
-        */
-       public String doUpdateMobileNumber () {
-               // Get mobile number from helper
-               DialableMobileNumber number = this.createMobileNumber();
-
-               // Is all data set
-               if (number == null) {
-                       // Not set, throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (number.getPhoneId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (number.getPhoneId() < 1) {
-                       // Invalid number
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid", number.getPhoneId())); //NOI18N
-               } else if (number.getMobileProvider() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber.mobileProvider is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() == null) {
-                       // ... throw again
-                       throw new NullPointerException("mobileNumber.mobileProvider.providerId is null"); //NOI18N
-               } else if (number.getMobileProvider().getProviderId() < 1) {
-                       // Id not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.mobileProvider.providerId={0} is not valid.", number.getMobileProvider().getProviderId())); //NOI18N
-               } else if (number.getPhoneNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("mobileNumber.phoneNumber is null"); //NOI18N
-               } else if (number.getPhoneNumber() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("mobileNumber.phoneNumber={0} is not valid.", number.getPhoneNumber())); //NOI18N
-               } else if (this.getMobileProvider() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("this.mobileProvider is null"); //NOI18N
-               } else if (this.getMobileProvider().getProviderId() == null) {
-                       // Throw NPE again ...
-                       throw new NullPointerException("this.mobileProvider.providerId is null"); //NOI18N
-               } else if (this.getMobileProvider().getProviderId() < 0) {
-                       // Invalid id number
-                       throw new IllegalArgumentException(MessageFormat.format("this.mobileProvider.providerId={0} is not valid.", this.getMobileProvider().getProviderId())); //NOI18N
-               } else if (this.getPhoneNumber() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("this.phoneNumber is null"); //NOI18N
-               }
-
-               // Is the mobile provider and number the same?
-               if ((Objects.equals(this.getMobileProvider(), number.getMobileProvider())) && (Objects.equals(this.getPhoneNumber(), number.getPhoneNumber()))) {
-                       // Show message
-                       this.showFacesMessage("form_edit_mobile:mobileNumber", "ERROR_ADMIN_NO_CHANGE_ENTERED", FacesMessage.SEVERITY_WARN); //NOI18N
-
-                       // No difference in both together, no need to edit
-                       return ""; //NOI18N
-               }
-
-               // Set all data
-               number.setMobileProvider(this.getMobileProvider());
-               number.setPhoneNumber(this.getPhoneNumber());
-
-               // Send to bean
-               DialableMobileNumber updatedNumber = this.adminPhoneBean.updateMobileData(number);
-
-               // Fire event
-               this.mobileNumberUpdatedEvent.fire(new AdminMobileNumberUpdatedEvent(updatedNumber));
-
-               // All fine, redirect
-               return "admin_show_mobile"; //NOI18N
-       }
-
        /**
         * Getter for chosen fax number
         * <p>
@@ -733,42 +540,6 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
                this.landLineNumber = landLineNumber;
        }
 
-       /**
-        * Getter for chosen mobile number
-        * <p>
-        * @return mobile number
-        */
-       public DialableMobileNumber getMobileNumber () {
-               return this.mobileNumber;
-       }
-
-       /**
-        * Setter for chosen mobile number
-        * <p>
-        * @param mobileNumber mobile number
-        */
-       public void setMobileNumber (final DialableMobileNumber mobileNumber) {
-               this.mobileNumber = mobileNumber;
-       }
-
-       /**
-        * Getter for mobile provider
-        * <p>
-        * @return Mobile provider
-        */
-       public MobileProvider getMobileProvider () {
-               return this.mobileProvider;
-       }
-
-       /**
-        * Setter for mobile provider
-        * <p>
-        * @param mobileProvider Mobile provider
-        */
-       public void setMobileProvider (final MobileProvider mobileProvider) {
-               this.mobileProvider = mobileProvider;
-       }
-
        /**
         * Getter for phone area code
         * <p>
@@ -889,7 +660,11 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        private DialableFaxNumber createFaxNumber () {
                // Initialize it
-               DialableFaxNumber number = new FaxNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               final DialableFaxNumber number = new FaxNumber(
+                                                               this.getPhoneCountry(),
+                                                               this.getPhoneAreaCode(),
+                                                               this.getPhoneNumber()
+                                               );
 
                // Add all other data
                number.setPhoneEntryCreated(this.getPhoneEntryCreated());
@@ -913,31 +688,11 @@ public class FinancialsAdminPhoneWebRequestBean extends BaseFinancialsBean imple
         */
        private DialableLandLineNumber createLandLineNumber () {
                // Initialize it
-               DialableLandLineNumber number = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
-
-               // Add all other data
-               number.setPhoneEntryCreated(this.getPhoneEntryCreated());
-               number.setPhoneEntryUpdated(this.getPhoneEntryUpdated());
-
-               // Is id number set?
-               if (this.getPhoneId() instanceof Long) {
-                       // Set it
-                       number.setPhoneId(this.getPhoneId());
-               }
-
-               // Return it
-               return number;
-       }
-
-       /**
-        * Returns an instance of a DialableMobileNumber from all fields stored in
-        * this bean.
-        * <p>
-        * @return An instance of a DialableMobileNumber class
-        */
-       private DialableMobileNumber createMobileNumber () {
-               // Initialize it
-               DialableMobileNumber number = new MobileNumber(this.getMobileProvider(), this.getPhoneNumber());
+               final DialableLandLineNumber number = new LandLineNumber(
+                                                                        this.getPhoneCountry(),
+                                                                        this.getPhoneAreaCode(),
+                                                                        this.getPhoneNumber()
+                                                        );
 
                // Add all other data
                number.setPhoneEntryCreated(this.getPhoneEntryCreated());
index 35f54e2748bf7df3804af19e0326ae220cccdd8e..add96103a1a61fa99c447b592080602cdddf0071 100644 (file)
  */
 package org.mxchange.jfinancials.beans.phone;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
-import java.text.MessageFormat;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
-import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
-import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
-import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
-import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
-import org.mxchange.jcontacts.events.mobile.linked.ObservableAdminLinkedMobileNumberEvent;
-import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
-import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
-import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
-import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
-import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
-import org.mxchange.jphone.events.mobile.deleted.AdminDeletedMobileNumberEvent;
-import org.mxchange.jphone.events.mobile.updated.AdminUpdatedMobileNumberEvent;
-import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
-import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
-import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
-import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
 
 /**
  * Regular controller (bean) for phone numbers
@@ -62,33 +34,6 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements
         */
        private static final long serialVersionUID = 491_058_674_675_690_105L;
 
-       /**
-        * All fax numbers
-        */
-       @Inject
-       @NamedCache (cacheName = "faxNumberCache")
-       private Cache<Long, DialableFaxNumber> faxNumberCache;
-
-       /**
-        * All land-line numbers
-        */
-       @Inject
-       @NamedCache (cacheName = "landLineNumberCache")
-       private Cache<Long, DialableLandLineNumber> landLineNumberCache;
-
-       /**
-        * All mobile numbers
-        */
-       @Inject
-       @NamedCache (cacheName = "mobileNumberCache")
-       private Cache<Long, DialableMobileNumber> mobileNumberCache;
-
-       /**
-        * General EJB for phone numbers
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote")
-       private PhoneSessionBeanRemote phoneBean;
-
        /**
         * Default constructor
         */
@@ -97,682 +42,4 @@ public class FinancialsPhoneWebRequestBean extends BaseFinancialsBean implements
                super();
        }
 
-       /**
-        * Observes events being fired when an administrator has added a new
-        * contact.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
-               // The event must be valid
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getAddedContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.addedContact is null"); //NOI18N
-               } else if (event.getAddedContact().getContactId() == null) {
-                       // ... and again
-                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
-               } else if (event.getAddedContact().getContactId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
-               }
-
-               // Update contact's mobile, land-line and fax number
-               this.updateContactPhoneNumbers(event.getAddedContact());
-
-               // Clear this bean
-               this.clear();
-       }
-
-       /**
-        * Event observer for newly added users by administrator
-        * <p>
-        * @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 contact's mobile, land-line and fax number
-               this.updateContactPhoneNumbers(event.getAddedUser().getUserContact());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has deleted a fax
-        * number
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminDeletedFaxNumberEvent (@Observes final AdminDeletedFaxNumberEvent 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.getDeletedFaxNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.deletedFaxNumber is null"); //NOI18N
-               } else if (event.getDeletedFaxNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.deletedFaxNumber.phoneId is null"); //NOI18N
-               } else if (event.getDeletedFaxNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getDeletedFaxNumber(), event.getDeletedFaxNumber().getPhoneId())); //NOI18N
-               }
-
-               // Update contact's mobile, land-line and fax number
-               this.allFaxNumbers().remove(event.getDeletedFaxNumber());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has deleted a land-line
-        * number
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminDeletedLandLineNumberEvent (@Observes final AdminDeletedLandLineNumberEvent 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.getDeletedLandLineNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.deletedLandLineNumber is null"); //NOI18N
-               } else if (event.getDeletedLandLineNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.deletedLandLineNumber.phoneId is null"); //NOI18N
-               } else if (event.getDeletedLandLineNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getDeletedLandLineNumber(), event.getDeletedLandLineNumber().getPhoneId())); //NOI18N
-               }
-
-               // Update contact's mobile, land-line and fax number
-               this.allLandLineNumbers().remove(event.getDeletedLandLineNumber());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has deleted a mobile
-        * number
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminDeletedMobileNumberEvent (@Observes final AdminDeletedMobileNumberEvent 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.getDeletedMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.deletedMobileNumber is null"); //NOI18N
-               } else if (event.getDeletedMobileNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.deletedMobileNumber.phoneId is null"); //NOI18N
-               } else if (event.getDeletedMobileNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getDeletedMobileNumber(), event.getDeletedMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Update contact's mobile, land-line and fax number
-               this.allMobileNumbers().remove(event.getDeletedMobileNumber());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has a linked a fax
-        * number
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminLinkedFaxNumberEvent (@Observes final ObservableAdminLinkedFaxNumberEvent event) {
-               // Is the event fine?
-               if (event == null) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact is null"); //NOI18N
-               } else if (event.getContact().getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
-               } else if (event.getContact().getContactId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
-               } else if (event.getContact().getContactFaxNumber() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactFaxNumber is null"); //NOI18N
-               } else if (event.getContact().getContactFaxNumber().getPhoneId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null"); //NOI18N
-               } else if (event.getContact().getContactFaxNumber().getPhoneId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId=" + event.getContact().getContactFaxNumber().getPhoneId() + " is invalid"); //NOI18N
-               } else if (event.getLinkedFaxNumber() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.linkedFaxNumer is null"); //NOI18N
-               }
-
-               // Is the id number in linked number not set?
-               if (event.getLinkedFaxNumber().getPhoneId() == null) {
-                       // Then it is a new number, so add it from contact as there the id number has been set
-                       this.uniqueAddFaxNumber(event.getContact().getContactFaxNumber());
-               }
-       }
-
-       /**
-        * Observes events being fired when an administrator has a linked a
-        * land-line number
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminLinkedLandLineNumberEvent (@Observes final ObservableAdminLinkedLandLineNumberEvent event) {
-               // Is the event fine?
-               if (event == null) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact is null"); //NOI18N
-               } else if (event.getContact().getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
-               } else if (event.getContact().getContactId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
-               } else if (event.getContact().getContactLandLineNumber() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactLandLineNumber is null"); //NOI18N
-               } else if (event.getContact().getContactLandLineNumber().getPhoneId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null"); //NOI18N
-               } else if (event.getContact().getContactLandLineNumber().getPhoneId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId=" + event.getContact().getContactLandLineNumber().getPhoneId() + " is invalid"); //NOI18N
-               } else if (event.getLinkedLandLineNumber() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.linkedLandLineNumer is null"); //NOI18N
-               }
-
-               // Is the id number in linked number not set?
-               if (event.getLinkedLandLineNumber().getPhoneId() == null) {
-                       // Then it is a new number, so add it from contact as there the id number has been set
-                       this.uniqueAddLandLineNumber(event.getContact().getContactLandLineNumber());
-               }
-       }
-
-       /**
-        * Observes events being fired when an administrator has a linked a mobile
-        * number
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminLinkedMobileNumberEvent (@Observes final ObservableAdminLinkedMobileNumberEvent event) {
-               // Is the event fine?
-               if (event == null) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact is null"); //NOI18N
-               } else if (event.getContact().getContactId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
-               } else if (event.getContact().getContactId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactId=" + event.getContact().getContactId() + " is invalid"); //NOI18N
-               } else if (event.getContact().getContactMobileNumber() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactMobileNumber is null"); //NOI18N
-               } else if (event.getContact().getContactMobileNumber().getPhoneId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId is null"); //NOI18N
-               } else if (event.getContact().getContactMobileNumber().getPhoneId() < 1) {
-                       // Throw again ...
-                       throw new NullPointerException("event.contact.contactMobileNumber.phoneId=" + event.getContact().getContactMobileNumber().getPhoneId() + " is invalid"); //NOI18N
-               } else if (event.getLinkedMobileNumber() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("event.linkedMobileNumer is null"); //NOI18N
-               }
-
-               // Is the id number in linked number not set?
-               if (event.getLinkedMobileNumber().getPhoneId() == null) {
-                       // Then it is a new number, so add it from contact as there the id number has been set
-                       this.uniqueAddMobileNumber(event.getContact().getContactMobileNumber());
-               }
-       }
-
-       /**
-        * Observes events being fired when an administrator has updated contact
-        * data.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent 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.getUpdatedContact() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
-               } else if (event.getUpdatedContact().getContactId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
-               } else if (event.getUpdatedContact().getContactId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
-               }
-
-               // Update contact's mobile, land-line and fax number
-               this.updateContactPhoneNumbers(event.getUpdatedContact());
-
-               // Clear all data
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has updated a fax
-        * number.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminUpdatedFaxNumberEvent (@Observes final AdminUpdatedFaxNumberEvent 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.getUpdatedFaxNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedFaxNumber is null"); //NOI18N
-               } else if (event.getUpdatedFaxNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedFaxNumber.phoneId is null"); //NOI18N
-               } else if (event.getUpdatedFaxNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getUpdatedFaxNumber(), event.getUpdatedFaxNumber().getPhoneId())); //NOI18N
-               }
-
-               // Uniquely add it
-               this.uniqueAddFaxNumber(event.getUpdatedFaxNumber());
-
-               // Clear it
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has updated a land-line
-        * number.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminUpdatedLandLineNumberEvent (@Observes final AdminUpdatedLandLineNumberEvent 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.getUpdatedLandLineNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedLandLineNumber is null"); //NOI18N
-               } else if (event.getUpdatedLandLineNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedLandLineNumber.phoneId is null"); //NOI18N
-               } else if (event.getUpdatedLandLineNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getUpdatedLandLineNumber(), event.getUpdatedLandLineNumber().getPhoneId())); //NOI18N
-               }
-
-               // Uniquely add it
-               this.uniqueAddLandLineNumber(event.getUpdatedLandLineNumber());
-
-               // Clear it
-               this.clear();
-       }
-
-       /**
-        * Observes events being fired when an administrator has updated a mobile
-        * number.
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterAdminUpdatedMobileNumberEvent (@Observes final AdminUpdatedMobileNumberEvent 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.getUpdatedMobileNumber() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.updatedMobileNumber is null"); //NOI18N
-               } else if (event.getUpdatedMobileNumber().getPhoneId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.updatedMobileNumber.phoneId is null"); //NOI18N
-               } else if (event.getUpdatedMobileNumber().getPhoneId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getUpdatedMobileNumber(), event.getUpdatedMobileNumber().getPhoneId())); //NOI18N
-               }
-
-               // Uniquely add it
-               this.uniqueAddMobileNumber(event.getUpdatedMobileNumber());
-
-               // Clear it
-               this.clear();
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<DialableFaxNumber> allFaxNumbers () {
-               // Init list
-               final List<DialableFaxNumber> list = new LinkedList<>();
-
-               // Loop over all
-               for (final Cache.Entry<Long, DialableFaxNumber> currentEntry : this.faxNumberCache) {
-                       // Add value to list
-                       list.add(currentEntry.getValue());
-               }
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<DialableLandLineNumber> allLandLineNumbers () {
-               // Init list
-               final List<DialableLandLineNumber> list = new LinkedList<>();
-
-               // Loop over all
-               for (final Cache.Entry<Long, DialableLandLineNumber> currentEntry : this.landLineNumberCache) {
-                       // Add value to list
-                       list.add(currentEntry.getValue());
-               }
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<DialableMobileNumber> allMobileNumbers () {
-               // Init list
-               final List<DialableMobileNumber> list = new LinkedList<>();
-
-               // Loop over all
-               for (final Cache.Entry<Long, DialableMobileNumber> currentEntry : this.mobileNumberCache) {
-                       // Add value to list
-                       list.add(currentEntry.getValue());
-               }
-
-               // Return it
-               return list;
-       }
-
-       @Override
-       public DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException {
-               // Validate paramter
-               if (null == faxNumberId) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumberId is null"); //NOI18N
-               } else if (faxNumberId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("faxNumberId=" + faxNumberId + " is invalid."); //NOI18N
-               } else if (!this.faxNumberCache.containsKey(faxNumberId)) {
-                       // Not found
-                       throw new PhoneEntityNotFoundException(faxNumberId);
-               }
-
-               // Get it from cache
-               final DialableFaxNumber faxNumber = this.faxNumberCache.get(faxNumberId);
-
-               // Return it
-               return faxNumber;
-       }
-
-       @Override
-       public DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException {
-               // Validate paramter
-               if (null == landLineNumberId) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumberId is null"); //NOI18N
-               } else if (landLineNumberId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("landLineNumberId=" + landLineNumberId + " is invalid."); //NOI18N
-               } else if (!this.landLineNumberCache.containsKey(landLineNumberId)) {
-                       // Not found
-                       throw new PhoneEntityNotFoundException(landLineNumberId);
-               }
-
-               // Get it from cache
-               final DialableLandLineNumber landLineNumber = this.landLineNumberCache.get(landLineNumberId);
-
-               // Return it
-               return landLineNumber;
-       }
-
-       @Override
-       public DialableMobileNumber findMobileNumberById (final Long mobileNumberId) throws PhoneEntityNotFoundException {
-               // Validate paramter
-               if (null == mobileNumberId) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumberId is null"); //NOI18N
-               } else if (mobileNumberId < 1) {
-                       // Throw IAE
-                       throw new IllegalArgumentException("mobileNumberId=" + mobileNumberId + " is invalid."); //NOI18N
-               } else if (!this.mobileNumberCache.containsKey(mobileNumberId)) {
-                       // Not found
-                       throw new PhoneEntityNotFoundException(mobileNumberId);
-               }
-
-               // Get it from cache
-               final DialableMobileNumber mobileNumber = this.mobileNumberCache.get(mobileNumberId);
-
-               // Return it
-               return mobileNumber;
-       }
-
-       /**
-        * Post-construction method
-        */
-       @PostConstruct
-       public void init () {
-               // Is cache there?
-               if (!this.faxNumberCache.iterator().hasNext()) {
-                       // Add all
-                       for (final DialableFaxNumber faxNumber : this.phoneBean.allFaxNumbers()) {
-                               // Add it to cache
-                               this.faxNumberCache.put(faxNumber.getPhoneId(), faxNumber);
-                       }
-               }
-
-               // Is cache there?
-               if (!this.landLineNumberCache.iterator().hasNext()) {
-                       // Add all
-                       for (final DialableLandLineNumber lineNumber : this.phoneBean.allLandLineNumbers()) {
-                               // Add it to cache
-                               this.landLineNumberCache.put(lineNumber.getPhoneId(), lineNumber);
-                       }
-               }
-
-               // Is cache there?
-               if (!this.mobileNumberCache.iterator().hasNext()) {
-                       // Add all
-                       for (final DialableMobileNumber mobileNumber : this.phoneBean.allMobileNumbers()) {
-                               // Add it to cache
-                               this.mobileNumberCache.put(mobileNumber.getPhoneId(), mobileNumber);
-                       }
-               }
-       }
-
-       /**
-        * Clears this bean
-        */
-       private void clear () {
-               // Clear all data
-       }
-
-       /**
-        * Uniquely add given fax number to this bean's list. First remove the old
-        * instance (by id number), then re-add it again.
-        * <p>
-        * @param faxNumber number to add
-        */
-       private void uniqueAddFaxNumber (final DialableFaxNumber faxNumber) {
-               // Make sure the parameter is valid
-               if (null == faxNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("faxNumber is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
-               } else if (faxNumber.getPhoneId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId())); //NOI18N
-               }
-
-               // First remove it
-               if (!this.allFaxNumbers().remove(faxNumber)) {
-                       // Did not work, try by id number
-                       for (final DialableFaxNumber fax : this.allFaxNumbers()) {
-                               // Is id number the same?
-                               if (Objects.equals(fax.getPhoneId(), faxNumber.getPhoneId())) {
-                                       // Found it
-                                       this.allFaxNumbers().remove(fax);
-                                       break;
-                               }
-                       }
-               }
-
-               // ... then add it
-               this.allFaxNumbers().add(faxNumber);
-       }
-
-       /**
-        * Uniquely add given land-line number to this bean's list. First remove the
-        * old instance (by id number), then re-add it again.
-        * <p>
-        * @param landLineNumber Land-line number to add
-        */
-       private void uniqueAddLandLineNumber (final DialableLandLineNumber landLineNumber) {
-               // Make sure the parameter is valid
-               if (null == landLineNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("landLineNumber is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
-               } else if (landLineNumber.getPhoneId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId())); //NOI18N
-               }
-
-               // First remove it
-               if (!this.allLandLineNumbers().remove(landLineNumber)) {
-                       // Did not work, try by id number
-                       for (final DialableLandLineNumber landLine : this.allLandLineNumbers()) {
-                               // Is id number the same?
-                               if (Objects.equals(landLine.getPhoneId(), landLineNumber.getPhoneId())) {
-                                       // Found it
-                                       this.allLandLineNumbers().remove(landLine);
-                                       break;
-                               }
-                       }
-               }
-
-               // ... then add it
-               this.allLandLineNumbers().add(landLineNumber);
-       }
-
-       /**
-        * Uniquely add given mobile number to this bean's list. First remove the
-        * old instance (by id number), then re-add it again.
-        * <p>
-        * @param mobileNumber Mobile number to add
-        */
-       private void uniqueAddMobileNumber (final DialableMobileNumber mobileNumber) {
-               // Make sure the parameter is valid
-               if (null == mobileNumber) {
-                       // Throw NPE
-                       throw new NullPointerException("mobileNumber is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("mobileNumber.phoneId is null"); //NOI18N
-               } else if (mobileNumber.getPhoneId() < 1) {
-                       // Not valid
-                       throw new IllegalArgumentException(MessageFormat.format("mobileNumber.phoneId={0} is not valid.", mobileNumber.getPhoneId())); //NOI18N
-               }
-
-               // First remove it by object
-               if (!this.allMobileNumbers().remove(mobileNumber)) {
-                       // Did not work, try by id number
-                       for (final DialableMobileNumber cell : this.allMobileNumbers()) {
-                               // Is id number the same?
-                               if (Objects.equals(cell.getPhoneId(), mobileNumber.getPhoneId())) {
-                                       // Found it
-                                       this.allMobileNumbers().remove(cell);
-                                       break;
-                               }
-                       }
-               }
-
-               // ... then add it
-               this.allMobileNumbers().add(mobileNumber);
-       }
-
-       /**
-        * Updates given contact's mobile, land-line and fax number
-        * <p>
-        * @param contact Contact instance
-        */
-       private void updateContactPhoneNumbers (final Contact contact) {
-               // Parameter 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) {
-                       // Id number is not valid
-               }
-
-               // Is mobile set?
-               if (contact.getContactMobileNumber() instanceof DialableMobileNumber) {
-                       // Unique-add it
-                       this.uniqueAddMobileNumber(contact.getContactMobileNumber());
-               }
-
-               // Is land-line set?
-               if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
-                       // Unique-add it
-                       this.uniqueAddLandLineNumber(contact.getContactLandLineNumber());
-               }
-
-               // Is fax set?
-               if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
-                       // Unique-add it
-                       this.uniqueAddFaxNumber(contact.getContactFaxNumber());
-               }
-       }
-
 }
index 7163ebace972426570e64893de06dccc602ec31e..7e1486ff039892a9131c033664b3105525662c72 100644 (file)
 package org.mxchange.jfinancials.beans.phone;
 
 import java.io.Serializable;
-import java.util.List;
-import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
-import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
-import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
-import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 
 /**
  * An interface for a request web controller (bean) for administrative phone
@@ -31,67 +26,4 @@ import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
  */
 public interface FinancialsPhoneWebRequestController extends Serializable {
 
-       /**
-        * Returns a list of all mobile numbers. For performance reasons, the
-        * controller (bean) should be application-scoped as from user to user
-        * nothing changes. And the controller's post-construct method should load
-        * all numbers and cache it in the controller.
-        * <p>
-        * @return List of all mobile numbers
-        */
-       List<DialableMobileNumber> allMobileNumbers ();
-
-       /**
-        * Returns a list of all fax numbers. For performance reasons, the
-        * controller (bean) should be application-scoped as from user to user
-        * nothing changes. And the controller's post-construct method should load
-        * all numbers and cache it in the controller.
-        * <p>
-        * @return List of all fax numbers
-        */
-       List<DialableFaxNumber> allFaxNumbers ();
-
-       /**
-        * Returns a list of all land-line numbers. For performance reasons, the
-        * controller (bean) should be application-scoped as from user to user
-        * nothing changes. And the controller's post-construct method should load
-        * all numbers and cache it in the controller.
-        * <p>
-        * @return List of all land-line numbers
-        */
-       List<DialableLandLineNumber> allLandLineNumbers ();
-
-       /**
-        * Finds a fax entry by given id number
-        * <p>
-        * @param faxNumberId Fax entry id number
-        * <p>
-        * @return A valid fax instance
-        * <p>
-        * @throws PhoneEntityNotFoundException If the entity was not found
-        */
-       DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException;
-
-       /**
-        * Finds a land-line entry by given id number
-        * <p>
-        * @param landLineNumberId Land-line entry id number
-        * <p>
-        * @return A valid land-line instance
-        * <p>
-        * @throws PhoneEntityNotFoundException If the entity was not found
-        */
-       DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException;
-
-       /**
-        * Finds a mobile entry by given id number
-        * <p>
-        * @param mobileNumberId Mobile entry id number
-        * <p>
-        * @return A valid mobile instance
-        * <p>
-        * @throws PhoneEntityNotFoundException If the entity was not found
-        */
-       DialableMobileNumber findMobileNumberById (Long mobileNumberId) throws PhoneEntityNotFoundException;
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/phone/list/FinancialsPhoneListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/phone/list/FinancialsPhoneListWebViewBean.java
new file mode 100644 (file)
index 0000000..58642ae
--- /dev/null
@@ -0,0 +1,636 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.phone.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.jcontacts.events.contact.add.ObservableAdminAddedContactEvent;
+import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContactEvent;
+import org.mxchange.jcontacts.events.fax.linked.ObservableAdminLinkedFaxNumberEvent;
+import org.mxchange.jcontacts.events.landline.linked.ObservableAdminLinkedLandLineNumberEvent;
+import org.mxchange.jcontacts.model.contact.Contact;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jphone.events.fax.deleted.AdminDeletedFaxNumberEvent;
+import org.mxchange.jphone.events.fax.updated.AdminUpdatedFaxNumberEvent;
+import org.mxchange.jphone.events.landline.deleted.AdminDeletedLandLineNumberEvent;
+import org.mxchange.jphone.events.landline.updated.AdminUpdatedLandLineNumberEvent;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote;
+
+/**
+ * Administrative listing controller (bean) for phone numbers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("phoneListController")
+@ViewScoped
+public class FinancialsPhoneListWebViewBean extends BaseFinancialsBean implements FinancialsPhoneListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 491_058_674_675_690_107L;
+
+       /**
+        * A list of all fax numbers
+        */
+       private final List<DialableFaxNumber> allFaxNumbers;
+
+       /**
+        * A list of all land-line numbers
+        */
+       private final List<DialableLandLineNumber> allLandLineNumbers;
+
+       /**
+        * All fax numbers
+        */
+       @Inject
+       @NamedCache (cacheName = "faxNumberCache")
+       private transient Cache<Long, DialableFaxNumber> faxNumberCache;
+
+       /**
+        * A list of filtered fax numbers
+        */
+       private List<DialableFaxNumber> filteredFaxNumbers;
+
+       /**
+        * A list of filtered land-line numbers
+        */
+       private List<DialableLandLineNumber> filteredLandLineNumbers;
+
+       /**
+        * All land-line numbers
+        */
+       @Inject
+       @NamedCache (cacheName = "landLineNumberCache")
+       private transient Cache<Long, DialableLandLineNumber> landLineNumberCache;
+
+       /**
+        * General EJB for phone numbers
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/phone!org.mxchange.jphone.model.phonenumbers.phone.PhoneSessionBeanRemote")
+       private PhoneSessionBeanRemote phoneBean;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsPhoneListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Initialize lists
+               this.allFaxNumbers = new LinkedList<>();
+               this.allLandLineNumbers = new LinkedList<>();
+       }
+
+       /**
+        * Observes events being fired when an administrator has added a new
+        * contact.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminAddedContactEvent (@Observes final ObservableAdminAddedContactEvent event) {
+               // The event must be valid
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getAddedContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.addedContact is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() == null) {
+                       // ... and again
+                       throw new NullPointerException("event.addedContact.contactId is null"); //NOI18N
+               } else if (event.getAddedContact().getContactId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("event.addedContact.contactId={0} is not valid", event.getAddedContact().getContactId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and fax number
+               this.updateContactPhoneNumbers(event.getAddedContact());
+
+               // Clear this bean
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has deleted a fax
+        * number
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminDeletedFaxNumberEvent (@Observes final AdminDeletedFaxNumberEvent 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.getDeletedFaxNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.deletedFaxNumber is null"); //NOI18N
+               } else if (event.getDeletedFaxNumber().getPhoneId() == null) {
+                       // phoneId is null
+                       throw new NullPointerException("event.deletedFaxNumber.phoneId is null"); //NOI18N
+               } else if (event.getDeletedFaxNumber().getPhoneId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getDeletedFaxNumber(), event.getDeletedFaxNumber().getPhoneId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and fax number
+               this.getAllFaxNumbers().remove(event.getDeletedFaxNumber());
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has deleted a land-line
+        * number
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminDeletedLandLineNumberEvent (@Observes final AdminDeletedLandLineNumberEvent 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.getDeletedLandLineNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.deletedLandLineNumber is null"); //NOI18N
+               } else if (event.getDeletedLandLineNumber().getPhoneId() == null) {
+                       // phoneId is null
+                       throw new NullPointerException("event.deletedLandLineNumber.phoneId is null"); //NOI18N
+               } else if (event.getDeletedLandLineNumber().getPhoneId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getDeletedLandLineNumber(), event.getDeletedLandLineNumber().getPhoneId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and fax number
+               this.getAllLandLineNumbers().remove(event.getDeletedLandLineNumber());
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has a linked a fax
+        * number
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminLinkedFaxNumberEvent (@Observes final ObservableAdminLinkedFaxNumberEvent event) {
+               // Is the event fine?
+               if (event == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact is null"); //NOI18N
+               } else if (event.getContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
+               } else if (event.getContact().getContactId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException(MessageFormat.format("event.contact.contactId={0} is invalid", event.getContact().getContactId())); //NOI18N
+               } else if (event.getContact().getContactFaxNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactFaxNumber is null"); //NOI18N
+               } else if (event.getContact().getContactFaxNumber().getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactFaxNumber.phoneId is null"); //NOI18N
+               } else if (event.getContact().getContactFaxNumber().getPhoneId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException(MessageFormat.format("event.contact.contactFaxNumber.phoneId={0} is invalid", event.getContact().getContactFaxNumber().getPhoneId())); //NOI18N
+               } else if (event.getLinkedFaxNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.linkedFaxNumer is null"); //NOI18N
+               }
+
+               // Is the id number in linked number not set?
+               if (event.getLinkedFaxNumber().getPhoneId() == null) {
+                       // Then it is a new number, so add it from contact as there the id number has been set
+                       this.uniqueAddFaxNumber(event.getContact().getContactFaxNumber());
+               }
+       }
+
+       /**
+        * Observes events being fired when an administrator has a linked a
+        * land-line number
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminLinkedLandLineNumberEvent (@Observes final ObservableAdminLinkedLandLineNumberEvent event) {
+               // Is the event fine?
+               if (event == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getContact() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact is null"); //NOI18N
+               } else if (event.getContact().getContactId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactId is null"); //NOI18N
+               } else if (event.getContact().getContactId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException(MessageFormat.format("event.contact.contactId={0} is invalid", event.getContact().getContactId())); //NOI18N
+               } else if (event.getContact().getContactLandLineNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactLandLineNumber is null"); //NOI18N
+               } else if (event.getContact().getContactLandLineNumber().getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.contact.contactLandLineNumber.phoneId is null"); //NOI18N
+               } else if (event.getContact().getContactLandLineNumber().getPhoneId() < 1) {
+                       // Throw again ...
+                       throw new NullPointerException(MessageFormat.format("event.contact.contactLandLineNumber.phoneId={0} is invalid", event.getContact().getContactLandLineNumber().getPhoneId())); //NOI18N
+               } else if (event.getLinkedLandLineNumber() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("event.linkedLandLineNumer is null"); //NOI18N
+               }
+
+               // Is the id number in linked number not set?
+               if (event.getLinkedLandLineNumber().getPhoneId() == null) {
+                       // Then it is a new number, so add it from contact as there the id number has been set
+                       this.uniqueAddLandLineNumber(event.getContact().getContactLandLineNumber());
+               }
+       }
+
+       /**
+        * Observes events being fired when an administrator has updated contact
+        * data.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminUpdatedContactDataEvent (@Observes final ObservableAdminUpdatedContactEvent 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.getUpdatedContact() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedContact is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() == null) {
+                       // phoneId is null
+                       throw new NullPointerException("event.updatedContact.contactId is null"); //NOI18N
+               } else if (event.getUpdatedContact().getContactId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("contactId of contact={0} is not valid: {1}", event.getUpdatedContact(), event.getUpdatedContact().getContactId())); //NOI18N
+               }
+
+               // Update contact's mobile, land-line and fax number
+               this.updateContactPhoneNumbers(event.getUpdatedContact());
+
+               // Clear all data
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has updated a fax
+        * number.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminUpdatedFaxNumberEvent (@Observes final AdminUpdatedFaxNumberEvent 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.getUpdatedFaxNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedFaxNumber is null"); //NOI18N
+               } else if (event.getUpdatedFaxNumber().getPhoneId() == null) {
+                       // phoneId is null
+                       throw new NullPointerException("event.updatedFaxNumber.phoneId is null"); //NOI18N
+               } else if (event.getUpdatedFaxNumber().getPhoneId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getUpdatedFaxNumber(), event.getUpdatedFaxNumber().getPhoneId())); //NOI18N
+               }
+
+               // Uniquely add it
+               this.uniqueAddFaxNumber(event.getUpdatedFaxNumber());
+
+               // Clear it
+               this.clear();
+       }
+
+       /**
+        * Observes events being fired when an administrator has updated a land-line
+        * number.
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterAdminUpdatedLandLineNumberEvent (@Observes final AdminUpdatedLandLineNumberEvent 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.getUpdatedLandLineNumber() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.updatedLandLineNumber is null"); //NOI18N
+               } else if (event.getUpdatedLandLineNumber().getPhoneId() == null) {
+                       // phoneId is null
+                       throw new NullPointerException("event.updatedLandLineNumber.phoneId is null"); //NOI18N
+               } else if (event.getUpdatedLandLineNumber().getPhoneId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("phoneId of contact={0} is not valid: {1}", event.getUpdatedLandLineNumber(), event.getUpdatedLandLineNumber().getPhoneId())); //NOI18N
+               }
+
+               // Uniquely add it
+               this.uniqueAddLandLineNumber(event.getUpdatedLandLineNumber());
+
+               // Clear it
+               this.clear();
+       }
+
+       @Override
+       public DialableFaxNumber findFaxNumberById (final Long phoneId) throws PhoneEntityNotFoundException {
+               // Validate paramter
+               if (null == phoneId) {
+                       // Throw NPE
+                       throw new NullPointerException("phoneId is null"); //NOI18N
+               } else if (phoneId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("phoneId=" + phoneId + " is invalid."); //NOI18N
+               } else if (!this.faxNumberCache.containsKey(phoneId)) {
+                       // Not found
+                       throw new PhoneEntityNotFoundException(phoneId);
+               }
+
+               // Get it from cache
+               final DialableFaxNumber faxNumber = this.faxNumberCache.get(phoneId);
+
+               // Return it
+               return faxNumber;
+       }
+
+       @Override
+       public DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException {
+               // Validate paramter
+               if (null == landLineNumberId) {
+                       // Throw NPE
+                       throw new NullPointerException("landLineNumberId is null"); //NOI18N
+               } else if (landLineNumberId < 1) {
+                       // Throw IAE
+                       throw new IllegalArgumentException(MessageFormat.format("landLineNumberId={0} is invalid.", landLineNumberId)); //NOI18N
+               } else if (!this.landLineNumberCache.containsKey(landLineNumberId)) {
+                       // Not found
+                       throw new PhoneEntityNotFoundException(landLineNumberId);
+               }
+
+               // Get it from cache
+               final DialableLandLineNumber landLineNumber = this.landLineNumberCache.get(landLineNumberId);
+
+               // Return it
+               return landLineNumber;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<DialableFaxNumber> getAllFaxNumbers () {
+               return this.allFaxNumbers;
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<DialableLandLineNumber> getAllLandLineNumbers () {
+               return this.allLandLineNumbers;
+       }
+
+       /**
+        * Getter for filtered fax number list
+        * <p>
+        * @return Filtered fax number list
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<DialableFaxNumber> getFilteredFaxNumbers () {
+               return this.filteredFaxNumbers;
+       }
+
+       /**
+        * Setter for filtered fax number list
+        *
+        * @param filteredFaxNumbers Filtered fax number list
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredFaxNumbers (final List<DialableFaxNumber> filteredFaxNumbers) {
+               this.filteredFaxNumbers = filteredFaxNumbers;
+       }
+
+       /**
+        * Getter for filtered land-line number list
+        * <p>
+        * @return Filtered land-line number list
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<DialableLandLineNumber> getFilteredLandLineNumbers () {
+               return this.filteredLandLineNumbers;
+       }
+
+       /**
+        * Setter for filtered land-line number list
+        *
+        * @param filteredLandLineNumbers Filtered land-line number list
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredLandLineNumbers (final List<DialableLandLineNumber> filteredLandLineNumbers) {
+               this.filteredLandLineNumbers = filteredLandLineNumbers;
+       }
+
+       /**
+        * Post-construction method
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.faxNumberCache.iterator().hasNext()) {
+                       // Add all
+                       for (final DialableFaxNumber currentNumber : this.phoneBean.fetchAllFaxNumbers()) {
+                               // Add it to cache
+                               this.faxNumberCache.put(currentNumber.getPhoneId(), currentNumber);
+                       }
+               }
+
+               // Is cache there?
+               if (!this.landLineNumberCache.iterator().hasNext()) {
+                       // Add all
+                       for (final DialableLandLineNumber currentNumber : this.phoneBean.fetchAllLandLineNumbers()) {
+                               // Add it to cache
+                               this.landLineNumberCache.put(currentNumber.getPhoneId(), currentNumber);
+                       }
+               }
+
+               // Is cache filled and list is empty
+               if ((this.faxNumberCache.iterator().hasNext()) && (this.getAllFaxNumbers().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, DialableFaxNumber> currentEntry : this.faxNumberCache) {
+                               // Add to list
+                               this.getAllFaxNumbers().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllFaxNumbers().sort(new Comparator<DialableFaxNumber>() {
+                               @Override
+                               public int compare (final DialableFaxNumber faxNumber1, final DialableFaxNumber faxNumber2) {
+                                       return faxNumber1.getPhoneId() > faxNumber2.getPhoneId() ? 1 : faxNumber1.getPhoneId() < faxNumber2.getPhoneId() ? -1 : 0;
+                               }
+                       });
+
+                       // Set full list
+                       this.setFilteredFaxNumbers(this.getAllFaxNumbers());
+               }
+
+               // Is cache filled and list is empty
+               if ((this.landLineNumberCache.iterator().hasNext()) && (this.getAllLandLineNumbers().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, DialableLandLineNumber> currentEntry : this.landLineNumberCache) {
+                               // Add to list
+                               this.getAllLandLineNumbers().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllLandLineNumbers().sort(new Comparator<DialableLandLineNumber>() {
+                               @Override
+                               public int compare (final DialableLandLineNumber landLineNumber1, final DialableLandLineNumber landLineNumber2) {
+                                       return landLineNumber1.getPhoneId() > landLineNumber2.getPhoneId() ? 1 : landLineNumber1.getPhoneId() < landLineNumber2.getPhoneId() ? -1 : 0;
+                               }
+                       });
+
+                       // Set full list
+                       this.setFilteredLandLineNumbers(this.getAllLandLineNumbers());
+               }
+       }
+
+       /**
+        * Clears this bean
+        */
+       private void clear () {
+               // Clear all data
+       }
+
+       /**
+        * Uniquely add given fax number to this bean's list. First remove the old
+        * instance (by id number), then re-add it again.
+        * <p>
+        * @param faxNumber number to add
+        */
+       private void uniqueAddFaxNumber (final DialableFaxNumber faxNumber) {
+               // Make sure the parameter is valid
+               if (null == faxNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("faxNumber is null"); //NOI18N
+               } else if (faxNumber.getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("faxNumber.phoneId is null"); //NOI18N
+               } else if (faxNumber.getPhoneId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("faxNumber.phoneId={0} is not valid.", faxNumber.getPhoneId())); //NOI18N
+               }
+
+               // First remove it
+               if (!this.getAllFaxNumbers().remove(faxNumber)) {
+                       // Did not work, try by id number
+                       for (final DialableFaxNumber currentNumber : this.getAllFaxNumbers()) {
+                               // Is id number the same?
+                               if (Objects.equals(currentNumber.getPhoneId(), faxNumber.getPhoneId())) {
+                                       // Found it
+                                       this.getAllFaxNumbers().remove(currentNumber);
+                                       break;
+                               }
+                       }
+               }
+
+               // ... then add it
+               this.getAllFaxNumbers().add(faxNumber);
+       }
+
+       /**
+        * Uniquely add given land-line number to this bean's list. First remove the
+        * old instance (by id number), then re-add it again.
+        * <p>
+        * @param landLineNumber Land-line number to add
+        */
+       private void uniqueAddLandLineNumber (final DialableLandLineNumber landLineNumber) {
+               // Make sure the parameter is valid
+               if (null == landLineNumber) {
+                       // Throw NPE
+                       throw new NullPointerException("landLineNumber is null"); //NOI18N
+               } else if (landLineNumber.getPhoneId() == null) {
+                       // Throw again ...
+                       throw new NullPointerException("landLineNumber.phoneId is null"); //NOI18N
+               } else if (landLineNumber.getPhoneId() < 1) {
+                       // Not valid
+                       throw new IllegalArgumentException(MessageFormat.format("landLineNumber.phoneId={0} is not valid.", landLineNumber.getPhoneId())); //NOI18N
+               }
+
+               // First remove it
+               if (!this.getAllLandLineNumbers().remove(landLineNumber)) {
+                       // Did not work, try by id number
+                       for (final DialableLandLineNumber currentNumber : this.getAllLandLineNumbers()) {
+                               // Is id number the same?
+                               if (Objects.equals(currentNumber.getPhoneId(), landLineNumber.getPhoneId())) {
+                                       // Found it
+                                       this.getAllLandLineNumbers().remove(currentNumber);
+                                       break;
+                               }
+                       }
+               }
+
+               // ... then add it
+               this.getAllLandLineNumbers().add(landLineNumber);
+       }
+
+       /**
+        * Updates given contact's mobile, land-line and fax number
+        * <p>
+        * @param contact Contact instance
+        */
+       private void updateContactPhoneNumbers (final Contact contact) {
+               // Parameter 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) {
+                       // Id number is not valid
+               }
+
+               // Is land-line set?
+               if (contact.getContactLandLineNumber() instanceof DialableLandLineNumber) {
+                       // Unique-add it
+                       this.uniqueAddLandLineNumber(contact.getContactLandLineNumber());
+               }
+
+               // Is fax set?
+               if (contact.getContactFaxNumber() instanceof DialableFaxNumber) {
+                       // Unique-add it
+                       this.uniqueAddFaxNumber(contact.getContactFaxNumber());
+               }
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/phone/list/FinancialsPhoneListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/phone/list/FinancialsPhoneListWebViewController.java
new file mode 100644 (file)
index 0000000..24176e8
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.phone.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
+import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
+
+/**
+ * An interface for a request web controller (bean) for administrative phone
+ * number purposes.
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsPhoneListWebViewController extends Serializable {
+
+       /**
+        * Returns a list of all fax numbers. For performance reasons, the
+        * controller (bean) should be view-scoped as from user to user nothing
+        * changes. And the controller's post-construct method should load all
+        * numbers and cache it in the controller.
+        * <p>
+        * @return List of all fax numbers
+        */
+       List<DialableFaxNumber> getAllFaxNumbers ();
+
+       /**
+        * Returns a list of all land-line numbers. For performance reasons, the
+        * controller (bean) should be view-scoped as from user to user nothing
+        * changes. And the controller's post-construct method should load all
+        * numbers and cache it in the controller.
+        * <p>
+        * @return List of all land-line numbers
+        */
+       List<DialableLandLineNumber> getAllLandLineNumbers ();
+
+       /**
+        * Finds a fax entry by given id number
+        * <p>
+        * @param faxNumberId Fax entry id number
+        * <p>
+        * @return A valid fax instance
+        * <p>
+        * @throws PhoneEntityNotFoundException If the entity was not found
+        */
+       DialableFaxNumber findFaxNumberById (final Long faxNumberId) throws PhoneEntityNotFoundException;
+
+       /**
+        * Finds a land-line entry by given id number
+        * <p>
+        * @param landLineNumberId Land-line entry id number
+        * <p>
+        * @return A valid land-line instance
+        * <p>
+        * @throws PhoneEntityNotFoundException If the entity was not found
+        */
+       DialableLandLineNumber findLandLineNumberById (final Long landLineNumberId) throws PhoneEntityNotFoundException;
+
+}
index 9c5cf60726f57139cfe52ce426a292c92a613d02..8de1935c3e5217582acd5d5a8d57a9dbfbaf04fb 100644 (file)
@@ -48,8 +48,7 @@ import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
 import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
 import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
 import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
-import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
-import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
+import org.mxchange.jusercore.events.user.update.post.AdminPostUserDataUpdatedEvent;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
@@ -66,6 +65,7 @@ import org.mxchange.juserlogincore.container.login.UserLoginContainer;
 import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.juserlogincore.exceptions.UserPasswordRepeatMismatchException;
 import org.mxchange.juserlogincore.login.UserLoginUtils;
+import org.mxchange.jusercore.events.user.update.post.ObservableAdminPostUserDataUpdatedEvent;
 
 /**
  * A user bean (controller)
@@ -129,7 +129,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem
         */
        @Inject
        @Any
-       private Event<ObservableAdminUpdatedUserDataEvent> updatedUserDataEvent;
+       private Event<ObservableAdminPostUserDataUpdatedEvent> updatedUserDataEvent;
 
        /**
         * User instance
@@ -431,7 +431,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem
                final User updatedUser = this.userBean.updateUserData(this.getUser());
 
                // Fire event
-               this.updatedUserDataEvent.fire(new AdminUpdatedUserDataEvent(updatedUser));
+               this.updatedUserDataEvent.fire(new AdminPostUserDataUpdatedEvent(updatedUser));
        }
 
        /**
index 23bc0e50aef143416d3b1ed19ec37c7709ed9310..8b09b11e14d1d18c2bc7f6f64bd1acc0f22e3859 100644 (file)
  */
 package org.mxchange.jfinancials.beans.user;
 
-import java.text.MessageFormat;
-import java.util.Objects;
-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.context.FacesContext;
-import javax.faces.view.facelets.FaceletException;
-import javax.inject.Inject;
 import javax.inject.Named;
-import org.mxchange.jcontacts.model.contact.Contact;
 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.linked.ObservableAdminLinkedUserEvent;
-import org.mxchange.jusercore.events.user.update.ObservableUpdatedUserPersonalDataEvent;
-import org.mxchange.jusercore.events.user.update.UpdatedUserPersonalDataEvent;
-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.login.ObservableUserLoggedInEvent;
-import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
-import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
-import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
-import org.mxchange.juserlogincore.login.UserLoginUtils;
 
 /**
  * A user bean (controller)
@@ -64,68 +34,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
         */
        private static final long serialVersionUID = 542_145_347_916L;
 
-       /**
-        * General contact controller
-        */
-       @Inject
-       private FinancialsContactWebRequestController contactController;
-
-       /**
-        * Features controller
-        */
-       @Inject
-       private FinancialsFeaturesWebApplicationController featureController;
-
-       /**
-        * Localization controller
-        */
-       @Inject
-       private FinancialsLocalizationSessionController localizationController;
-
-       /**
-        * Event being fired when user updated personal data
-        */
-       @Inject
-       @Any
-       private Event<ObservableUpdatedUserPersonalDataEvent> updatedPersonalDataEvent;
-
-       /**
-        * Remote user bean
-        */
-       @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
-       private UserSessionBeanRemote userBean;
-
-       /**
-        * User id
-        */
-       private Long userId;
-
-       /**
-        * Login controller (bean)
-        */
-       @Inject
-       private FinancialsUserLoginWebSessionController userLoginController;
-
-       /**
-        * User name
-        */
-       private String userName;
-
-       /**
-        * User password (clear-text from web form)
-        */
-       private String userPassword;
-
-       /**
-        * User password repeated (clear-text from web form)
-        */
-       private String userPasswordRepeat;
-
-       /**
-        * Whether the user wants a public profile
-        */
-       private ProfileMode userProfileMode;
-
        /**
         * Default constructor
         */
@@ -134,483 +42,4 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements
                super();
        }
 
-       /**
-        * Event observer for newly added users by administrator
-        * <p>
-        * @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
-               }
-
-               // Set user id again
-               this.setUserId(event.getAddedUser().getUserId());
-       }
-
-       /**
-        * Event observer for linked users with existing contact data
-        * <p>
-        * @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
-               }
-
-               // Set user id again
-               this.setUserId(event.getLinkedUser().getUserId());
-       }
-
-       /**
-        * 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
-        * should not fire but instead a proper exception must be thrown.
-        * <p>
-        * @param event User created event
-        */
-       public void afterCreatedUserEvent (@Observes final ObservableCreatedUserEvent event) {
-               // Is the instance valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getCreatedUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.createdUser is null"); //NOI18N
-               } else if (event.getCreatedUser().getUserId() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.createdUser.userId is null"); //NOI18N
-               } else if (event.getCreatedUser().getUserId() < 1) {
-                       // Throw NPE again
-                       throw new NullPointerException(MessageFormat.format("event.createdUser.userId={0} is not valid", event.getCreatedUser().getUserId())); //NOI18N
-               }
-
-               // Get user instance
-               final User user = event.getCreatedUser();
-
-               // Set all fields here
-               this.copyUser(user);
-       }
-
-       /**
-        * Event observer for logged-in user
-        * <p>
-        * @param event Event instance
-        */
-       public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent 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.getLoggedInUser() == null) {
-                       // Throw NPE again
-                       throw new NullPointerException("event.registeredUser is null"); //NOI18N
-               } else if (event.getLoggedInUser().getUserId() == null) {
-                       // userId is null
-                       throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
-               } else if (event.getLoggedInUser().getUserId() < 1) {
-                       // Not avalid id
-                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
-               }
-
-               // "Cache" user instance
-               final User loggedInUser = event.getLoggedInUser();
-
-               // Copy all data to this bean
-               this.copyUser(loggedInUser);
-       }
-
-       /**
-        * Event observer for user password changes
-        * <p>
-        * @param event Event being fired
-        */
-       public void afterUserPasswordChangedEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
-               // Is it valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               } else if (event.getUserPassword() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("event.userPassword is null"); //NOI18N
-               } else if (event.getUserPassword().isEmpty()) {
-                       // Throw NPE
-                       throw new IllegalArgumentException("event.userPassword is empty"); //NOI18N
-               }
-
-               // Set it here
-               this.setUserPassword(event.getUserPassword());
-               this.setUserPasswordRepeat(event.getUserPassword());
-       }
-
-       /**
-        * Event observer for new user registrations
-        * <p>
-        * @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
-               }
-
-               // Get user instance
-               final User registeredUser = event.getRegisteredUser();
-
-               // Copy all data from registered->user
-               this.copyUser(registeredUser);
-
-               // Set user id again
-               this.setUserId(registeredUser.getUserId());
-       }
-
-       /**
-        * Event observer for when a user name should be cleared
-        * <p>
-        * @param event Event being fired
-        */
-       public void clearUserNameEvent (@Observes final ObservableClearUserNameEvent event) {
-               // Is it valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               }
-
-               // Clear it
-               this.clearUserName();
-       }
-
-       /**
-        * Event observer for when both user passwords should be cleared
-        * <p>
-        * @param event Event being fired
-        */
-       public void clearUserPasswordEvent (@Observes final ObservableClearUserPasswordEvent event) {
-               // Is it valid?
-               if (null == event) {
-                       // Throw NPE
-                       throw new NullPointerException("event is null"); //NOI18N
-               }
-
-               // Clear it
-               this.clearUserPasswords();
-       }
-
-       @Override
-       public User createUserInstance (final boolean createContactData) {
-               // Required personal data must be set
-               assert (this.isRequiredPersonalDataSet()) : "not all personal data is set"; //NOI18N
-
-               // Is user name required?
-               if (!this.isUserNameRequired()) {
-                       // Generate pseudo-random user name
-                       // @TODO Refacture this to avoid EJB call
-                       final String randomName = this.userBean.generateRandomUserName();
-
-                       // Set it and inivisible profile
-                       this.setUserName(randomName);
-                       this.setUserProfileMode(ProfileMode.INVISIBLE);
-
-                       // Generate random password
-                       final String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
-
-                       // Set random password
-                       this.setUserPassword(randomPassword);
-                       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.localizationController.getLocale());
-
-               // Is multiple registration page
-               if ((createContactData) || (!this.featureController.isFeatureEnabled("user_register_multiple_page"))) { //NOI18N
-                       // Create contact instance
-                       final Contact contact = this.contactController.createContactInstance();
-
-                       // Set contact in user
-                       user.setUserContact(contact);
-               }
-
-               // Return it
-               return user;
-       }
-
-       @Override
-       public User createUserLogin () {
-               // Is all data set?
-               if (this.getUserName() == null) {
-                       // Throw NPE
-                       throw new NullPointerException("userName is null"); //NOI18N
-               } else if (this.getUserName().isEmpty()) {
-                       // Is empty
-                       throw new IllegalStateException("userName is empty."); //NOI18N
-               }
-
-               // Create new user instance
-               final User user = new LoginUser();
-
-               // Update all data ...
-               user.setUserName(this.getUserName());
-
-               // Return the new instance
-               return user;
-       }
-
-       @Override
-       public String doChangePersonalData () {
-               // This method shall only be called if the user is logged-in
-               if (!this.userLoginController.isUserLoggedIn()) {
-                       // Not logged-in
-                       throw new IllegalStateException("User is not logged-in"); //NOI18N
-               } else if (!this.isRequiredChangePersonalDataSet()) {
-                       // Not all required fields are set
-                       throw new FaceletException("Not all required fields are set."); //NOI18N
-               } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
-                       // Password not matching
-                       throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
-               } else if (!this.featureController.isFeatureEnabled("change_user_personal_data")) { //NOI18N
-                       // Editing is not allowed
-                       throw new IllegalStateException("User tried to edit personal data."); //NOI18N
-               }
-
-               // Get user instance
-               final User user = this.userLoginController.getLoggedInUser();
-
-               // Copy contact data to contact instance
-               this.contactController.updateContactDataFromController(user.getUserContact());
-
-               // It should be there, so run some tests on it
-               assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; //NOI18N
-               assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; //NOI18N
-               assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
-               assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
-               assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N
-               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
-
-               // Update all fields
-               user.setUserProfileMode(this.getUserProfileMode());
-
-               // Send it to the EJB
-               final User updatedUser = this.userBean.updateUserPersonalData(user);
-
-               // Fire event
-               this.updatedPersonalDataEvent.fire(new UpdatedUserPersonalDataEvent(updatedUser));
-
-               // All fine
-               return "user_contact_data_saved"; //NOI18N
-       }
-
-       /**
-        * Getter for user id
-        * <p>
-        * @return User id
-        */
-       public Long getUserId () {
-               return this.userId;
-       }
-
-       /**
-        * Setter for user id
-        * <p>
-        * @param userId User id
-        */
-       public void setUserId (final Long userId) {
-               this.userId = userId;
-       }
-
-       /**
-        * Getter for user name
-        * <p>
-        * @return User name
-        */
-       public String getUserName () {
-               return this.userName;
-       }
-
-       /**
-        * Setter for user name
-        * <p>
-        * @param userName User name
-        */
-       public void setUserName (final String userName) {
-               this.userName = userName;
-       }
-
-       @Override
-       public String getUserPassword () {
-               return this.userPassword;
-       }
-
-       /**
-        * Setter for clear-text user password
-        * <p>
-        * @param userPassword Clear-text user password
-        */
-       public void setUserPassword (final String userPassword) {
-               this.userPassword = userPassword;
-       }
-
-       /**
-        * Getter for clear-text user password repeated
-        * <p>
-        * @return Clear-text user password repeated
-        */
-       public String getUserPasswordRepeat () {
-               return this.userPasswordRepeat;
-       }
-
-       /**
-        * Setter for clear-text user password repeated
-        * <p>
-        * @param userPasswordRepeat Clear-text user password repeated
-        */
-       public void setUserPasswordRepeat (final String userPasswordRepeat) {
-               this.userPasswordRepeat = userPasswordRepeat;
-       }
-
-       /**
-        * Getter for user profile mode
-        * <p>
-        * @return User profile mode
-        */
-       public ProfileMode getUserProfileMode () {
-               return this.userProfileMode;
-       }
-
-       /**
-        * Setter for user profile mode
-        * <p>
-        * @param userProfileMode User profile mode
-        */
-       public void setUserProfileMode (final ProfileMode userProfileMode) {
-               this.userProfileMode = userProfileMode;
-       }
-
-       @Override
-       public boolean ifBothPasswordsEmptyAllowed () {
-               // Check feature first
-               return ((this.featureController.isFeatureEnabled("allow_user_registration_empty_password")) && //NOI18N
-                               ((this.getUserPassword() == null) || (this.getUserPassword().isEmpty())) &&
-                               ((this.getUserPasswordRepeat() == null) || (this.getUserPasswordRepeat().isEmpty())));
-       }
-
-       @Override
-       public boolean isRequiredChangePersonalDataSet () {
-               return ((this.getUserProfileMode() != null) &&
-                               (this.getUserName() != null) && (!this.getUserName().isEmpty()) &&
-                               (this.contactController.isRequiredChangePersonalDataSet()));
-       }
-
-       @Override
-       public boolean isRequiredPersonalDataSet () {
-               if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N
-                       // Multiple registration page
-                       return this.contactController.isRequiredPersonalDataSet();
-               } else {
-                       // Single registration page
-                       return (((this.getUserName() != null) || (!this.isUserNameRequired())) &&
-                                       (this.getUserProfileMode() != null) &&
-                                       (this.contactController.isRequiredPersonalDataSet()) &&
-                                       (this.getUserPassword() != null) &&
-                                       (this.getUserPasswordRepeat() != null));
-               }
-       }
-
-       @Override
-       public boolean isSamePasswordEntered () {
-               return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
-       }
-
-       @Override
-       public boolean isUserIdEmpty () {
-               return ((this.getUserId() == null) || (this.getUserId() == 0));
-       }
-
-       @Override
-       public boolean isUserNameRequired () {
-               // Get context parameter
-               final String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_user_login_require_user_name"); //NOI18N
-
-               // Is it set?
-               final boolean isRequired = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N
-
-               // Return value
-               return isRequired;
-       }
-
-       /**
-        * Clears user name
-        */
-       private void clearUserName () {
-               // Clear it
-               this.setUserName(null);
-       }
-
-       /**
-        * Clears both user passwords
-        */
-       private void clearUserPasswords () {
-               // Clear both
-               this.setUserPassword(null);
-               this.setUserPasswordRepeat(null);
-       }
-
-       /**
-        * Copies given user into the controller
-        * <p>
-        * @param user User instance
-        */
-       private void copyUser (final User user) {
-               // Make sure the instance is valid
-               if (null == user) {
-                       // Throw NPE
-                       throw new NullPointerException("user is null"); //NOI18N
-               } else if (user.getUserContact() == null) {
-                       // Throw again ...
-                       throw new NullPointerException("user.userContact is null"); //NOI18N
-               }
-
-               // Copy all fields:
-               // - base data
-               this.setUserId(user.getUserId());
-               this.setUserProfileMode(user.getUserProfileMode());
-       }
-
 }
index 8faebffb055ed79c18e254e92a7c6788bd561196..19f369495b39fa4e3d5dbf19410b5c8a7df1ad5f 100644 (file)
@@ -17,7 +17,6 @@
 package org.mxchange.jfinancials.beans.user;
 
 import java.io.Serializable;
-import org.mxchange.jusercore.model.user.User;
 
 /**
  * An interface for user beans
@@ -34,81 +33,4 @@ public interface FinancialsUserWebRequestController extends Serializable {
        @Deprecated
        public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
 
-       /**
-        * Getter for clear-text user password
-        * <p>
-        * @return Clear-text user password
-        */
-       String getUserPassword ();
-
-       /**
-        * Checks if both user passwords are left empty and if this is enabled
-        * (allowed) in context parameter. If true, the calling bean should create a
-        * random password (preferable with UserUtils.createRandomPassword() and set
-        * it in both user password fields.
-        * <p>
-        * @return Whether empty passwords are allowed
-        */
-       boolean ifBothPasswordsEmptyAllowed ();
-
-       /**
-        * Creates an instance from all properties
-        * <p>
-        * @param createContactData Whether contact data should be created
-        * <p>
-        * @return A user instance
-        */
-       User createUserInstance (final boolean createContactData);
-
-       /**
-        * Creates a user instance for login phase
-        * <p>
-        * @return User instance
-        */
-       User createUserLogin ();
-
-       /**
-        * Checks whether all required personal data is set
-        * <p>
-        * @return Whether the required personal data is set
-        */
-       boolean isRequiredPersonalDataSet ();
-
-       /**
-        * Checks whether all required personal data is set for changing them
-        * <p>
-        * @return Whether the required personal data is set
-        */
-       boolean isRequiredChangePersonalDataSet ();
-
-       /**
-        * Checks whether same passwords has been entered
-        * <p>
-        * @return Whether same passwords has been entered
-        */
-       boolean isSamePasswordEntered ();
-
-       /**
-        * Checks if the user id is empty
-        * <p>
-        * @return Whether the user id is empty
-        */
-       boolean isUserIdEmpty ();
-
-       /**
-        * Changes logged-in user's personal data if the current password matches
-        * and TAC + privacy statement has been accepted.
-        * <p>
-        * @return New target page
-        */
-       String doChangePersonalData ();
-
-       /**
-        * Checks whether this application requires a user name to be entered.
-        * Otherwise a random name like "userXXXXX" is generated
-        * <p>
-        * @return Whether this application requires a user name
-        */
-       boolean isUserNameRequired ();
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/user/action/FinancialsUserActionWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/action/FinancialsUserActionWebRequestBean.java
new file mode 100644 (file)
index 0000000..b47710e
--- /dev/null
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.user.action;
+
+import java.text.MessageFormat;
+import javax.ejb.EJB;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jcontacts.model.contact.Contact;
+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.login.FinancialsUserLoginWebSessionController;
+import org.mxchange.jusercore.events.user.update.post.ObservablePostUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.post.PostUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.pre.ObservablePreUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.pre.PreUserPersonalDataUpdatedEvent;
+import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
+import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
+
+/**
+ * A user action bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("userActionController")
+@RequestScoped
+public class FinancialsUserActionWebRequestBean extends BaseFinancialsBean implements FinancialsUserActionWebRequestController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_920L;
+
+       /**
+        * General contact controller
+        */
+       @Inject
+       private FinancialsContactWebRequestController contactController;
+
+       /**
+        * Features controller
+        */
+       @Inject
+       private FinancialsFeaturesWebApplicationController featureController;
+
+       /**
+        * Event being fired when user updated personal data
+        */
+       @Inject
+       @Any
+       private Event<ObservablePostUserPersonalDataUpdatedEvent> postUpdatedPersonalDataEvent;
+
+       /**
+        * Event being fired when user updated personal data
+        */
+       @Inject
+       @Any
+       private Event<ObservablePreUserPersonalDataUpdatedEvent> preUpdatedPersonalDataEvent;
+
+       /**
+        * Remote user bean
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote")
+       private UserSessionBeanRemote userBean;
+
+       /**
+        * Login controller (bean)
+        */
+       @Inject
+       private FinancialsUserLoginWebSessionController userLoginController;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsUserActionWebRequestBean () {
+               // Call super constructor
+               super();
+       }
+
+       @Override
+       public String doChangePersonalData () {
+               // This method shall only be called if the user is logged-in
+               if (!this.userLoginController.isUserLoggedIn()) {
+                       // Not logged-in
+                       throw new IllegalStateException("User is not logged-in"); //NOI18N
+               } else if (!this.contactController.isRequiredChangePersonalDataSet()) {
+                       // Not all required fields are set
+                       throw new FaceletException("Not all required fields are set."); //NOI18N
+               } else if (!this.userLoginController.ifCurrentPasswordMatches()) {
+                       // Password not matching
+                       throw new FaceletException(new UserPasswordMismatchException(this.userLoginController.getLoggedInUser()));
+               } else if (!this.featureController.isFeatureEnabled("change_user_personal_data")) { //NOI18N
+                       // Editing is not allowed
+                       throw new IllegalStateException("User tried to edit personal data."); //NOI18N
+               }
+
+               // Get user instance
+               final User user = this.userLoginController.getLoggedInUser();
+
+               // Fire pre-update event
+               this.preUpdatedPersonalDataEvent.fire(new PreUserPersonalDataUpdatedEvent(user));
+
+               // It should be there, so run some tests on it
+               assert (user instanceof User) : "Instance userLoginController.loggedInUser is null"; //NOI18N
+               assert (user.getUserId() instanceof Long) : "Instance userLoginController.loggedInUser.userId is null"; //NOI18N
+               assert (user.getUserId() > 0) : MessageFormat.format("userLoginController.loggedInUser.userId={0} is invalid", user.getUserId()); //NOI18N
+               assert (user.getUserContact() instanceof Contact) : "Instance userLoginController.loggedInUser.userContact is null"; //NOI18N
+               assert (user.getUserContact().getContactId() instanceof Long) : "Instance userLoginController.userContact.contactId is null"; //NOI18N
+               assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
+
+               // Send it to the EJB
+               final User updatedUser = this.userBean.updateUserPersonalData(user);
+
+               // Fire post-update event
+               this.postUpdatedPersonalDataEvent.fire(new PostUserPersonalDataUpdatedEvent(updatedUser));
+
+               // All fine
+               return "user_contact_data_saved"; //NOI18N
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/user/action/FinancialsUserActionWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/action/FinancialsUserActionWebRequestController.java
new file mode 100644 (file)
index 0000000..ed6cd2d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.user.action;
+
+import java.io.Serializable;
+
+/**
+ * An interface for user beans
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsUserActionWebRequestController extends Serializable {
+
+       /**
+        * Minimum password length
+        * <p>
+        * @deprecated Better set as context parameter
+        */
+       @Deprecated
+       public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+
+       /**
+        * Changes logged-in user's personal data if the current password matches
+        * and TAC + privacy statement has been accepted.
+        * <p>
+        * @return New target page
+        */
+       String doChangePersonalData ();
+
+}
index 7bcbdcf871cb5ad5ae133cfce1364c16dc6b0ceb..0db44971bfd7c5ea6875d03a27adb3ac4c809cb1 100644 (file)
@@ -36,8 +36,6 @@ 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.model.user.User;
 import org.mxchange.jusercore.model.user.activity.LogableUserActivity;
 import org.mxchange.jusercore.model.user.activity.UserActivityLog;
@@ -49,6 +47,8 @@ import org.mxchange.juserlogincore.events.logout.ObservableUserLogoutEvent;
 import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.juserlogincore.events.resendlink.ObservableUserResendLinkAccountEvent;
 import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
+import org.mxchange.jusercore.events.user.update.post.ObservableAdminPostUserDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.post.ObservablePostUserPersonalDataUpdatedEvent;
 
 /**
  * A controller (bean) for user activity log
@@ -221,7 +221,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp
         * <p>
         * @param event Event being updated
         */
-       public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminUpdatedUserDataEvent event) {
+       public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminPostUserDataUpdatedEvent event) {
                // Event and contained entity instance should not be null
                if (null == event) {
                        // Throw NPE
@@ -424,7 +424,7 @@ public class FinancialsUserActivityWebRequestBean extends BaseFinancialsBean imp
         * <p>
         * @param event Event being fired
         */
-       public void afterUserUpdatedPersonalDataEvent (@Observes final ObservableUpdatedUserPersonalDataEvent event) {
+       public void afterUserUpdatedPersonalDataEvent (@Observes final ObservablePostUserPersonalDataUpdatedEvent event) {
                // Check parameter
                if (null == event) {
                        // Throw NPE
index ac1de94e5894012de870cd2febbb595a9327406f..68d46db774488e17ce2517d7aca2cc2ac585e904 100644 (file)
  */
 package org.mxchange.jfinancials.beans.user.email_address;
 
-import fish.payara.cdi.jsr107.impl.NamedCache;
 import java.text.MessageFormat;
 import java.util.Objects;
-import javax.annotation.PostConstruct;
-import javax.cache.Cache;
 import javax.ejb.EJB;
 import javax.enterprise.context.RequestScoped;
 import javax.faces.application.FacesMessage;
@@ -31,6 +28,7 @@ import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcoreee.utils.FacesUtils;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
+import org.mxchange.jfinancials.beans.user.email_address.list.FinancialsEmailChangeListWebViewController;
 import org.mxchange.jfinancials.beans.user.login.FinancialsUserLoginWebSessionController;
 import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
 import org.mxchange.jusercore.model.email_address.EmailAddressChange;
@@ -69,17 +67,16 @@ public class FinancialsEmailChangeWebRequestBean extends BaseFinancialsBean impl
        private UserEmailChangeSessionBeanRemote emailChangeBean;
 
        /**
-        * Features controller
+        * Controller for listing email address changes
         */
        @Inject
-       private FinancialsFeaturesWebApplicationController featureController;
+       private FinancialsEmailChangeListWebViewController emailChangeListController;
 
        /**
-        * Local list of already queued email addresses
+        * Features controller
         */
        @Inject
-       @NamedCache (cacheName = "queuedEmailCache")
-       private Cache<String, Boolean> queuedEmailCache;
+       private FinancialsFeaturesWebApplicationController featureController;
 
        /**
         * Login controller (bean)
@@ -133,7 +130,7 @@ public class FinancialsEmailChangeWebRequestBean extends BaseFinancialsBean impl
                assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance userLoginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
 
                // Check if the email address is already enqueued
-               if (this.isEmailAddressQueued(this.getEmailAddress())) {
+               if (this.emailChangeListController.isEmailAddressQueued(this.getEmailAddress())) {
                        // Clear both email addresses
                        this.setEmailAddress(null);
                        this.setEmailAddressRepeat(null);
@@ -195,21 +192,6 @@ public class FinancialsEmailChangeWebRequestBean extends BaseFinancialsBean impl
                this.emailAddressRepeat = emailAddressRepeat;
        }
 
-       /**
-        * Post-construction
-        */
-       @PostConstruct
-       public void init () {
-               // Is cache there?
-               if (!this.queuedEmailCache.iterator().hasNext()) {
-                       // Add all
-                       for (final String currentEmailAddress : this.emailChangeBean.allQueuedAddresses()) {
-                               // Add it to cache
-                               this.queuedEmailCache.put(currentEmailAddress, Boolean.TRUE);
-                       }
-               }
-       }
-
        @Override
        public boolean isRequiredChangeEmailAddressSet () {
                return ((this.getEmailAddress() != null) &&
@@ -225,37 +207,4 @@ public class FinancialsEmailChangeWebRequestBean extends BaseFinancialsBean impl
                this.setEmailAddressRepeat(null);
        }
 
-       /**
-        * Checks if given email address has already been queued. First a local list
-        * is being checked, if not found, the EJB is called. Only if found, the
-        * result is "cached" in the list.
-        * <p>
-        * @param emailAddress Email address to verify
-        * <p>
-        * @return Whether the email address in field emailAddress is already queued
-        */
-       private boolean isEmailAddressQueued (final String emailAddress) {
-               // It should be there
-               assert (emailAddress != null) : "emailAddress should not be null"; //NOI18N
-               assert (!emailAddress.trim().isEmpty()) : "emailAddress should not be empty"; //NOI18N
-
-               // Check list
-               if (this.queuedEmailCache.containsKey(emailAddress)) {
-                       // Okay, found it
-                       return true;
-               }
-
-               // Check EJB
-               final boolean isQueued = this.emailChangeBean.isEmailAddressEnqueued(emailAddress);
-
-               // Is it there?
-               if (isQueued) {
-                       // Add to list
-                       this.queuedEmailCache.put(emailAddress, Boolean.TRUE);
-               }
-
-               // Return status
-               return isQueued;
-       }
-
 }
diff --git a/src/java/org/mxchange/jfinancials/beans/user/email_address/list/FinancialsEmailChangeListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/user/email_address/list/FinancialsEmailChangeListWebViewBean.java
new file mode 100644 (file)
index 0000000..7c79cdf
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.user.email_address.list;
+
+import fish.payara.cdi.jsr107.impl.NamedCache;
+import java.util.Comparator;
+import java.util.LinkedList;
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.cache.Cache;
+import javax.ejb.EJB;
+import javax.faces.view.ViewScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.mxchange.jfinancials.beans.BaseFinancialsBean;
+import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController;
+import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
+import org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote;
+
+/**
+ * A view-scoped bean for listing email address changes
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("emailChangeListController")
+@ViewScoped
+public class FinancialsEmailChangeListWebViewBean extends BaseFinancialsBean implements FinancialsEmailChangeListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 186_078_724_659_154L;
+
+       /**
+        * A list of all mobile numbers
+        */
+       private final List<ChangeableEmailAddress> allEmailAddressChanges;
+
+       /**
+        * Remote email change bean
+        */
+       @EJB (lookup = "java:global/jfinancials-ejb/userEmailChange!org.mxchange.jusercore.model.user.email_address.UserEmailChangeSessionBeanRemote")
+       private UserEmailChangeSessionBeanRemote emailChangeBean;
+
+       /**
+        * Features controller
+        */
+       @Inject
+       private FinancialsFeaturesWebApplicationController featureController;
+
+       /**
+        * A list of filtered mobile numbers
+        */
+       private List<ChangeableEmailAddress> filteredEmailAddressChanges;
+
+       /**
+        * Local list of already queued email addresses
+        */
+       @Inject
+       @NamedCache (cacheName = "queuedEmailCache")
+       private transient Cache<Long, ChangeableEmailAddress> queuedEmailCache;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsEmailChangeListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Initialize list
+               this.allEmailAddressChanges = new LinkedList<>();
+       }
+
+       @Override
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<ChangeableEmailAddress> getAllEmailAddressChanges () {
+               return this.allEmailAddressChanges;
+       }
+
+       /**
+        * Getter for filtered email address changed
+        * <p>
+        * @return Filtered email address changed
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<ChangeableEmailAddress> getFilteredEmailAddressChanges () {
+               return this.filteredEmailAddressChanges;
+       }
+
+       /**
+        * Setter for filtered email address changed
+        * <p>
+        * @param filteredEmailAddressChanges Filtered email address changed
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredEmailAddressChanges (final List<ChangeableEmailAddress> filteredEmailAddressChanges) {
+               this.filteredEmailAddressChanges = filteredEmailAddressChanges;
+       }
+
+       /**
+        * Post-construction
+        */
+       @PostConstruct
+       public void initializeList () {
+               // Is cache there?
+               if (!this.queuedEmailCache.iterator().hasNext()) {
+                       // Add all
+                       for (final ChangeableEmailAddress currentEmailAddress : this.emailChangeBean.fetchAllQueuedAddressChanges()) {
+                               // Add it to cache
+                               this.queuedEmailCache.put(currentEmailAddress.getEmailChangeId(), currentEmailAddress);
+                       }
+               }
+
+               // Is cache filled and list is empty
+               if ((this.queuedEmailCache.iterator().hasNext()) && (this.getAllEmailAddressChanges().isEmpty())) {
+                       // Build up list
+                       for (final Cache.Entry<Long, ChangeableEmailAddress> currentEntry : this.queuedEmailCache) {
+                               // Add to list
+                               this.getAllEmailAddressChanges().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllEmailAddressChanges().sort(new Comparator<ChangeableEmailAddress>() {
+                               @Override
+                               public int compare (final ChangeableEmailAddress queuedEmail1, final ChangeableEmailAddress queuedEmail2) {
+                                       return queuedEmail1.getEmailChangeId() > queuedEmail2.getEmailChangeId() ? 1 : queuedEmail1.getEmailChangeId() < queuedEmail2.getEmailChangeId() ? -1 : 0;
+                               }
+                       });
+
+                       // Set full list
+                       this.setFilteredEmailAddressChanges(this.getAllEmailAddressChanges());
+               }
+       }
+
+       @Override
+       public boolean isEmailAddressQueued (final String emailAddress) {
+               // Check if parameter is valid
+               if (null == emailAddress) {
+                       // Throw NPE
+                       throw new NullPointerException("emailAddress is null"); //NOI18N
+               } else if (emailAddress.isEmpty()) {
+                       // Throw IAE
+                       throw new IllegalArgumentException("emailAddress is empty."); //NOI18N
+               }
+
+               // Default is not found
+               boolean isFound = false;
+
+               // Iterate through whole list
+               for (final ChangeableEmailAddress address : this.getAllEmailAddressChanges()) {
+                       // Does current match?
+                       if (emailAddress.equals(address.getEmailAddress())) {
+                               // Yes, set flag and abort iteration
+                               isFound = true;
+                               break;
+                       }
+               }
+
+               // Return flag
+               return isFound;
+       }
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/user/email_address/list/FinancialsEmailChangeListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/user/email_address/list/FinancialsEmailChangeListWebViewController.java
new file mode 100644 (file)
index 0000000..ca0fa54
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2016 - 2020 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jfinancials.beans.user.email_address.list;
+
+import java.io.Serializable;
+import java.util.List;
+import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
+
+/**
+ * An interface for an email change controller
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public interface FinancialsEmailChangeListWebViewController extends Serializable {
+
+       /**
+        * Returns a list of all email address changes. For performance reasons, the
+        * controller (bean) should be view-scoped as from user to user nothing
+        * changes. And the controller's post-construct method should load all
+        * numbers and cache it in the controller.
+        * <p>
+        * @return List of all mobile numbers
+        */
+       List<ChangeableEmailAddress> getAllEmailAddressChanges ();
+
+       /**
+        * Checks if given email address has already been queued. First a local list
+        * is being checked, if not found, the EJB is called. Only if found, the
+        * result is "cached" in the list.
+        * <p>
+        * @param emailAddress Email address to verify
+        * <p>
+        * @return Whether the email address in field emailAddress is already queued
+        */
+       boolean isEmailAddressQueued (final String emailAddress);
+
+}
diff --git a/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewBean.java
new file mode 100644 (file)
index 0000000..93b581f
--- /dev/null
@@ -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 <http://www.gnu.org/licenses/>.
+ */
+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.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;
+import org.mxchange.jusercore.events.user.update.post.ObservableAdminPostUserDataUpdatedEvent;
+import org.mxchange.jusercore.events.user.update.post.ObservablePostUserPersonalDataUpdatedEvent;
+
+/**
+ * A user list bean (controller)
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+@Named ("userListController")
+@ViewScoped
+public class FinancialsUserListWebViewBean extends BaseFinancialsBean implements FinancialsUserListWebViewController {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 542_145_347_918L;
+
+       /**
+        * List of all users
+        */
+       private final List<User> allUsers;
+
+       /**
+        * List of filtered users
+        */
+       private List<User> 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<Long, User> userCache;
+
+       /**
+        * Default constructor
+        */
+       public FinancialsUserListWebViewBean () {
+               // Call super constructor
+               super();
+
+               // Init list
+               this.allUsers = new LinkedList<>();
+       }
+
+       /**
+        * Event observer for newly added users by administrator
+        * <p>
+        * @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)
+        * <p>
+        * @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
+        * <p>
+        * @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
+        * <p>
+        * @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
+        * <p>
+        * @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
+        * <p>
+        * @param event Event being updated
+        */
+       public void afterAdminUpdatedUserDataEvent (@Observes final ObservableAdminPostUserDataUpdatedEvent 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.
+        * <p>
+        * @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
+        * <p>
+        * @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).
+        * <p>
+        * @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
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterUserUpdatedPersonalDataEvent (@Observes final ObservablePostUserPersonalDataUpdatedEvent 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<User> getAllUsers () {
+               return this.allUsers;
+       }
+
+       /**
+        * Getter for filtered users list
+        * <p>
+        * @return Filtered users list
+        */
+       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
+       public List<User> getFilteredUsers () {
+               return this.filteredUsers;
+       }
+
+       /**
+        * Setter for filtered users list
+        * <p>
+        * @param filteredUsers Filtered users list
+        */
+       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
+       public void setFilteredUsers (final List<User> filteredUsers) {
+               this.filteredUsers = filteredUsers;
+       }
+
+       /**
+        * Getter for selected user instance
+        * <p>
+        * @return Selected user instance
+        */
+       public User getSelectedUser () {
+               return this.selectedUser;
+       }
+
+       /**
+        * Setter for selected user instance
+        * <p>
+        * @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.fetchAllUsers()) {
+                               // 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<Long, User> currentEntry : this.userCache) {
+                               // Add to list
+                               this.getAllUsers().add(currentEntry.getValue());
+                       }
+
+                       // Sort list
+                       this.getAllUsers().sort(new Comparator<User>() {
+                               @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<Long, User> 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<Long, User> 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
+        * <p>
+        * @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
+        * <p>
+        * @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/list/FinancialsUserListWebViewtBean.java b/src/java/org/mxchange/jfinancials/beans/user/list/FinancialsUserListWebViewtBean.java
deleted file mode 100644 (file)
index 0f7db16..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-/*
- * Copyright (C) 2016 - 2020 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.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)
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-@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<User> allUsers;
-
-       /**
-        * List of filtered users
-        */
-       private List<User> 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<Long, User> userCache;
-
-       /**
-        * Default constructor
-        */
-       public FinancialsUserListWebViewtBean () {
-               // Call super constructor
-               super();
-
-               // Init list
-               this.allUsers = new LinkedList<>();
-       }
-
-       /**
-        * Event observer for newly added users by administrator
-        * <p>
-        * @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)
-        * <p>
-        * @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
-        * <p>
-        * @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
-        * <p>
-        * @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
-        * <p>
-        * @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
-        * <p>
-        * @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.
-        * <p>
-        * @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
-        * <p>
-        * @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).
-        * <p>
-        * @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
-        * <p>
-        * @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<User> getAllUsers () {
-               return this.allUsers;
-       }
-
-       /**
-        * Getter for filtered users list
-        * <p>
-        * @return Filtered users list
-        */
-       @SuppressWarnings ("ReturnOfCollectionOrArrayField")
-       public List<User> getFilteredUsers () {
-               return this.filteredUsers;
-       }
-
-       /**
-        * Setter for filtered users list
-        * <p>
-        * @param filteredUsers Filtered users list
-        */
-       @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter")
-       public void setFilteredUsers (final List<User> filteredUsers) {
-               this.filteredUsers = filteredUsers;
-       }
-
-       /**
-        * Getter for selected user instance
-        * <p>
-        * @return Selected user instance
-        */
-       public User getSelectedUser () {
-               return this.selectedUser;
-       }
-
-       /**
-        * Setter for selected user instance
-        * <p>
-        * @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<Long, User> currentEntry : this.userCache) {
-                               // Add to list
-                               this.getAllUsers().add(currentEntry.getValue());
-                       }
-
-                       // Sort list
-                       this.getAllUsers().sort(new Comparator<User>() {
-                               @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<Long, User> 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<Long, User> 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
-        * <p>
-        * @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
-        * <p>
-        * @param user User instance
-        */
-       private void updateList (final User user) {
-               // Add/update user
-               this.userCache.put(user.getUserId(), user);
-               this.getAllUsers().add(user);
-       }
-
-}
index 44b2c436c3ad2cae1646ae58087de60610b44894..dcc81e98da1bf72cd216497671101c3269c104aa 100644 (file)
@@ -31,9 +31,10 @@ import javax.inject.Inject;
 import javax.inject.Named;
 import org.mxchange.jfinancials.beans.BaseFinancialsBean;
 import org.mxchange.jfinancials.beans.user.FinancialsUserWebRequestController;
-import org.mxchange.jusercore.exceptions.UserNotFoundException;
-import org.mxchange.jusercore.exceptions.UserStatusLockedException;
-import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
+import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController;
+import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
+import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent;
+import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
 import org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote;
@@ -45,10 +46,9 @@ import org.mxchange.juserlogincore.events.login.ObservableUserLoggedInEvent;
 import org.mxchange.juserlogincore.events.login.UserLoggedInEvent;
 import org.mxchange.juserlogincore.events.logout.ObservableUserLogoutEvent;
 import org.mxchange.juserlogincore.events.logout.UserLogoutEvent;
+import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.juserlogincore.events.user.password_change.ObservableUpdatedUserPasswordEvent;
-import org.mxchange.juserlogincore.exceptions.UserPasswordMismatchException;
 import org.mxchange.juserlogincore.login.UserLoginUtils;
-import org.mxchange.juserlogincore.model.user.login.UserLoginSessionBeanRemote;
 
 /**
  * A web bean for user registration
@@ -97,15 +97,20 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
        private String userCurrentPassword;
 
        /**
-        * Flag whether the user has logged-in, set only from inside
+        * User id
         */
-       private boolean userLoggedIn;
+       private Long userId;
+
+       /**
+        * Administrative user-list controller
+        */
+       @Inject
+       private FinancialsUserListWebViewController userListController;
 
        /**
-        * Remote register session-scoped bean
+        * Flag whether the user has logged-in, set only from inside
         */
-       @EJB (lookup = "java:global/jfinancials-ejb/userLogin!org.mxchange.juserlogincore.model.user.login.UserLoginSessionBeanRemote")
-       private UserLoginSessionBeanRemote userLoginBean;
+       private boolean userLoggedIn;
 
        /**
         * Event fired when user has logged in
@@ -121,6 +126,16 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
        @Any
        private Event<ObservableUserLogoutEvent> userLogoutEvent;
 
+       /**
+        * User name
+        */
+       private String userName;
+
+       /**
+        * User password (clear-text from web form)
+        */
+       private String userPassword;
+
        /**
         * User's password history
         */
@@ -132,6 +147,11 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
        @EJB (lookup = "java:global/jfinancials-ejb/userPasswordHistory!org.mxchange.jusercore.model.user.password_history.UserPasswordHistorySessionBeanRemote")
        private UserPasswordHistorySessionBeanRemote userPasswordHistoryBean;
 
+       /**
+        * Whether the user wants a public profile
+        */
+       private ProfileMode userProfileMode;
+
        /**
         * Default constructor
         */
@@ -144,31 +164,167 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
        }
 
        /**
-        * Method being call after user's password has been updated (and history
-        * entry has been created).
+        * Event observer for newly added users by administrator
+        * <p>
+        * @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
+               }
+
+               // Set user id again
+               this.setUserId(event.getAddedUser().getUserId());
+       }
+
+       /**
+        * Event observer for linked users with existing contact data
         * <p>
-        * @param event Event being observed
+        * @param event Event being fired
         */
-       public void afterUserUpdatedPasswordEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
-               // Check parameter
+       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.getPasswordHistory() == null) {
+               } else if (event.getLinkedUser() == 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
+                       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
                }
 
-               // All fine, so update list
+               // Set user id again
+               this.setUserId(event.getLinkedUser().getUserId());
+       }
+
+       /**
+        * 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
+        * should not fire but instead a proper exception must be thrown.
+        * <p>
+        * @param event User created event
+        */
+       public void afterCreatedUserEvent (@Observes final ObservableCreatedUserEvent event) {
+               // Is the instance valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getCreatedUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdUser is null"); //NOI18N
+               } else if (event.getCreatedUser().getUserId() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.createdUser.userId is null"); //NOI18N
+               } else if (event.getCreatedUser().getUserId() < 1) {
+                       // Throw NPE again
+                       throw new NullPointerException(MessageFormat.format("event.createdUser.userId={0} is not valid", event.getCreatedUser().getUserId())); //NOI18N
+               }
+
+               // Get user instance
+               final User user = event.getCreatedUser();
+
+               // Set all fields here
+               this.copyUser(user);
+       }
+
+       /**
+        * Event observer for logged-in user
+        * <p>
+        * @param event Event instance
+        */
+       public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent 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.getLoggedInUser() == null) {
+                       // Throw NPE again
+                       throw new NullPointerException("event.registeredUser is null"); //NOI18N
+               } else if (event.getLoggedInUser().getUserId() == null) {
+                       // userId is null
+                       throw new NullPointerException("event.registeredUser.userId is null"); //NOI18N
+               } else if (event.getLoggedInUser().getUserId() < 1) {
+                       // Not avalid id
+                       throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
+               }
+
+               // "Cache" user instance
+               final User user = event.getLoggedInUser();
+
+               // Copy all data to this bean
+               this.copyUser(user);
+       }
+
+       /**
+        * Event observer for user password changes
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterUserPasswordChangedEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
+               // Is it valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUserPassword() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event.userPassword is null"); //NOI18N
+               } else if (event.getUserPassword().isEmpty()) {
+                       // Throw NPE
+                       throw new IllegalArgumentException("event.userPassword is empty"); //NOI18N
+               }
+
+               // Set it here
+               this.setUserPassword(event.getUserPassword());
                this.updatePasswordHistory(event.getPasswordHistory());
        }
 
+       /**
+        * Event observer for new user registrations
+        * <p>
+        * @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
+               }
+
+               // Get user instance
+               final User registeredUser = event.getRegisteredUser();
+
+               // Copy all data from registered->user
+               this.copyUser(registeredUser);
+
+               // Set user id again
+               this.setUserId(registeredUser.getUserId());
+       }
+
        /**
         * Logout for administrator area. If a logged-in user instance exists, it is
         * being logged-out, too.
@@ -198,48 +354,52 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
         * @return Redirect target
         */
        public String doUserLogin () {
-               // Get user instance
-               final User user = this.userController.createUserLogin();
-
-               // Create login container
-               final LoginContainer loginContainer = new UserLoginContainer(user, this.userController.getUserPassword());
-
-               try {
-                       // Call bean
-                       final User confirmedUser = this.userLoginBean.validateUserAccountStatus(loginContainer);
-
-                       // All fine here so set it here
-                       this.setLoggedInUser(confirmedUser);
-
-                       // Retrieve user's password list
-                       this.userPasswordHistory = this.userPasswordHistoryBean.getUserPasswordHistory(confirmedUser);
-
-                       // Set template to "login"
-                       this.setBaseTemplatePathName(USER_BASE_TEMPLATE_NAME); //NOI18N
-
-                       // Fire event away. Keep this last before return statement.
-                       this.userLoginEvent.fire(new UserLoggedInEvent(confirmedUser));
-
-                       // Clear this bean
-                       this.clear();
+               // Found user instance
+               User updatedUser = null;
+
+               // Iterate over all users
+               for (final User currentUser : this.userListController.getAllUsers()) {
+                       // Is the user name matching?
+                       if (currentUser.getUserName().equals(this.getUserName())) {
+                               // Yes, same user, then set it and stop iteration
+                               updatedUser = currentUser;
+                               break;
+                       }
+               }
 
-                       // All fine
-                       return "login_user"; //NOI18N
-               } catch (final UserNotFoundException ex) {
+               if (null == updatedUser) {
                        // Show JSF message
                        this.showFacesMessage("form_user_login:userName", "ERROR_USER_NOT_FOUND", FacesMessage.SEVERITY_ERROR); //NOI18N
                        return ""; //NOI18N
-               } catch (final UserStatusLockedException ex) {
+               } else if (updatedUser.getUserAccountStatus().equals(UserAccountStatus.LOCKED)) {
                        this.showFacesMessage("form_user_login:userName", "ERROR_USER_STATUS_LOCKED", FacesMessage.SEVERITY_WARN); //NOI18N
                        return ""; //NOI18N
-               } catch (final UserStatusUnconfirmedException ex) {
+               } else if (updatedUser.getUserAccountStatus().equals(UserAccountStatus.UNCONFIRMED)) {
                        this.showFacesMessage("form_user_login:userName", "ERROR_USER_STATUS_UNCONFIRMED", FacesMessage.SEVERITY_INFO); //NOI18N
                        return ""; //NOI18N
-               } catch (final UserPasswordMismatchException ex) {
+               } else if (!UserLoginUtils.ifPasswordMatches(this.getUserPassword(), updatedUser)) {
                        // Show JSF message
                        this.showFacesMessage("form_user_login:userPassword", "ERROR_USER_PASSWORD_MISMATCH", FacesMessage.SEVERITY_WARN); //NOI18N
                        return ""; //NOI18N
                }
+
+               // All fine here so set it here
+               this.setLoggedInUser(updatedUser);
+
+               // Retrieve user's password list
+               this.userPasswordHistory = this.userPasswordHistoryBean.fetchPasswordHistoryByUser(updatedUser);
+
+               // Set template to "login"
+               this.setBaseTemplatePathName(USER_BASE_TEMPLATE_NAME);
+
+               // Fire event away. Keep this last before return statement.
+               this.userLoginEvent.fire(new UserLoggedInEvent(updatedUser));
+
+               // Clear this bean
+               this.clear();
+
+               // All fine
+               return "login_user"; //NOI18N
        }
 
        /**
@@ -312,11 +472,83 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
                this.userCurrentPassword = userCurrentPassword;
        }
 
+       /**
+        * Getter for user id
+        * <p>
+        * @return User id
+        */
+       public Long getUserId () {
+               return this.userId;
+       }
+
+       /**
+        * Setter for user id
+        * <p>
+        * @param userId User id
+        */
+       public void setUserId (final Long userId) {
+               this.userId = userId;
+       }
+
+       /**
+        * Getter for user name
+        * <p>
+        * @return User name
+        */
+       public String getUserName () {
+               return this.userName;
+       }
+
+       /**
+        * Setter for user name
+        * <p>
+        * @param userName User name
+        */
+       public void setUserName (final String userName) {
+               this.userName = userName;
+       }
+
+       /**
+        * Getter for clear-text user password
+        * <p>
+        * @return Clear-text user password
+        */
+       public String getUserPassword () {
+               return this.userPassword;
+       }
+
+       /**
+        * Setter for clear-text user password
+        * <p>
+        * @param userPassword Clear-text user password
+        */
+       public void setUserPassword (final String userPassword) {
+               this.userPassword = userPassword;
+       }
+
        @Override
        public List<PasswordHistory> getUserPasswordHistory () {
                return Collections.unmodifiableList(this.userPasswordHistory);
        }
 
+       /**
+        * Getter for user profile mode
+        * <p>
+        * @return User profile mode
+        */
+       public ProfileMode getUserProfileMode () {
+               return this.userProfileMode;
+       }
+
+       /**
+        * Setter for user profile mode
+        * <p>
+        * @param userProfileMode User profile mode
+        */
+       public void setUserProfileMode (final ProfileMode userProfileMode) {
+               this.userProfileMode = userProfileMode;
+       }
+
        @Override
        public boolean ifCurrentPasswordMatches () {
                // The current password must be set and not empty
@@ -381,6 +613,15 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
                return isPasswordInHistory;
        }
 
+       /**
+        * Checks if the user id is empty
+        * <p>
+        * @return Whether the user id is empty
+        */
+       public boolean isUserIdEmpty () {
+               return ((this.getUserId() == null) || (this.getUserId() == 0));
+       }
+
        @Override
        public boolean isUserLoggedIn () {
                // Compare instance
@@ -395,7 +636,24 @@ public class FinancialsUserLoginWebSessionBean extends BaseFinancialsBean implem
         */
        private void clear () {
                // Clear all fields
+               this.setLoggedInUser(null);
+               this.setUserName(null);
+               this.setUserPassword(null);
                this.setUserCurrentPassword(null);
+               this.setUserProfileMode(null);
+       }
+
+       /**
+        * Copies given user into the controller
+        * <p>
+        * @param user User instance
+        */
+       private void copyUser (final User user) {
+               // Copy all fields:
+               // - base data
+               this.setUserId(user.getUserId());
+               this.setUserName(user.getUserName());
+               this.setUserProfileMode(user.getUserProfileMode());
        }
 
        /**
index b949dd3ced530ac5f2f3bbef17a7ac32cb92d023..e96a018fc13918b7dab06c54fdbe4264cf615ff7 100644 (file)
  */
 package org.mxchange.jfinancials.beans.user.register;
 
+import java.util.Objects;
 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.faces.view.facelets.FaceletException;
@@ -30,18 +32,18 @@ import org.mxchange.jcoreee.utils.FacesUtils;
 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.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;
-import org.mxchange.jusercore.events.user.clear.username.ObservableClearUserNameEvent;
 import org.mxchange.jusercore.exceptions.DataRepeatMismatchException;
 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
+import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
+import org.mxchange.jusercore.model.user.Users;
 import org.mxchange.jusercore.model.user.password_history.PasswordHistory;
 import org.mxchange.jusercore.model.user.password_history.UserPasswordHistory;
+import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
 import org.mxchange.juserlogincore.events.registration.ObservableUserRegisteredEvent;
 import org.mxchange.juserlogincore.events.registration.UserRegisteredEvent;
@@ -64,20 +66,6 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
         */
        private static final long serialVersionUID = 47_828_986_719_691_592L;
 
-       /**
-        * An event being fired when a user name should be cleared
-        */
-       @Inject
-       @Any
-       private Event<ObservableClearUserNameEvent> clearUserNameEvent;
-
-       /**
-        * An event being fired when a user password should be cleared
-        */
-       @Inject
-       @Any
-       private Event<ObservableClearUserPasswordEvent> clearUserPasswordEvent;
-
        /**
         * Contact controller
         */
@@ -90,6 +78,12 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
        @Inject
        private FinancialsFeaturesWebApplicationController featureController;
 
+       /**
+        * Localization controller
+        */
+       @Inject
+       private FinancialsLocalizationSessionController localizationController;
+
        /**
         * Remote register session-scoped bean
         */
@@ -97,16 +91,20 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
        private UserRegistrationSessionBeanRemote registerBean;
 
        /**
-        * User controller
+        * User list controller
         */
        @Inject
-       private FinancialsUserWebRequestController userController;
+       private FinancialsUserListWebViewController userListController;
 
        /**
-        * User list controller
+        * User name
         */
-       @Inject
-       private FinancialsUserListWebViewController userListController;
+       private String userName;
+
+       /**
+        * User password (clear-text from web form)
+        */
+       private String userPassword;
 
        /**
         * An event being fired when a user password was changed
@@ -115,6 +113,16 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
        @Any
        private Event<ObservableUpdatedUserPasswordEvent> userPasswordChangedEvent;
 
+       /**
+        * User password repeated (clear-text from web form)
+        */
+       private String userPasswordRepeat;
+
+       /**
+        * Whether the user wants a public profile
+        */
+       private ProfileMode userProfileMode;
+
        /**
         * An event being fired when a new user has registered
         */
@@ -130,6 +138,29 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                super();
        }
 
+       /**
+        * Event observer for user password changes
+        * <p>
+        * @param event Event being fired
+        */
+       public void afterUserPasswordChangedEvent (@Observes final ObservableUpdatedUserPasswordEvent event) {
+               // Is it valid?
+               if (null == event) {
+                       // Throw NPE
+                       throw new NullPointerException("event is null"); //NOI18N
+               } else if (event.getUserPassword() == null) {
+                       // Throw NPE
+                       throw new NullPointerException("event.userPassword is null"); //NOI18N
+               } else if (event.getUserPassword().isEmpty()) {
+                       // Throw NPE
+                       throw new IllegalArgumentException("event.userPassword is empty"); //NOI18N
+               }
+
+               // Set it here
+               this.setUserPassword(event.getUserPassword());
+               this.setUserPasswordRepeat(event.getUserPassword());
+       }
+
        /**
         * Registers the user, if not found. Otherwise this method should throw an
         * exception.
@@ -144,7 +175,7 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                }
 
                // Get user instance
-               final User user = this.userController.createUserInstance(true);
+               final User user = this.createUserInstance(true);
 
                // Null random password means registration requires user-entered password
                String randomPassword = null;
@@ -153,7 +184,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.userController.isRequiredPersonalDataSet()) {
+               } else if (!this.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.userListController.isUserNameRegistered(user))) { //NOI18N
@@ -162,8 +193,8 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                                // User name is already used, should not happen here
                                throw new FaceletException(new UserNameAlreadyRegisteredException(user));
                        } else {
-                               // May happen here, fire event
-                               this.clearUserNameEvent.fire(new ClearUserNameEvent());
+                               // May happen here, clear user name
+                               this.clearUserName();
 
                                // Output message
                                this.showFacesMessage("form_register_single:userName", "ERROR_USER_NAME_ALREADY_USED", FacesMessage.SEVERITY_WARN); //NOI18N
@@ -191,12 +222,12 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                                this.showFacesMessage("form_register_single:emailAddressRepeat", "ERROR_EMAIL_ADDRESSES_MISMATCHING", FacesMessage.SEVERITY_INFO); //NOI18N
                                return ""; //NOI18N
                        }
-               } else if (!this.userController.isSamePasswordEntered()) {
+               } else if (!this.isSamePasswordEntered()) {
                        // Is multi-page enabled?
                        if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N
                                // Not same password entered, should no longer happen here
                                throw new FaceletException(new DataRepeatMismatchException("Passwords not matching.")); //NOI18N
-                       } else if (this.userController.ifBothPasswordsEmptyAllowed()) {
+                       } else if (this.ifBothPasswordsEmptyAllowed()) {
                                // Both passwords are left empty and is allowed, then generate a random password
                                randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
 
@@ -209,7 +240,7 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                }
 
                // Encrypt password
-               final String encryptedPassword = UserLoginUtils.encryptPassword(this.userController.getUserPassword());
+               final String encryptedPassword = UserLoginUtils.encryptPassword(this.getUserPassword());
 
                // Set it here
                user.setUserEncryptedPassword(encryptedPassword);
@@ -265,7 +296,7 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                }
 
                // Get user instance
-               final User user = this.userController.createUserInstance(false);
+               final User user = this.createUserInstance(false);
 
                // First check if user is not null and user name is not used + if same email address is entered
                if (null == user) {
@@ -273,7 +304,7 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                        throw new NullPointerException("user is null after createUserInstance() was called"); //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());
+                       this.clearUserName();
 
                        // Output message
                        this.showFacesMessage("form_register_page1:userName", "ERROR_USER_NAME_ALREADY_USED", FacesMessage.SEVERITY_WARN); //NOI18N
@@ -283,22 +314,22 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                        this.contactController.clearEmailAddresses();
                        this.showFacesMessage("form_register_page1:emailAddressRepeat", "ERROR_EMAIL_ADDRESSES_MISMATCHING", FacesMessage.SEVERITY_WARN); //NOI18N
                        return ""; //NOI18N
-               } else if (!this.userController.isSamePasswordEntered()) {
+               } else if (!this.isSamePasswordEntered()) {
                        // Is multi-page enabled?
                        if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N
-                               // Unset both
-                               this.clearUserPasswordEvent.fire(new ClearUserPasswordEvent());
+                               // Clear passwords
+                               this.clearUserPasswords();
 
                                // Output faces message
                                this.showFacesMessage("form_register_page1:userPassword", "ERROR_USER_PASSWORD_EMPTY", FacesMessage.SEVERITY_WARN); //NOI18N
                                this.showFacesMessage("form_register_page1:userPasswordRepeat", "ERROR_USER_PASSWORD_REPEAT_EMPTY", FacesMessage.SEVERITY_WARN); //NOI18N
                                return ""; //NOI18N
-                       } else if (this.userController.ifBothPasswordsEmptyAllowed()) {
+                       } else if (this.ifBothPasswordsEmptyAllowed()) {
                                // Both passwords are left empty and is allowed, then generate a random password
-                               String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
+                               final String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
 
                                // Generate (ignored) password-history
-                               PasswordHistory passwordHistory = new UserPasswordHistory(randomPassword, user);
+                               final PasswordHistory passwordHistory = new UserPasswordHistory(randomPassword, user);
 
                                // Fire event
                                this.userPasswordChangedEvent.fire(new UpdatedUserPasswordEvent(passwordHistory, randomPassword));
@@ -324,4 +355,211 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp
                return "user_register_page2"; //NOI18N
        }
 
+       /**
+        * Getter for user name
+        * <p>
+        * @return User name
+        */
+       public String getUserName () {
+               return this.userName;
+       }
+
+       /**
+        * Setter for user name
+        * <p>
+        * @param userName User name
+        */
+       public void setUserName (final String userName) {
+               this.userName = userName;
+       }
+
+       /**
+        * Getter for clear-text user password
+        * <p>
+        * @return Clear-text user password
+        */
+       public String getUserPassword () {
+               return this.userPassword;
+       }
+
+       /**
+        * Setter for clear-text user password
+        * <p>
+        * @param userPassword Clear-text user password
+        */
+       public void setUserPassword (final String userPassword) {
+               this.userPassword = userPassword;
+       }
+
+       /**
+        * Getter for clear-text user password repeated
+        * <p>
+        * @return Clear-text user password repeated
+        */
+       public String getUserPasswordRepeat () {
+               return this.userPasswordRepeat;
+       }
+
+       /**
+        * Setter for clear-text user password repeated
+        * <p>
+        * @param userPasswordRepeat Clear-text user password repeated
+        */
+       public void setUserPasswordRepeat (final String userPasswordRepeat) {
+               this.userPasswordRepeat = userPasswordRepeat;
+       }
+
+       /**
+        * Getter for user profile mode
+        * <p>
+        * @return User profile mode
+        */
+       public ProfileMode getUserProfileMode () {
+               return this.userProfileMode;
+       }
+
+       /**
+        * Setter for user profile mode
+        * <p>
+        * @param userProfileMode User profile mode
+        */
+       public void setUserProfileMode (final ProfileMode userProfileMode) {
+               this.userProfileMode = userProfileMode;
+       }
+
+       @Override
+       public boolean isRequiredChangePersonalDataSet () {
+               return ((this.getUserProfileMode() != null) &&
+                               (this.getUserName() != null) &&
+                               (!this.getUserName().isEmpty()) &&
+                               (this.contactController.isRequiredChangePersonalDataSet()));
+       }
+
+       /**
+        * Clears user name
+        */
+       private void clearUserName () {
+               // Clear it
+               this.setUserName(null);
+       }
+
+       /**
+        * Clears both user passwords
+        */
+       private void clearUserPasswords () {
+               // Clear both
+               this.setUserPassword(null);
+               this.setUserPasswordRepeat(null);
+       }
+
+       /**
+        * Creates an instance from all properties
+        * <p>
+        * @param createContactData Whether contact data should be created
+        * <p>
+        * @return A user instance
+        */
+       private User createUserInstance (final boolean createContactData) {
+               // Required personal data must be set
+               assert (this.isRequiredPersonalDataSet()) : "All required personal data must be set before invoking this method."; //NOI18N
+
+               // Is user name required?
+               if (!this.featureController.isFeatureEnabled("user_login_require_username")) {
+                       // Init variables
+                       String randomName = null;
+                       boolean isUsernameFree = false;
+
+                       // Get full list
+                       for (final User user : this.userListController.getAllUsers()) {
+                               // Loop until a user name is found
+                               while ((randomName == null) || (randomName.equals(user.getUserName()))) {
+                                       // Generate random name
+                                       randomName = Users.generateRandomUserName();
+                                       isUsernameFree = true;
+                               }
+
+                               // Is non-existing username found
+                               if (isUsernameFree) {
+                                       // Also stop looping here
+                                       break;
+                               }
+                       }
+
+                       // Set it and inivisible profile
+                       this.setUserName(randomName);
+                       this.setUserProfileMode(ProfileMode.INVISIBLE);
+
+                       // Generate random password
+                       final String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH);
+
+                       // Set random password
+                       this.setUserPassword(randomPassword);
+                       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.localizationController.getLocale());
+
+               // Is multiple registration page
+               if ((createContactData) || (!this.featureController.isFeatureEnabled("user_register_multiple_page"))) { //NOI18N
+                       // Create contact instance
+                       final Contact contact = this.contactController.createContactInstance();
+
+                       // Set contact in user
+                       user.setUserContact(contact);
+               }
+
+               // Return it
+               return user;
+       }
+
+       /**
+        * Checks if both user passwords are left empty and if this is enabled
+        * (allowed) in context parameter. If true, the calling bean should create a
+        * random password (preferable with UserUtils.createRandomPassword() and set
+        * it in both user password fields.
+        * <p>
+        * @return Whether empty passwords are allowed
+        */
+       private boolean ifBothPasswordsEmptyAllowed () {
+               // Check feature first
+               return ((this.featureController.isFeatureEnabled("allow_user_registration_empty_password")) && //NOI18N
+                               ((this.getUserPassword() == null) || (this.getUserPassword().isEmpty())) &&
+                               ((this.getUserPasswordRepeat() == null) || (this.getUserPasswordRepeat().isEmpty())));
+       }
+
+       /**
+        * Checks whether all required personal data is set
+        * <p>
+        * @return Whether the required personal data is set
+        */
+       private boolean isRequiredPersonalDataSet () {
+               // Check conditions based on of multi-page registration is enabled
+               if (this.featureController.isFeatureEnabled("user_register_multiple_page")) { //NOI18N
+                       // Multiple registration page
+                       return this.contactController.isRequiredPersonalDataSet();
+               } else {
+                       // Single registration page
+                       return (((this.getUserName() != null) || (!this.featureController.isFeatureEnabled("user_login_require_username"))) && //NOI18N
+                                       (this.getUserProfileMode() != null) &&
+                                       (this.contactController.isRequiredPersonalDataSet()) &&
+                                       (this.getUserPassword() != null) &&
+                                       (this.getUserPasswordRepeat() != null));
+               }
+       }
+
+       /**
+        * Checks whether same passwords has been entered
+        * <p>
+        * @return Whether same passwords has been entered
+        */
+       private boolean isSamePasswordEntered () {
+               return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
+       }
+
 }
index cd5322a82d5f7c23ec8543e1bd74c54a7873e170..55b7496d61d53f2cbcb955b29a95e9038c2246bf 100644 (file)
@@ -25,4 +25,11 @@ import java.io.Serializable;
  */
 public interface FinancialsUserRegisterWebRequestController extends Serializable {
 
+       /**
+        * Checks whether all required personal data is set for changing them
+        * <p>
+        * @return Whether the required personal data is set
+        */
+       boolean isRequiredChangePersonalDataSet ();
+
 }
index 3a2ba168e6b7cbd15332264353d546ab0d3e7173..0c40f09fa8aa8d93640a942d588bd93e57143f2c 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.employee.EmployeeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
-import org.mxchange.jfinancials.beans.business.employee.FinancialsEmployeeWebRequestBean;
-import org.mxchange.jfinancials.beans.business.employee.FinancialsEmployeeWebRequestController;
+import org.mxchange.jfinancials.beans.business.employee.list.FinancialsEmployeeListWebViewBean;
+import org.mxchange.jfinancials.beans.business.employee.list.FinancialsEmployeeListWebViewController;
 
 /**
  * Converter for converting company employee to and from id number
@@ -38,21 +38,12 @@ public class FinancialsEmployeeConverter implements Converter<Employable> {
        /**
         * Employable EJB
         */
-       private static FinancialsEmployeeWebRequestController EMPLOYEE_CONTROLLER;
+       private static FinancialsEmployeeListWebViewController EMPLOYEE_LIST_CONTROLLER;
 
        @Override
        public Employable getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == EMPLOYEE_CONTROLLER) {
-                       // Get bean from CDI directly
-                       EMPLOYEE_CONTROLLER = CDI.current().select(FinancialsEmployeeWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
                        // Return null
                        return null;
                }
@@ -64,8 +55,14 @@ public class FinancialsEmployeeConverter implements Converter<Employable> {
                        // Try to parse the value as long
                        final Long employeeId = Long.valueOf(submittedValue);
 
+                       // Is the instance there?
+                       if (null == EMPLOYEE_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               EMPLOYEE_LIST_CONTROLLER = CDI.current().select(FinancialsEmployeeListWebViewBean.class).get();
+                       }
+
                        // Try to get user instance from it
-                       companyEmployee = EMPLOYEE_CONTROLLER.findEmployeeById(employeeId);
+                       companyEmployee = EMPLOYEE_LIST_CONTROLLER.findEmployeeById(employeeId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 4eea8240a2e792948ca85921be75ce00d6ba1313..86bbc8efeda4f3a4196ebf20b56c58059b77811b 100644 (file)
@@ -24,8 +24,8 @@ import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jcontactsbusiness.exceptions.opening_time.OpeningTimeNotFoundException;
 import org.mxchange.jcontactsbusiness.model.opening_time.OpeningTime;
-import org.mxchange.jfinancials.beans.business.opening_time.FinancialsOpeningTimeWebRequestBean;
-import org.mxchange.jfinancials.beans.business.opening_time.FinancialsOpeningTimeWebRequestController;
+import org.mxchange.jfinancials.beans.business.opening_time.list.FinancialsOpeningTimeListWebViewBean;
+import org.mxchange.jfinancials.beans.business.opening_time.list.FinancialsOpeningTimeListWebViewController;
 
 /**
  * Converter for opening time id <-> instance
@@ -38,16 +38,10 @@ public class FinancialsCompanyOpeningTimeConverter implements Converter<OpeningT
        /**
         * Opening time backing bean
         */
-       private static FinancialsOpeningTimeWebRequestController OPENING_TIMES_CONTROLLER;
+       private static FinancialsOpeningTimeListWebViewController OPENING_TIME_LIST_CONTROLLER;
 
        @Override
        public OpeningTime getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == OPENING_TIMES_CONTROLLER) {
-                       // Get bean from CDI directly
-                       OPENING_TIMES_CONTROLLER = CDI.current().select(FinancialsOpeningTimeWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
                        // Warning message
@@ -62,10 +56,16 @@ public class FinancialsCompanyOpeningTimeConverter implements Converter<OpeningT
 
                try {
                        // Try to parse the value as long
-                       final Long openingId = Long.valueOf(submittedValue);
+                       final Long openingTimeId = Long.valueOf(submittedValue);
+
+                       // Is the instance there?
+                       if (null == OPENING_TIME_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               OPENING_TIME_LIST_CONTROLLER = CDI.current().select(FinancialsOpeningTimeListWebViewBean.class).get();
+                       }
 
                        // Try to get user instance from it
-                       openingTime = OPENING_TIMES_CONTROLLER.findOpeningTimeById(openingId);
+                       openingTime = OPENING_TIME_LIST_CONTROLLER.findOpeningTimeById(openingTimeId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
@@ -87,7 +87,7 @@ public class FinancialsCompanyOpeningTimeConverter implements Converter<OpeningT
                }
 
                // Return id number
-               return String.valueOf(value.getOpeningId());
+               return String.valueOf(value.getOpeningTimeId());
        }
 
 }
index 734ca859bb7d138f3a31626ba8b453616a54f799..2f486c4f465d7be097c68c2f757d6f724589061e 100644 (file)
@@ -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.phone.FinancialsPhoneWebRequestBean;
-import org.mxchange.jfinancials.beans.phone.FinancialsPhoneWebRequestController;
+import org.mxchange.jfinancials.beans.phone.list.FinancialsPhoneListWebViewBean;
+import org.mxchange.jfinancials.beans.phone.list.FinancialsPhoneListWebViewController;
 import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
 
@@ -38,24 +38,12 @@ public class FinancialsFaxNumberConverter implements Converter<DialableFaxNumber
        /**
         * Phone EJB
         */
-       private static FinancialsPhoneWebRequestController PHONE_CONTROLLER;
+       private static FinancialsPhoneListWebViewController PHONE_LIST_CONTROLLER;
 
        @Override
        public DialableFaxNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == PHONE_CONTROLLER) {
-                       // Get bean from CDI directly
-                       PHONE_CONTROLLER = CDI.current().select(FinancialsPhoneWebRequestBean.class).get();
-               }
-
-               // Log message
-               // @TODO Not possible here: this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: context={1},component={2},submittedValue={3} - CALLED!", this.getClass().getSimpleName(), context, component, submittedValue)); //NOI18N
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not possible here: this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
                        // Return null
                        return null;
                }
@@ -67,10 +55,14 @@ public class FinancialsFaxNumberConverter implements Converter<DialableFaxNumber
                        // Try to parse the value as long
                        final Long faxNumberId = Long.valueOf(submittedValue);
 
-                       // Log message
-                       // @TODO Not possible here: this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject: faxNumberId={1}", this.getClass().getSimpleName(), faxNumberId)); //NOI18N
+                       // Is the instance there?
+                       if (null == PHONE_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               PHONE_LIST_CONTROLLER = CDI.current().select(FinancialsPhoneListWebViewBean.class).get();
+                       }
+
                        // Try to get mobile instance from it
-                       faxNumber = PHONE_CONTROLLER.findFaxNumberById(faxNumberId);
+                       faxNumber = PHONE_LIST_CONTROLLER.findFaxNumberById(faxNumberId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
@@ -79,8 +71,6 @@ public class FinancialsFaxNumberConverter implements Converter<DialableFaxNumber
                        // @TODO Not possible here: this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
                }
 
-               // Log message
-               // @TODO Not possible here: this.loggerBeanLocal.logTrace(MessageFormat.format("{0}.getAsObject: faxNumber={1} - EXIT!", this.getClass().getSimpleName(), faxNumber)); //NOI18N
                // Return it
                return faxNumber;
        }
index 84c4cf07ef5d7bf4e6390230e91cbfecc0dbd516..a0bab6339c4fbe28d6519b9be515efddc4f13dbd 100644 (file)
@@ -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.phone.FinancialsPhoneWebRequestBean;
-import org.mxchange.jfinancials.beans.phone.FinancialsPhoneWebRequestController;
+import org.mxchange.jfinancials.beans.phone.list.FinancialsPhoneListWebViewBean;
+import org.mxchange.jfinancials.beans.phone.list.FinancialsPhoneListWebViewController;
 import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 
@@ -38,21 +38,12 @@ public class FinancialsLandLineNumberConverter implements Converter<DialableLand
        /**
         * Phone EJB
         */
-       private static FinancialsPhoneWebRequestController PHONE_CONTROLLER;
+       private static FinancialsPhoneListWebViewController PHONE_LIST_CONTROLLER;
 
        @Override
        public DialableLandLineNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == PHONE_CONTROLLER) {
-                       // Get bean from CDI directly
-                       PHONE_CONTROLLER = CDI.current().select(FinancialsPhoneWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not possible here: this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
                        // Return null
                        return null;
                }
@@ -64,8 +55,14 @@ public class FinancialsLandLineNumberConverter implements Converter<DialableLand
                        // Try to parse the value as long
                        final Long landLineNumberId = Long.valueOf(submittedValue);
 
+                       // Is the instance there?
+                       if (null == PHONE_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               PHONE_LIST_CONTROLLER = CDI.current().select(FinancialsPhoneListWebViewBean.class).get();
+                       }
+
                        // Try to get mobile instance from it
-                       landLineNumber = PHONE_CONTROLLER.findLandLineNumberById(landLineNumberId);
+                       landLineNumber = PHONE_LIST_CONTROLLER.findLandLineNumberById(landLineNumberId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index dfa7b0b5f0206a27db4c7f02cca846c93a99bc45..7ef25b09ebb15874fcf2c276763123aac9ee0ef9 100644 (file)
@@ -22,9 +22,9 @@ 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.phone.FinancialsPhoneWebRequestBean;
-import org.mxchange.jfinancials.beans.phone.FinancialsPhoneWebRequestController;
-import org.mxchange.jphone.exceptions.phone.PhoneEntityNotFoundException;
+import org.mxchange.jfinancials.beans.mobile.list.FinancialsMobileListWebViewBean;
+import org.mxchange.jfinancials.beans.mobile.list.FinancialsMobileListWebViewController;
+import org.mxchange.jphone.exceptions.mobile.MobileEntityNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 
 /**
@@ -38,21 +38,12 @@ public class FinancialsMobileNumberConverter implements Converter<DialableMobile
        /**
         * Phone EJB
         */
-       private static FinancialsPhoneWebRequestController PHONE_CONTROLLER;
+       private static FinancialsMobileListWebViewController MOBILE_LIST_CONTROLLER;
 
        @Override
        public DialableMobileNumber getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == PHONE_CONTROLLER) {
-                       // Get bean from CDI directly
-                       PHONE_CONTROLLER = CDI.current().select(FinancialsPhoneWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
                        // Return null
                        return null;
                }
@@ -64,12 +55,18 @@ public class FinancialsMobileNumberConverter implements Converter<DialableMobile
                        // Try to parse the value as long
                        final Long mobileNumberId = Long.valueOf(submittedValue);
 
+                       // Is the instance there?
+                       if (null == MOBILE_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               MOBILE_LIST_CONTROLLER = CDI.current().select(FinancialsMobileListWebViewBean.class).get();
+                       }
+
                        // Try to get mobile instance from it
-                       mobileNumber = PHONE_CONTROLLER.findMobileNumberById(mobileNumberId);
+                       mobileNumber = MOBILE_LIST_CONTROLLER.findMobileNumberById(mobileNumberId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
-               } catch (final PhoneEntityNotFoundException ex) {
+               } catch (final MobileEntityNotFoundException ex) {
                        // Debug message
                        // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logDebug(MessageFormat.format("{0}.getAsObject(): Exception: {1} - Returning null ...", this.getClass().getSimpleName(), ex)); //NOI18N
                }
@@ -87,7 +84,7 @@ public class FinancialsMobileNumberConverter implements Converter<DialableMobile
                }
 
                // Return id number
-               return String.valueOf(value.getPhoneId());
+               return String.valueOf(value.getMobileId());
        }
 
 }
index eafa639ed7defe6877cacbc8b53d2338ce64056c..49e01d9f8370b64c8bc992252089834f772d42eb 100644 (file)
@@ -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.mobileprovider.FinancialsMobileProviderWebRequestBean;
-import org.mxchange.jfinancials.beans.mobileprovider.FinancialsMobileProviderWebRequestController;
+import org.mxchange.jfinancials.beans.mobileprovider.list.FinancialsMobileProviderListWebViewBean;
+import org.mxchange.jfinancials.beans.mobileprovider.list.FinancialsMobileProviderListWebViewController;
 import org.mxchange.jphone.exceptions.mobileprovider.MobileProviderNotFoundException;
 import org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider;
 
@@ -38,21 +38,12 @@ public class FinancialsMobileProviderConverter implements Converter<MobileProvid
        /**
         * Mobile provider backing bean
         */
-       private static FinancialsMobileProviderWebRequestController MOBILE_PROVIDER_CONTROLLER;
+       private static FinancialsMobileProviderListWebViewController MOBILE_PROVIDER_LIST_CONTROLLER;
 
        @Override
        public MobileProvider getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) {
-               // Is the instance there?
-               if (null == MOBILE_PROVIDER_CONTROLLER) {
-                       // Get bean from CDI directly
-                       MOBILE_PROVIDER_CONTROLLER = CDI.current().select(FinancialsMobileProviderWebRequestBean.class).get();
-               }
-
                // Is the value null or empty?
                if ((null == submittedValue) || (submittedValue.trim().isEmpty())) {
-                       // Warning message
-                       // @TODO Not working with JNDI (no remote interface) this.loggerBeanLocal.logWarning(MessageFormat.format("{0}.getAsObject(): submittedValue is null or empty - EXIT!", this.getClass().getSimpleName())); //NOI18N
-
                        // Return null
                        return null;
                }
@@ -65,8 +56,14 @@ public class FinancialsMobileProviderConverter implements Converter<MobileProvid
                        // Convert it to long
                        final Long providerId = Long.parseLong(submittedValue);
 
+                       // Is the instance there?
+                       if (null == MOBILE_PROVIDER_LIST_CONTROLLER) {
+                               // Get bean from CDI directly
+                               MOBILE_PROVIDER_LIST_CONTROLLER = CDI.current().select(FinancialsMobileProviderListWebViewBean.class).get();
+                       }
+
                        // Lookup of mobile provider
-                       mobileProvider = MOBILE_PROVIDER_CONTROLLER.findMobileProviderById(providerId);
+                       mobileProvider = MOBILE_PROVIDER_LIST_CONTROLLER.findMobileProviderById(providerId);
                } catch (final NumberFormatException ex) {
                        // Throw again
                        throw new ConverterException(ex);
index 18ecbb94648df169c4b5b3e1479584692ce64d68..6e1c50504d0b4b7c328c19dad8703727267f9a76 100644 (file)
@@ -23,7 +23,7 @@ import javax.faces.convert.Converter;
 import javax.faces.convert.ConverterException;
 import javax.faces.convert.FacesConverter;
 import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController;
-import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewtBean;
+import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewBean;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
 import org.mxchange.jusercore.model.user.User;
 
@@ -45,7 +45,7 @@ public class FinancialsUserConverter implements Converter<User> {
                // Is the instance there?
                if (null == USER_LIST_CONTROLLER) {
                        // Get bean from CDI directly
-                       USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewtBean.class).get();
+                       USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewBean.class).get();
                }
 
                // Is the value null or empty?
index 0085f9d7a36938afb462f30aa34585203a29541a..533380b768662fdf783f1859284078e1f310d0d6 100644 (file)
@@ -25,8 +25,8 @@ import javax.faces.context.FacesContext;
 import javax.faces.validator.FacesValidator;
 import javax.faces.validator.ValidatorException;
 import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-import org.mxchange.jfinancials.beans.business.employee.FinancialsEmployeeWebRequestBean;
-import org.mxchange.jfinancials.beans.business.employee.FinancialsEmployeeWebRequestController;
+import org.mxchange.jfinancials.beans.business.employee.list.FinancialsEmployeeListWebViewBean;
+import org.mxchange.jfinancials.beans.business.employee.list.FinancialsEmployeeListWebViewController;
 
 /**
  * A validator for employee email address validation
@@ -44,7 +44,7 @@ public class FinancialsEmployeeEmailAddressValidator extends BaseStringValidator
        /**
         * Employee backing bean
         */
-       private static FinancialsEmployeeWebRequestController EMPLOYEE_CONTROLLER;
+       private static FinancialsEmployeeListWebViewController EMPLOYEE_LIST_CONTROLLER;
 
        /**
         * Pattern matcher
@@ -115,13 +115,13 @@ public class FinancialsEmployeeEmailAddressValidator extends BaseStringValidator
                final String clientId = component.getClientId();
 
                // Is the instance there?
-               if (null == EMPLOYEE_CONTROLLER) {
+               if (null == EMPLOYEE_LIST_CONTROLLER) {
                        // Get bean from CDI directly
-                       EMPLOYEE_CONTROLLER = CDI.current().select(FinancialsEmployeeWebRequestBean.class).get();
+                       EMPLOYEE_LIST_CONTROLLER = CDI.current().select(FinancialsEmployeeListWebViewBean.class).get();
                }
 
                // Is it registered?
-               final Boolean isRegistered = EMPLOYEE_CONTROLLER.isEmailAddressRegistered(emailAddress);
+               final Boolean isRegistered = EMPLOYEE_LIST_CONTROLLER.isEmailAddressRegistered(emailAddress);
 
                // Is the email address already registered?
                if ((!clientId.endsWith("resendEmailAddress")) && (isRegistered)) { //NOI18N
index 0279469e64bccbafc9aa9d60be0f383f232850a5..d7c2e8cf8d7181df777e84aea0d9db6c270ec814 100644 (file)
@@ -25,7 +25,7 @@ import javax.faces.validator.FacesValidator;
 import javax.faces.validator.ValidatorException;
 import org.mxchange.jcoreee.validator.number.BaseNumberValidator;
 import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewController;
-import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewtBean;
+import org.mxchange.jfinancials.beans.user.list.FinancialsUserListWebViewBean;
 
 /**
  * A validator for user ids
@@ -56,7 +56,7 @@ public class FinancialsUserIdValidator extends BaseNumberValidator {
                // Is the instance there?
                if (null == USER_LIST_CONTROLLER) {
                        // Get bean from CDI directly
-                       USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewtBean.class).get();
+                       USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewBean.class).get();
                }
 
                // Cast value
index 9b5722b8ac60296119c71d03a69e6a47b4bfa27e..ed97509320ae3e3db3c9a3716f3ff31850ae44a6 100644 (file)
@@ -585,8 +585,6 @@ CONTENT_TITLE_ADMIN_LIST_CONTACT_MOBILE_NUMBER=Auflisten von Mobiltelefonnummern
 ADMIN_MENU_PHONE_NUMBERS_TITLE=Telefonnummern
 ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS=Handynummern
 ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS_TITLE=Alle Mobilfunknummern auflisten.
-ADMIN_SHOW_PHONE_CREATED=Telefoneintrag erstellt:
-ADMIN_SHOW_PHONE_UPDATED=Telefoneintrag zuletzt ge\u00e4ndert:
 ADMIN_EDIT_MOBILE_NUMBER_TITLE=Mobiltelefoneintrag {0} editieren:
 ADMIN_MOBILE_NUMBER_DATA_LEGEND=Mobiltelefonnummerdaten editeren:
 ADMIN_EDIT_MOBILE_PROVIDER=Mobilfunkanbieter \u00e4ndern:
index 91dab17ddbc7957c51cf89e5219c89e9acd6f9a9..6f87f5c3bdf2a6a374ac08f0bd53542f071b13cd 100644 (file)
@@ -573,8 +573,6 @@ CONTENT_TITLE_ADMIN_LIST_CONTACT_MOBILE_NUMBER=List mobile phone numbers:
 ADMIN_MENU_PHONE_NUMBERS_TITLE=Phone numbers
 ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS=Mobile numbers
 ADMIN_LINK_LIST_MOBILE_PHONE_NUMBERS_TITLE=List all mobile numbers.
-ADMIN_SHOW_PHONE_CREATED=Created:
-ADMIN_SHOW_PHONE_UPDATED=Last changed:
 ADMIN_EDIT_MOBILE_NUMBER_TITLE=Edit mobile entry {0}:
 ADMIN_MOBILE_NUMBER_DATA_LEGEND=Edit mobile data:
 ADMIN_EDIT_MOBILE_PROVIDER=Change mobile phone provider:
index e7811b96134720fac1268b49c907c24a93491599..681291de4d04fbed7bb19ec8e8c394e1c31b633a 100644 (file)
@@ -39,254 +39,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                        <type>java.lang.Boolean</type>
                </attribute>
        </tag>
-       <tag>
-               <tag-name>outputFaxNumberAdminDropdownMenu</tag-name>
-               <description>This tag renders a full h:panelGroup for an administrative drop-down menu for fax data.</description>
-               <source>resources/tags/admin/dropdown/fax/admin_fax_links.tpl</source>
-               <attribute>
-                       <name>faxNumber</name>
-                       <description>The fax instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber</type>
-               </attribute>
-               <attribute>
-                       <name>contact</name>
-                       <description>The contact instance that provides contact data for additional JSF links.</description>
-                       <required>false</required>
-                       <type>org.mxchange.jcontacts.model.contact.Contact</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether this tag is used to show fax data (default true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputLandLineNumberAdminDropdownMenu</tag-name>
-               <description>This tag renders a full h:panelGroup for an administrative drop-down menu for land-line data.</description>
-               <source>resources/tags/admin/dropdown/landline/admin_landline_links.tpl</source>
-               <attribute>
-                       <name>landLineNumber</name>
-                       <description>The fax instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber</type>
-               </attribute>
-               <attribute>
-                       <name>contact</name>
-                       <description>The contact instance that provides contact data for additional JSF links.</description>
-                       <required>false</required>
-                       <type>org.mxchange.jcontacts.model.contact.Contact</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether this tag is used to show land-line data (default true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputMobileNumberAdminDropdownMenu</tag-name>
-               <description>This tag renders a full h:panelGroup for an administrative drop-down menu for mobile data.</description>
-               <source>resources/tags/admin/dropdown/mobile/admin_mobile_links.tpl</source>
-               <attribute>
-                       <name>mobileNumber</name>
-                       <description>The mobile number instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber</type>
-               </attribute>
-               <attribute>
-                       <name>contact</name>
-                       <description>The contact instance that provides contact data for additional JSF links.</description>
-                       <required>false</required>
-                       <type>org.mxchange.jcontacts.model.contact.Contact</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether this tag is used to show mobile data (default true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputMobileProviderAdminDropdownMenu</tag-name>
-               <description>This tag renders a full h:panelGroup for an administrative drop-down menu for mobile provider data.</description>
-               <source>resources/tags/admin/dropdown/mobile_provider/admin_mobile_provider_links.tpl</source>
-               <attribute>
-                       <name>mobileProvider</name>
-                       <description>The mobile provider instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jphone.model.phonenumbers.mobileprovider.MobileProvider</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether this tag is used to show mobile provider data (default true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputBasicDataAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given basic data instance.</description>
-               <source>resources/tags/admin/dropdown/basic_data/admin_basic_data_links.tpl</source>
-               <attribute>
-                       <name>basicData</name>
-                       <description>The basic company data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show basic data" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputHeadquarterAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given headquarter instance.</description>
-               <source>resources/tags/admin/dropdown/headquarter/admin_headquarter_links.tpl</source>
-               <attribute>
-                       <name>headquarter</name>
-                       <description>The headquarter instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcontactsbusiness.model.headquarter.HeadquarterData</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show headquarter" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputBranchOfficeAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given branchOffice instance.</description>
-               <source>resources/tags/admin/dropdown/branch_office/admin_branch_office_links.tpl</source>
-               <attribute>
-                       <name>branchOffice</name>
-                       <description>The branch office instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show branch office" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputDepartmentAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given department instance.</description>
-               <source>resources/tags/admin/dropdown/department/admin_department_links.tpl</source>
-               <attribute>
-                       <name>department</name>
-                       <description>The department instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcontactsbusiness.model.department.Department</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show department" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputEmployeeAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given employee instance.</description>
-               <source>resources/tags/admin/dropdown/employee/admin_employee_links.tpl</source>
-               <attribute>
-                       <name>employee</name>
-                       <description>The employee instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcontactsbusiness.model.employee.Employee</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show employee" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
-       <tag>
-               <tag-name>outputOpeningTimeAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given opening time instance.</description>
-               <source>resources/tags/admin/dropdown/opening_time/admin_opening_time_links.tpl</source>
-               <attribute>
-                       <name>openingTime</name>
-                       <description>The opening time instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcontactsbusiness.model.opening_time.OpeningTimes</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show opening time" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
        <tag>
                <tag-name>outputContactAdminDropdownMenu</tag-name>
                <description>This tag renders an administrative drop-down menu for given contact instance.</description>
@@ -310,29 +62,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                        <type>java.lang.Boolean</type>
                </attribute>
        </tag>
-       <tag>
-               <tag-name>outputCountryAdminDropdownMenu</tag-name>
-               <description>This tag renders an administrative drop-down menu for given country instance.</description>
-               <source>resources/tags/admin/dropdown/country/admin_country_links.tpl</source>
-               <attribute>
-                       <name>country</name>
-                       <description>The country instance that provides the data for this tag.</description>
-                       <required>true</required>
-                       <type>org.mxchange.jcountry.model.data.Country</type>
-               </attribute>
-               <attribute>
-                       <name>renderShowLink</name>
-                       <description>Whether to render (default: true) "show country" link.</description>
-                       <required>false</required>
-                       <type>java.langBoolean</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-       </tag>
        <tag>
                <tag-name>outputUserAdminDropdownMenu</tag-name>
                <description>This tag renders an administrative drop-down menu for given user instance.</description>
index 0099a771634f8201d5bc409c01bd13836aa1ef44..3c1f61393161fc2d08c36d425cac4c5e68dcc0b2 100644 (file)
        </p:column>
 
        <p:column>
-               <p:outputLabel for="contactCreated" styleClass="table-data-label" value="#{msg.ADMIN_CONTACT_CREATED}" />
+               <p:outputLabel for="contactEntryCreated" styleClass="table-data-label" value="#{msg.ADMIN_CONTACT_CREATED}" />
 
-               <h:outputText id="contactCreated" styleClass="table-data-field" value="#{beanHelper.contact.contactCreated}">
+               <h:outputText id="contactEntryCreated" styleClass="table-data-field" value="#{beanHelper.contact.contactEntryCreated}">
                        <f:convertDateTime type="both" />
                </h:outputText>
        </p:column>
 
        <p:column>
-               <p:outputLabel for="contactUpdated" styleClass="table-data-label" value="#{msg.ADMIN_CONTACT_UPDATED}" />
+               <p:outputLabel for="contactEntryUpdated" styleClass="table-data-label" value="#{msg.ADMIN_CONTACT_UPDATED}" />
 
-               <h:outputText id="contactUpdated" styleClass="table-data-field" value="#{beanHelper.contact.contactUpdated}">
+               <h:outputText id="contactEntryUpdated" styleClass="table-data-field" value="#{beanHelper.contact.contactEntryUpdated}">
                        <f:convertDateTime type="both" />
                </h:outputText>
        </p:column>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/basic_data/admin_basic_data_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/basic_data/admin_basic_data_links.tpl
deleted file mode 100644 (file)
index 8664828..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_basic_data" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_BASIC_DATA_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="basicDataId" value="#{basicData.basicDataId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_basic_data" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_BASIC_DATA_TITLE}">
-                       <f:param name="basicDataId" value="#{basicData.basicDataId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_basic_data">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_BASIC_DATA_TITLE}" />
-                       <f:param name="basicDataId" value="#{basicData.basicDataId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/branch_office/admin_branch_office_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/branch_office/admin_branch_office_links.tpl
deleted file mode 100644 (file)
index 5967f14..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_branch_office" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_BRANCH_OFFICE_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="branchId" value="#{branchOffice.branchId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_branch_office" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_BRANCH_OFFICE_TITLE}">
-                       <f:param name="branchId" value="#{branchOffice.branchId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_branch_office">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_BRANCH_OFFICE_TITLE}" />
-                       <f:param name="branchId" value="#{branchOffice.branchId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/country/admin_country_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/country/admin_country_links.tpl
deleted file mode 100644 (file)
index 869fb57..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_country" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_COUNTRY_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="countryId" value="#{country.countryId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_country" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_COUNTRY_TITLE}">
-                       <f:param name="countryId" value="#{country.countryId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_country">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_COUNTRY_TITLE}" />
-                       <f:param name="countryId" value="#{country.countryId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/department/admin_department_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/department/admin_department_links.tpl
deleted file mode 100644 (file)
index ccc75cf..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_department" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_DEPARTMENT_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="departmentId" value="#{department.departmentId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_department" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_DEPARTMENT_TITLE}">
-                       <f:param name="departmentId" value="#{department.departmentId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_department">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_DEPARTMENT_TITLE}" />
-                       <f:param name="departmentId" value="#{department.departmentId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/employee/admin_employee_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/employee/admin_employee_links.tpl
deleted file mode 100644 (file)
index fe11cac..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_employee" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_EMPLOYEE_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="employeeId" value="#{employee.employeeId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_employee" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_EMPLOYEE_TITLE}">
-                       <f:param name="employeeId" value="#{employee.employeeId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_employee">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_EMPLOYEE_TITLE}" />
-                       <f:param name="employeeId" value="#{employee.employeeId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/fax/admin_fax_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/fax/admin_fax_links.tpl
deleted file mode 100644 (file)
index ab72367..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_fax" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_FAX_NUMBER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="phoneId" value="#{faxNumber.phoneId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_fax" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_FAX_NUMBER_TITLE}">
-                       <f:param name="phoneId" value="#{faxNumber.phoneId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_unlink_contact_fax" rendered="#{not empty contact}">
-                       <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_FAX_NUMBER_CONTACT_TITLE}" />
-                       <f:param name="phoneId" value="#{faxNumber.phoneId}" />
-                       <f:param name="contactId" value="#{contact.contactId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_fax">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_FAX_NUMBER_TITLE}" />
-                       <f:param name="phoneId" value="#{faxNumber.phoneId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/headquarter/admin_headquarter_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/headquarter/admin_headquarter_links.tpl
deleted file mode 100644 (file)
index 3809f0c..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_headquarter" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_HEADQUARTER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="headquarterId" value="#{headquarter.headquarterId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_headquarter" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_HEADQUARTER_TITLE}">
-                       <f:param name="headquarterId" value="#{headquarter.headquarterId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_headquarter">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_HEADQUARTER_TITLE}" />
-                       <f:param name="headquarterId" value="#{headquarter.headquarterId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/landline/admin_landline_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/landline/admin_landline_links.tpl
deleted file mode 100644 (file)
index 7743713..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_landline" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_LAND_LINE_NUMBER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_landline" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_LAND_LINE_NUMBER_TITLE}">
-                       <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_unlink_contact_landline" rendered="#{not empty contact}">
-                       <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_LAND_LINE_NUMBER_CONTACT_TITLE}" />
-                       <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
-                       <f:param name="contactId" value="#{contact.contactId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_landline">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_LAND_LINE_NUMBER_TITLE}" />
-                       <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/mobile/admin_mobile_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/mobile/admin_mobile_links.tpl
deleted file mode 100644 (file)
index 0a5d8eb..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_mobile" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_MOBILE_NUMBER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="phoneId" value="#{mobileNumber.phoneId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_mobile" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_MOBILE_NUMBER_TITLE}">
-                       <f:param name="phoneId" value="#{mobileNumber.phoneId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_unlink_contact_mobile" rendered="#{not empty contact}">
-                       <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_MOBILE_NUMBER_CONTACT_TITLE}" />
-                       <f:param name="phoneId" value="#{mobileNumber.phoneId}" />
-                       <f:param name="contactId" value="#{contact.contactId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_mobile">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_MOBILE_NUMBER_TITLE}" />
-                       <f:param name="phoneId" value="#{mobileNumber.phoneId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/mobile_provider/admin_mobile_provider_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/mobile_provider/admin_mobile_provider_links.tpl
deleted file mode 100644 (file)
index eba65af..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_mobile_provider" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_MOBILE_PROVIDER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="providerId" value="#{mobileProvider.providerId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_mobile_provider" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_MOBILE_PROVIDER_TITLE}">
-                       <f:param name="providerId" value="#{mobileProvider.providerId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_mobile_provider">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_MOBILE_PROVIDER_TITLE}" />
-                       <f:param name="providerId" value="#{mobileProvider.providerId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
diff --git a/web/WEB-INF/resources/tags/admin/dropdown/opening_time/admin_opening_time_links.tpl b/web/WEB-INF/resources/tags/admin/dropdown/opening_time/admin_opening_time_links.tpl
deleted file mode 100644 (file)
index 9a8a733..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:h="http://java.sun.com/jsf/html"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
-               <p:menuitem outcome="admin_show_opening_time" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_OPENING_TIME_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
-                       <f:param name="openingId" value="#{openingTime.openingId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_edit_opening_time" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_OPENING_TIME_TITLE}">
-                       <f:param name="openingId" value="#{openingTime.openingId}" />
-               </p:menuitem>
-
-               <p:menuitem outcome="admin_delete_opening_time">
-                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_OPENING_TIME_TITLE}" />
-                       <f:param name="openingId" value="#{openingTime.openingId}" />
-               </p:menuitem>
-       </p:menuButton>
-</ui:composition>
index 5cefcbfd9c76852d0fb004465860596639b54566..8d2bc03ab991a377fa4ee09eb9080424625e8d27 100644 (file)
@@ -20,7 +20,7 @@
                                </div>
 
                                <div class="table-right-medium">
-                                       <h:outputText id="mobileNumberId" value="#{mobileNumber.phoneId}" />
+                                       <h:outputText id="mobileNumberId" value="#{mobileNumber.mobileId}" />
                                </div>
                        </h:panelGroup>
 
@@ -40,7 +40,7 @@
                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                        <f:selectItems
-                                               value="#{mobileProviderController.allMobileProviders()}"
+                                               value="#{mobileProviderListController.allMobileProviders}"
                                                var="mobileProvider"
                                                itemValue="#{mobileProvider}"
                                                itemLabel="#{mobileProvider.providerCountry.countryExternalDialPrefix}#{mobileProvider.providerDialPrefix} (#{mobileProvider.providerName})"
index d50ff5e5091c2fc58782a06d91ff77fa7f4c61f1..f7de319d9af565cb4c3fc380e272d8f9304a1d36 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ui:composition
        xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:links="http://mxchange.org/jsf/core/links"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
@@ -36,7 +35,7 @@
                </p:column>
 
                <p:column>
-                       <p:outputLabel for="faxCreated" styleClass="table-data-label" value="#{msg.ADMIN_SHOW_PHONE_CREATED}" />
+                       <p:outputLabel for="faxCreated" styleClass="table-data-label" value="#{msg.ENTRY_CREATED_HEADER}" />
 
                        <h:outputText id="faxCreated" styleClass="table-data-field" value="#{faxNumber.phoneEntryCreated}">
                                <f:convertDateTime type="both" />
@@ -44,7 +43,7 @@
                </p:column>
 
                <p:column>
-                       <p:outputLabel for="faxUpdated" styleClass="table-data-label" value="#{msg.ADMIN_SHOW_PHONE_UPDATED}" />
+                       <p:outputLabel for="faxUpdated" styleClass="table-data-label" value="#{msg.ENTRY_UPDATED_HEADER}" />
 
                        <h:outputText id="faxUpdated" styleClass="table-data-field" value="#{faxNumber.phoneEntryUpdated}">
                                <f:convertDateTime type="both" />
                        <p:outputLabel styleClass="table-data-label" value="#{msg.ADMIN_SHOW_ADMINISTRATIVE_LINKS}" />
 
                        <h:panelGroup styleClass="table-data-field" layout="block">
-                               <links:outputFaxNumberAdminDropdownMenu faxNumber="#{faxNumber}" contact="#{contact}" renderShowLink="#{renderShowLink == true}" />
+                               <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
+                                       <p:menuitem outcome="admin_show_fax" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_FAX_NUMBER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
+                                               <f:param name="phoneId" value="#{faxNumber.phoneId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_edit_fax" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_FAX_NUMBER_TITLE}">
+                                               <f:param name="phoneId" value="#{faxNumber.phoneId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_unlink_contact_fax" rendered="#{not empty contact}">
+                                               <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_FAX_NUMBER_CONTACT_TITLE}" />
+                                               <f:param name="phoneId" value="#{faxNumber.phoneId}" />
+                                               <f:param name="contactId" value="#{contact.contactId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_delete_fax">
+                                               <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_FAX_NUMBER_TITLE}" />
+                                               <f:param name="phoneId" value="#{faxNumber.phoneId}" />
+                                       </p:menuitem>
+                               </p:menuButton>
                        </h:panelGroup>
                </p:column>
        </p:panelGrid>
index 87e719749b15ca4bf3bd9bfb0e3adbdfcc0bdc2d..a4cb85ddae49ee35a5e6447e859f7f0c6b98a3e6 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ui:composition
        xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:links="http://mxchange.org/jsf/core/links"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
@@ -36,7 +35,7 @@
                </p:column>
 
                <p:column>
-                       <p:outputLabel for="landLineCreated" styleClass="table-data-label" value="#{msg.ADMIN_SHOW_PHONE_CREATED}" />
+                       <p:outputLabel for="landLineCreated" styleClass="table-data-label" value="#{msg.ENTRY_CREATED_HEADER}" />
 
                        <h:outputText id="landLineCreated" styleClass="table-data-field" value="#{landLineNumber.phoneEntryCreated}">
                                <f:convertDateTime type="both" />
@@ -44,7 +43,7 @@
                </p:column>
 
                <p:column>
-                       <p:outputLabel for="landLineUpdated" styleClass="table-data-label" value="#{msg.ADMIN_SHOW_PHONE_UPDATED}" />
+                       <p:outputLabel for="landLineUpdated" styleClass="table-data-label" value="#{msg.ENTRY_UPDATED_HEADER}" />
 
                        <h:outputText id="landLineUpdated" styleClass="table-data-field" value="#{landLineNumber.phoneEntryUpdated}">
                                <f:convertDateTime type="both" />
                        <p:outputLabel styleClass="table-data-label" value="#{msg.ADMIN_SHOW_ADMINISTRATIVE_LINKS}" />
 
                        <h:panelGroup styleClass="table-data-field" layout="block">
-                               <links:outputLandLineNumberAdminDropdownMenu landLineNumber="#{landLineNumber}" contact="#{contact}" renderShowLink="#{renderShowLink == true}" />
+                               <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
+                                       <p:menuitem outcome="admin_show_landline" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_LAND_LINE_NUMBER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
+                                               <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_edit_landline" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_LAND_LINE_NUMBER_TITLE}">
+                                               <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_unlink_contact_landline" rendered="#{not empty contact}">
+                                               <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_LAND_LINE_NUMBER_CONTACT_TITLE}" />
+                                               <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
+                                               <f:param name="contactId" value="#{contact.contactId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_delete_landline">
+                                               <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_LAND_LINE_NUMBER_TITLE}" />
+                                               <f:param name="phoneId" value="#{landLineNumber.phoneId}" />
+                                       </p:menuitem>
+                               </p:menuButton>
                        </h:panelGroup>
                </p:column>
        </p:panelGrid>
index a5c6bfb2c8a60a3fbf7f859dbe07f02641497130..5c4c16cf612a1ad3767f5082a9f6c2d4528edf87 100644 (file)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <ui:composition
        xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:links="http://mxchange.org/jsf/core/links"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
@@ -22,7 +21,7 @@
                <p:column>
                        <p:outputLabel for="mobileNumberId" styleClass="table-data-label" value="#{msg.ADMIN_LABEL_ID_NUMBER}" />
 
-                       <h:outputText id="mobileNumberId" styleClass="table-data-field" value="#{mobileNumber.phoneId}" />
+                       <h:outputText id="mobileNumberId" styleClass="table-data-field" value="#{mobileNumber.mobileId}" />
                </p:column>
 
                <p:column>
@@ -44,7 +43,7 @@
                </p:column>
 
                <p:column>
-                       <p:outputLabel for="mobileCreated" styleClass="table-data-label" value="#{msg.ADMIN_SHOW_PHONE_CREATED}" />
+                       <p:outputLabel for="mobileCreated" styleClass="table-data-label" value="#{msg.ENTRY_CREATED_HEADER}" />
 
                        <h:outputText id="mobileCreated" styleClass="table-data-field" value="#{mobileNumber.phoneEntryCreated}">
                                <f:convertDateTime type="both" />
@@ -52,7 +51,7 @@
                </p:column>
 
                <p:column>
-                       <p:outputLabel for="mobileUpdated" styleClass="table-data-label" value="#{msg.ADMIN_SHOW_PHONE_UPDATED}" />
+                       <p:outputLabel for="mobileUpdated" styleClass="table-data-label" value="#{msg.ENTRY_UPDATED_HEADER}" />
 
                        <h:outputText id="mobileUpdated" styleClass="table-data-field" value="#{mobileNumber.phoneEntryUpdated}">
                                <f:convertDateTime type="both" />
                        <p:outputLabel styleClass="table-data-label" value="#{msg.ADMIN_SHOW_ADMINISTRATIVE_LINKS}" />
 
                        <h:panelGroup styleClass="table-data-field" layout="block">
-                               <links:outputMobileNumberAdminDropdownMenu mobileNumber="#{mobileNumber}" contact="#{contact}" renderShowLink="#{renderShowLink == true}" />
+                               <p:menuButton value="#{msg.OPTIONS}" rendered="#{empty rendered or rendered}">
+                                       <p:menuitem outcome="admin_show_mobile" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_MOBILE_NUMBER_TITLE}" rendered="#{empty renderShowLink or renderShowLink}">
+                                               <f:param name="phoneId" value="#{mobileNumber.mobileId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_edit_mobile" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_MOBILE_NUMBER_TITLE}">
+                                               <f:param name="phoneId" value="#{mobileNumber.mobileId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_unlink_contact_mobile" rendered="#{not empty contact}">
+                                               <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_MOBILE_NUMBER_CONTACT_TITLE}" />
+                                               <f:param name="phoneId" value="#{mobileNumber.mobileId}" />
+                                               <f:param name="contactId" value="#{contact.contactId}" />
+                                       </p:menuitem>
+
+                                       <p:menuitem outcome="admin_delete_mobile">
+                                               <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_MOBILE_NUMBER_TITLE}" />
+                                               <f:param name="phoneId" value="#{mobileNumber.mobileId}" />
+                                       </p:menuitem>
+                               </p:menuButton>
                        </h:panelGroup>
                </p:column>
        </p:panelGrid>
index 90eb57871bd7134e45449b55a2cd27c82dc3ed1e..30803f12bf2c32d37854806e8fd9c2a312f77942 100644 (file)
@@ -16,7 +16,7 @@
                        <f:converter converterId="MobileProviderConverter" />
                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
                        <f:selectItems
-                               value="#{mobileProviderController.allMobileProviders()}"
+                               value="#{mobileProviderListController.allMobileProviders}"
                                var="mobileProvider"
                                itemValue="#{mobileProvider}"
                                itemLabel="#{mobileProvider.providerCountry.countryExternalDialPrefix}#{mobileProvider.providerDialPrefix} (#{mobileProvider.providerName})"
diff --git a/web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl b/web/WEB-INF/resources/tags/table_rows/user_profile_mode_table_row.tpl
deleted file mode 100644 (file)
index 7f6432b..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<ui:composition
-       xmlns="http://www.w3.org/1999/xhtml"
-       xmlns:f="http://java.sun.com/jsf/core"
-       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
-       xmlns:p="http://primefaces.org/ui"
-       >
-
-       <p:row rendered="#{empty rendered or rendered == true}">
-               <p:outputLabel for="profileMode" value="#{labelMessage}" />
-
-               <p:selectOneMenu
-                       id="profileMode"
-                       value="#{targetController.userProfileMode}"
-                       filter="true"
-                       filterMatchMode="contains"
-                       >
-
-                       <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
-
-                       <f:selectItems
-                               value="#{dataController.profileModes}"
-                               var="profileMode"
-                               itemValue="#{profileMode}"
-                               itemLabel="#{msg[profileMode.messageKey]}"
-                               />
-               </p:selectOneMenu>
-
-               <p:message for="personalTitle" />
-       </p:row>
-</ui:composition>
index f919ad5dc0d24ac72052e9c065f2bdad732f9ac8..223674628bdc4695b5e2e667b51245bae0572a2b 100644 (file)
                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                        <f:selectItems
-                                               value="#{employeeController.allEmployees()}"
+                                               value="#{employeeListController.allEmployees}"
                                                var="companyEmployee"
                                                itemValue="#{companyEmployee}"
                                                itemLabel="#{beanHelper.renderEmployee(companyEmployee)}"
                                        <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                        <f:selectItems
-                                               value="#{employeeController.allEmployees()}"
+                                               value="#{employeeListController.allEmployees}"
                                                var="companyEmployee"
                                                itemValue="#{companyEmployee}"
                                                itemLabel="#{beanHelper.renderEmployee(companyEmployee)}"
index 7421b753c7454b0c67a35dc184dcc49e6a9a86d3..e39371c36a85f92a888eb80a9e98dc0657945eb3 100644 (file)
@@ -53,7 +53,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{employeeController.allEmployees()}"
+                                       value="#{employeeListController.allEmployees}"
                                        var="companyEmployee"
                                        itemValue="#{companyEmployee}"
                                        itemLabel="#{beanHelper.renderEmployee(companyEmployee)}"
@@ -73,7 +73,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{employeeController.allEmployees()}"
+                                       value="#{employeeListController.allEmployees}"
                                        var="companyEmployee"
                                        itemValue="#{companyEmployee}"
                                        itemLabel="#{beanHelper.renderEmployee(companyEmployee)}"
index e8ecea93d20497119b91e9cb04f95826036f5f7b..2233585d7a23f561fd59d6526765097bc24724c8 100644 (file)
@@ -59,7 +59,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{branchOfficeListController.allBranchOffices()}"
+                                       value="#{branchOfficeListController.allBranchOffices}"
                                        var="branchOffice"
                                        itemValue="#{branchOffice}"
                                        itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}"
@@ -99,7 +99,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{employeeController.allEmployees()}"
+                                       value="#{employeeListController.allEmployees}"
                                        var="employee"
                                        itemValue="#{employee}"
                                        itemLabel="#{beanHelper.renderEmployee(employee)}"
index 5b1b297db8f89d2802b87b8665d8da470ab9505a..5a3e5ee9b08f8ded4f529f16e6dc7bf5998d6fd4 100644 (file)
@@ -58,7 +58,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{branchOfficeListController.allBranchOffices()}"
+                                       value="#{branchOfficeListController.allBranchOffices}"
                                        var="branchOffice"
                                        itemValue="#{branchOffice}"
                                        itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}"
index 7e928833fee12aae077a4eb1033ead7f9c3d786b..65dab7cfc17dbb2a82b315c09f54bfa02a97abe7 100644 (file)
@@ -32,7 +32,7 @@
                                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                                <f:selectItems
-                                                       value="#{adminPhoneController.allNonLinkedFaxNumbers()}"
+                                                       value="#{adminPhoneListController.allNonLinkedFaxNumbers}"
                                                        var="faxNumber"
                                                        itemValue="#{faxNumber}"
                                                        itemLabel="#{faxNumber.phoneCountry.countryExternalDialPrefix} (#{faxNumber.phoneAreaCode}) #{faxNumber.phoneNumber}"
index 2f8350af54e223a7d164d38dd261450cad610035..a140c38bee8a73ed8b5901d8bd8e85583bf18a46 100644 (file)
@@ -44,7 +44,7 @@
                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                <f:selectItems
-                                       value="#{employeeController.allEmployees()}"
+                                       value="#{employeeListController.allEmployees}"
                                        var="companyEmployee"
                                        itemValue="#{companyEmployee}"
                                        itemLabel="#{beanHelper.renderEmployee(companyEmployee)}"
index 57870cb441449bea06846f23bf4426b5f09c5394..4d9d9740a3b6cdfa9607db2b0a719c2218734b90 100644 (file)
@@ -32,7 +32,7 @@
                                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                                <f:selectItems
-                                                       value="#{adminPhoneController.allNonLinkedLandLineNumbers()}"
+                                                       value="#{adminPhoneListController.allNonLinkedLandLineNumbers}"
                                                        var="landlineNumber"
                                                        itemValue="#{landlineNumber}"
                                                        itemLabel="#{landlineNumber.phoneCountry.countryExternalDialPrefix} (#{landlineNumber.phoneAreaCode}) #{landlineNumber.phoneNumber}"
index 4cbcf12b2484285fcb4715edb845d6fa600299af..c69cc57f729f65533a0c0e0dd038357f0ca29a88 100644 (file)
@@ -32,7 +32,7 @@
                                                <f:selectItem itemValue="#{null}" itemLabel="#{msg.NONE_SELECTED}" />
 
                                                <f:selectItems
-                                                       value="#{adminPhoneController.allNonLinkedMobileNumbers()}"
+                                                       value="#{adminPhoneListController.allNonLinkedMobileNumbers}"
                                                        var="mobileNumber"
                                                        itemValue="#{mobileNumber}"
                                                        itemLabel="#{beanHelper.renderMobileNumber(mobileNumber)}"
index f64ef0b7b75f439353a2e9a1dab9d5af64535025..05aab6b4dfc9ff46e760ab96ea2c3bef537e333d 100644 (file)
                                <h:outputText value="#{msg.USER_PROFILE_LEGEND}" />
                        </legend>
 
-                       <core:outputProfileModeTableRow targetController="#{userController}" labelMessage="#{msg.USER_PROFILE_MODE}" />
+                       <h:panelGroup styleClass="table-row" layout="block">
+                               <p:outputLabel for="profileMode" value="#{msg.USER_PROFILE_MODE}" />
+
+                               <p:selectOneMenu
+                                       id="profileMode"
+                                       value="#{targetController.userProfileMode}"
+                                       filter="true"
+                                       filterMatchMode="contains"
+                                       >
+
+                                       <f:selectItem itemValue="#{null}" itemLabel="#{msg.PLEASE_SELECT}" noSelectionOption="true" itemDisabled="true" />
+
+                                       <f:selectItems
+                                               value="#{dataController.profileModes}"
+                                               var="profileMode"
+                                               itemValue="#{profileMode}"
+                                               itemLabel="#{msg[profileMode.messageKey]}"
+                                               />
+                               </p:selectOneMenu>
+                       </h:panelGroup>
 
                        <h:panelGroup styleClass="table-row" layout="block">
                                <div class="para notice">
index b55fd89553c62a8e4f70177476dfc90f7535d31a..ce1f7f28831934569ddc5147e58e8a8e117f0cd6 100644 (file)
@@ -25,7 +25,7 @@
                                                </div>
 
                                                <div class="table-right">
-                                                       <p:inputText id="userName" value="#{userController.userName}" size="10" maxlength="20" required="true" requiredMessage="#{msg.LOGIN_NO_USER_NAME_MESSAGE}" />
+                                                       <p:inputText id="userName" value="#{userLoginController.userName}" size="10" maxlength="20" required="true" requiredMessage="#{msg.LOGIN_NO_USER_NAME_MESSAGE}" />
                                                </div>
                                        </h:panelGroup>
 
@@ -39,7 +39,7 @@
                                                </div>
 
                                                <div class="table-right">
-                                                       <p:inputText type="secret" id="userPassword" value="#{userController.userPassword}" size="10" maxlength="255" required="true" requiredMessage="#{msg.LOGIN_NO_PASSWORD_MESSAGE}" />
+                                                       <p:inputText type="secret" id="userPassword" value="#{userLoginController.userPassword}" size="10" maxlength="255" required="true" requiredMessage="#{msg.LOGIN_NO_PASSWORD_MESSAGE}" />
                                                </div>
                                        </h:panelGroup>
 
index fcd3872492c4a234f0f01907cd8a9874f9ee1e79..23c7b37edca56f443739dd98e4dff0ca89233f48 100644 (file)
                                                        </div>
 
                                                        <div class="table-right-medium">
-                                                               <p:inputText id="userName" size="20" maxlength="255" value="#{userController.userName}" required="true" requiredMessage="#{msg.GUEST_REGISTRATION_USER_NAME_NOT_ENTERED}" />
+                                                               <p:inputText
+                                                                       id="userName"
+                                                                       size="20"
+                                                                       maxlength="255"
+                                                                       value="#{userRegistrationController.userName}"
+                                                                       required="true"
+                                                                       requiredMessage="#{msg.GUEST_REGISTRATION_USER_NAME_NOT_ENTERED}"
+                                                                       />
                                                        </div>
                                                </h:panelGroup>
 
@@ -46,7 +53,7 @@
                                                        </div>
 
                                                        <div class="table-right-medium">
-                                                               <p:inputText type="secret" id="userPassword" size="10" maxlength="255" value="#{userController.userPassword}" required="#{not featureController.isFeatureEnabled('allow_user_registration_empty_password')}" requiredMessage="#{msg.GUEST_REGISTRATION_PASSWORD_NOT_ENTERED}" />
+                                                               <p:inputText type="secret" id="userPassword" size="10" maxlength="255" value="#{userRegistrationController.userPassword}" required="#{not featureController.isFeatureEnabled('allow_user_registration_empty_password')}" requiredMessage="#{msg.GUEST_REGISTRATION_PASSWORD_NOT_ENTERED}" />
                                                        </div>
                                                </h:panelGroup>
 
@@ -60,7 +67,7 @@
                                                        </div>
 
                                                        <div class="table-right-medium">
-                                                               <p:inputText type="secret" id="userPasswordRepeat" size="10" maxlength="255" value="#{userController.userPasswordRepeat}" required="#{not featureController.isFeatureEnabled('allow_user_registration_empty_password')}" requiredMessage="#{msg.GUEST_REGISTRATION_PASSWORD_REPEAT_NOT_ENTERED}" />
+                                                               <p:inputText type="secret" id="userPasswordRepeat" size="10" maxlength="255" value="#{userRegistrationController.userPasswordRepeat}" required="#{not featureController.isFeatureEnabled('allow_user_registration_empty_password')}" requiredMessage="#{msg.GUEST_REGISTRATION_PASSWORD_REPEAT_NOT_ENTERED}" />
                                                        </div>
                                                </h:panelGroup>
 
index b63427044cf0e3563a182353067089d803a56f22..5bdccf1b7cc219ad6c86f26b370f9574171a7662 100644 (file)
@@ -13,7 +13,9 @@
                                <h:outputText value="#{msg.GUEST_REGISTRATION_PAGE2_TITLE}" />
                        </div>
 
-                       <ui:include src="/WEB-INF/templates/contact/form_contact_data.tpl" />
+                       <ui:include src="/WEB-INF/templates/contact/form_contact_data.tpl">
+                               <ui:param name="targetController" value="#{userRegistrationController}" />
+                       </ui:include>
 
                        <p:panelGrid columns="2" layout="grid">
                                <p:commandButton
index d99a8f802092972ceac5623609c668aad03b7589..98cec7716a4999cc005824df683f7545b30f9e76 100644 (file)
@@ -13,7 +13,9 @@
                                <h:outputText value="#{msg.GUEST_REGISTRATION_TITLE}" />
                        </div>
 
-                       <ui:include src="/WEB-INF/templates/contact/form_contact_data.tpl" />
+                       <ui:include src="/WEB-INF/templates/contact/form_contact_data.tpl">
+                               <ui:param name="targetController" value="#{userRegistrationController}" />
+                       </ui:include>
 
                        <div class="para">
                                <fieldset class="fieldset">
                                                        </div>
 
                                                        <div class="table-right">
-                                                               <p:inputText id="userName" size="20" maxlength="255" value="#{userController.userName}" required="true" requiredMessage="#{msg.GUEST_REGISTRATION_USER_NAME_NOT_ENTERED}" />
+                                                               <p:inputText
+                                                                       id="userName"
+                                                                       size="20"
+                                                                       maxlength="255"
+                                                                       value="#{userRegistrationController.userName}"
+                                                                       required="true"
+                                                                       requiredMessage="#{msg.GUEST_REGISTRATION_USER_NAME_NOT_ENTERED}"
+                                                                       />
                                                        </div>
                                                </h:panelGroup>
 
@@ -48,7 +57,7 @@
                                                        </div>
 
                                                        <div class="table-right">
-                                                               <p:inputText type="secret" id="userPassword" size="10" maxlength="255" value="#{userController.userPassword}" />
+                                                               <p:inputText type="secret" id="userPassword" size="10" maxlength="255" value="#{userRegistrationController.userPassword}" />
                                                        </div>
                                                </h:panelGroup>
 
@@ -62,7 +71,7 @@
                                                        </div>
 
                                                        <div class="table-right">
-                                                               <p:inputText type="secret" id="userPasswordRepeat" size="10" maxlength="255" value="#{userController.userPasswordRepeat}" />
+                                                               <p:inputText type="secret" id="userPasswordRepeat" size="10" maxlength="255" value="#{userRegistrationController.userPasswordRepeat}" />
                                                        </div>
                                                </h:panelGroup>
 
index 9d45b4388bf1b4ff0a949835e32ac50180593ab6..f2174cccbdb050475210dab8fa7454708308302d 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
-    <description>An application to handle all your receipts and do some calculation with it.</description>
-    <display-name>JFinancials Application v1.0</display-name>
-    <context-param>
-        <description>Name of this project.</description>
-        <param-name>project_title</param-name>
-        <param-value>JFinancials</param-value>
-    </context-param>
-    <context-param>
-        <description>PrimeFaces theme</description>
-        <param-name>primefaces.THEME</param-name>
-        <param-value>bootstrap</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether PrimeFaces should collect all scripts and bundle it automatically.</description>
-        <param-name>primefaces.COLLECT_SCRIPTS</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Refresh period of facelets.</description>
-        <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
-        <param-value>-1</param-value>
-    </context-param>
-    <context-param>
-        <description>Development mode for WELD, keep disabled unless really needed. Currently it messes up the website.</description>
-        <param-name>org.jboss.weld.development</param-name>
-        <param-value>false</param-value>
-    </context-param>
-    <context-param>
-        <description>Generic custom JSF tags library</description>
-        <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
-        <param-value>/WEB-INF/widgets.jsf.taglib.xml;/WEB-INF/validators.jsf.taglib.xml;/WEB-INF/links.jsf.taglib.xml;/WEB-INF/project-links.jsf.taglib.xml;/WEB-INF/product.jsf.taglib.xml;/WEB-INF/product-links.jsf.taglib.xml</param-value>
-    </context-param>
-    <context-param>
-        <description>Project stage</description>
-        <param-name>javax.faces.PROJECT_STAGE</param-name>
-        <param-value>Development</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the date converter's default timezone is system's timezone.</description>
-        <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>All empty strings should be converted to null.</description>
-        <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Bar-code type for products</description>
-        <param-name>product_barcode_type</param-name>
-        <param-value>ean13</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the multi-page registration page or a single registration page is active</description>
-        <param-name>is_feature_user_register_multiple_page_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether a user name is required for this application.</description>
-        <param-name>is_feature_user_login_require_user_name_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether "resend confirmation link" is enabled.</description>
-        <param-name>is_feature_user_resend_confirmation_link_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether registration page is enabled.</description>
-        <param-name>is_feature_user_registration_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the guest menu is enabled/shown to the user.</description>
-        <param-name>is_feature_guest_menu_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the guest's index content is shown</description>
-        <param-name>is_feature_guest_index_content_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether recovery of user passwords is enabled.</description>
-        <param-name>is_feature_user_password_recovery_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the personal title is required for using the general contact controller.</description>
-        <param-name>is_feature_general_personal_title_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether personal title is required for administrative contact controller.</description>
-        <param-name>is_feature_admin_personal_title_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether users are allowed to edit their user data.</description>
-        <param-name>is_feature_user_edit_data_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the user list is accessible and visible.</description>
-        <param-name>is_feature_user_list_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether imprint page is enabled.</description>
-        <param-name>is_feature_imprint_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether terms page is enabled.</description>
-        <param-name>is_feature_terms_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether privacy page is enabled.</description>
-        <param-name>is_feature_privacy_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Feature: Users must change password after login (with current password). Administrators can enforce this.</description>
-        <param-name>is_feature_user_must_change_password_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether users are allowed to change their login password.</description>
-        <param-name>is_feature_change_user_password_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether users can change their email address.</description>
-        <param-name>is_feature_user_must_change_email_address_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether user registration page is in index or own page.</description>
-        <param-name>is_feature_user_registration_in_index_enabled</param-name>
-        <param-value>false</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether user can leave both passwords empty on registration. Then a random password will be created.</description>
-        <param-name>is_feature_allow_user_registration_empty_password_enabled</param-name>
-        <param-value>false</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether business contacts are used in this project.</description>
-        <param-name>is_feature_basic_data_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether company employees are used in this project. Maybe used in conjuction with business contacts only.</description>
-        <param-name>is_feature_company_employee_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether the public user profile is enabled. If this option is enabled, the setting "is_user_login_require_user_name" must also be enabled as it is mandadory.</description>
-        <param-name>is_feature_public_user_profile_enabled</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Maximum passwords that must be different.</description>
-        <param-name>max_user_password_history</param-name>
-        <param-value>5</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether debugging of registration form is enabled.</description>
-        <param-name>is_debug_register_enabled</param-name>
-        <param-value>false</param-value>
-    </context-param>
-    <context-param>
-        <description>Whether user names are required for completing registration.</description>
-        <param-name>is_user_login_require_user_name</param-name>
-        <param-value>true</param-value>
-    </context-param>
-    <context-param>
-        <description>Minimum password score (default 50 may be to low)</description>
-        <param-name>min_user_password_score</param-name>
-        <param-value>50</param-value>
-    </context-param>
-    <context-param>
-        <description>Type of receipt barcode (see p:barcode)</description>
-        <param-name>receipt_barcode_type</param-name>
-        <param-value>codabar</param-value>
-    </context-param>
-    <servlet>
-        <servlet-name>Faces Servlet</servlet-name>
-        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet>
-        <servlet-name>pdf</servlet-name>
-        <servlet-class>org.mxchange.pizzaapplication.servlet.receipt.PizzaPdfReceiptServlet</servlet-class>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>Faces Servlet</servlet-name>
-        <url-pattern>/faces/*</url-pattern>
-    </servlet-mapping>
-    <mime-mapping>
-        <extension>tpl</extension>
-        <mime-type>text/plain</mime-type>
-    </mime-mapping>
-    <servlet-mapping>
-        <servlet-name>pdf</servlet-name>
-        <url-pattern>/customer/recipt.pdf</url-pattern>
-    </servlet-mapping>
-    <session-config>
-        <session-timeout>
-            30
-        </session-timeout>
-    </session-config>
-    <welcome-file-list>
-        <welcome-file>faces/index.xhtml</welcome-file>
-    </welcome-file-list>
-    <security-constraint>
-        <display-name>AdminConstraint</display-name>
-        <web-resource-collection>
-            <web-resource-name>admin</web-resource-name>
-            <description>Administrative Area</description>
-            <url-pattern>/faces/admin/*</url-pattern>
-        </web-resource-collection>
-        <auth-constraint>
-            <description>Administrative Area Login</description>
-            <role-name>admin</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <login-config>
-        <auth-method>BASIC</auth-method>
-        <realm-name>file</realm-name>
-    </login-config>
-    <security-role>
-        <description>Administrative role</description>
-        <role-name>admin</role-name>
-    </security-role>
+       <description>An application to handle all your receipts and do some calculation with it.</description>
+       <display-name>JFinancials Application v1.0</display-name>
+       <context-param>
+               <description>Name of this project.</description>
+               <param-name>project_title</param-name>
+               <param-value>JFinancials</param-value>
+       </context-param>
+       <context-param>
+               <description>PrimeFaces theme</description>
+               <param-name>primefaces.THEME</param-name>
+               <param-value>bootstrap</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether PrimeFaces should collect all scripts and bundle it automatically.</description>
+               <param-name>primefaces.COLLECT_SCRIPTS</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Refresh period of facelets.</description>
+               <param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
+               <param-value>-1</param-value>
+       </context-param>
+       <context-param>
+               <description>Development mode for WELD, keep disabled unless really needed. Currently it messes up the website.</description>
+               <param-name>org.jboss.weld.development</param-name>
+               <param-value>false</param-value>
+       </context-param>
+       <context-param>
+               <description>Generic custom JSF tags library</description>
+               <param-name>javax.faces.FACELETS_LIBRARIES</param-name>
+               <param-value>/WEB-INF/widgets.jsf.taglib.xml;/WEB-INF/validators.jsf.taglib.xml;/WEB-INF/links.jsf.taglib.xml;/WEB-INF/project-links.jsf.taglib.xml;/WEB-INF/product.jsf.taglib.xml;/WEB-INF/product-links.jsf.taglib.xml</param-value>
+       </context-param>
+       <context-param>
+               <description>Project stage</description>
+               <param-name>javax.faces.PROJECT_STAGE</param-name>
+               <param-value>Development</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the date converter's default timezone is system's timezone.</description>
+               <param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>All empty strings should be converted to null.</description>
+               <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Bar-code type for products</description>
+               <param-name>product_barcode_type</param-name>
+               <param-value>ean13</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the multi-page registration page or a single registration page is active</description>
+               <param-name>is_feature_user_register_multiple_page_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether a user name is required for this application.</description>
+               <param-name>is_feature_user_login_require_user_name_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether "resend confirmation link" is enabled.</description>
+               <param-name>is_feature_user_resend_confirmation_link_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether registration page is enabled.</description>
+               <param-name>is_feature_user_registration_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the guest menu is enabled/shown to the user.</description>
+               <param-name>is_feature_guest_menu_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the guest's index content is shown</description>
+               <param-name>is_feature_guest_index_content_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether recovery of user passwords is enabled.</description>
+               <param-name>is_feature_user_password_recovery_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the personal title is required for using the general contact controller.</description>
+               <param-name>is_feature_general_personal_title_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether personal title is required for administrative contact controller.</description>
+               <param-name>is_feature_admin_personal_title_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether users are allowed to edit their user data.</description>
+               <param-name>is_feature_user_edit_data_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the user list is accessible and visible.</description>
+               <param-name>is_feature_user_list_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether imprint page is enabled.</description>
+               <param-name>is_feature_imprint_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether terms page is enabled.</description>
+               <param-name>is_feature_terms_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether privacy page is enabled.</description>
+               <param-name>is_feature_privacy_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Feature: Users must change password after login (with current password). Administrators can enforce this.</description>
+               <param-name>is_feature_user_must_change_password_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether users are allowed to change their login password.</description>
+               <param-name>is_feature_change_user_password_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether users can change their email address.</description>
+               <param-name>is_feature_user_must_change_email_address_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether user registration page is in index or own page.</description>
+               <param-name>is_feature_user_registration_in_index_enabled</param-name>
+               <param-value>false</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether user can leave both passwords empty on registration. Then a random password will be created.</description>
+               <param-name>is_feature_allow_user_registration_empty_password_enabled</param-name>
+               <param-value>false</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether business contacts are used in this project.</description>
+               <param-name>is_feature_basic_data_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether company employees are used in this project. Maybe used in conjuction with business contacts only.</description>
+               <param-name>is_feature_company_employee_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether the public user profile is enabled. If this option is enabled, the setting "is_feature_user_login_require_username_enabled" must also be enabled as it is mandadory.</description>
+               <param-name>is_feature_public_user_profile_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether user names are required for completing registration.</description>
+               <param-name>is_feature_user_login_require_username_enabled</param-name>
+               <param-value>true</param-value>
+       </context-param>
+       <context-param>
+               <description>Maximum passwords that must be different.</description>
+               <param-name>max_user_password_history</param-name>
+               <param-value>5</param-value>
+       </context-param>
+       <context-param>
+               <description>Whether debugging of registration form is enabled.</description>
+               <param-name>is_debug_register_enabled</param-name>
+               <param-value>false</param-value>
+       </context-param>
+       <context-param>
+               <description>Minimum password score (default 50 may be to low)</description>
+               <param-name>min_user_password_score</param-name>
+               <param-value>50</param-value>
+       </context-param>
+       <context-param>
+               <description>Type of receipt barcode (see p:barcode)</description>
+               <param-name>receipt_barcode_type</param-name>
+               <param-value>codabar</param-value>
+       </context-param>
+       <servlet>
+               <servlet-name>Faces Servlet</servlet-name>
+               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+               <load-on-startup>1</load-on-startup>
+       </servlet>
+       <servlet>
+               <servlet-name>pdf</servlet-name>
+               <servlet-class>org.mxchange.pizzaapplication.servlet.receipt.PizzaPdfReceiptServlet</servlet-class>
+       </servlet>
+       <servlet-mapping>
+               <servlet-name>Faces Servlet</servlet-name>
+               <url-pattern>/faces/*</url-pattern>
+       </servlet-mapping>
+       <mime-mapping>
+               <extension>tpl</extension>
+               <mime-type>text/plain</mime-type>
+       </mime-mapping>
+       <servlet-mapping>
+               <servlet-name>pdf</servlet-name>
+               <url-pattern>/customer/recipt.pdf</url-pattern>
+       </servlet-mapping>
+       <session-config>
+               <session-timeout>
+                       30
+               </session-timeout>
+       </session-config>
+       <welcome-file-list>
+               <welcome-file>faces/index.xhtml</welcome-file>
+       </welcome-file-list>
+       <security-constraint>
+               <display-name>AdminConstraint</display-name>
+               <web-resource-collection>
+                       <web-resource-name>admin</web-resource-name>
+                       <description>Administrative Area</description>
+                       <url-pattern>/faces/admin/*</url-pattern>
+               </web-resource-collection>
+               <auth-constraint>
+                       <description>Administrative Area Login</description>
+                       <role-name>admin</role-name>
+               </auth-constraint>
+       </security-constraint>
+       <login-config>
+               <auth-method>BASIC</auth-method>
+               <realm-name>file</realm-name>
+       </login-config>
+       <security-role>
+               <description>Administrative role</description>
+               <role-name>admin</role-name>
+       </security-role>
 </web-app>
index 5098806199d201dc0cccb7514096abf49e0be697..baca3b3fac84ad559d0db6c9155c5151a1bacdb7 100644 (file)
@@ -86,30 +86,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                        <type>org.mxchange.jcoreee.bean.faces.BaseFacesBean</type>
                </attribute>
        </tag>
-       <tag>
-               <tag-name>outputProfileModeTableRow</tag-name>
-               <description>This tag renders a selection box for user's profile mode.</description>
-               <source>resources/tags/table_rows/user_profile_mode_table_row.tpl</source>
-               <attribute>
-                       <name>labelMessage</name>
-                       <description>A localized message for the rendered label tag. You should use EL code here to add a label message from your bundle.</description>
-                       <required>true</required>
-                       <type>java.lang.String</type>
-               </attribute>
-               <attribute>
-                       <name>rendered</name>
-                       <description>Whether this tag is being rendered by JSF engine (default: true).</description>
-                       <required>false</required>
-                       <type>java.lang.Boolean</type>
-               </attribute>
-               <attribute>
-                       <name>targetController</name>
-                       <description>A target backing bean (EL code resolving into it) extending at least BaseFacesBean where to set the data in.</description>
-                       <required>true</required>
-                       <!-- @TODO Find an interface for BaseFacesBean and set it here instead -->
-                       <type>org.mxchange.jcoreee.bean.faces.BaseFacesBean</type>
-               </attribute>
-       </tag>
        <tag>
                <tag-name>outputAdminContactDataFormFields</tag-name>
                <description>This tag renders a fieldset for administrative purposes of contact data.</description>
index 71952482dcb4e31a315c2afdbd3bc3e0e5551620..fb75adfdb57c19e3f90ffacc8368fe357b9c71d1 100644 (file)
                                                        <f:converter converterId="EmployeeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{employeeController.allEmployees()}"
+                                                               value="#{employeeListController.allEmployees}"
                                                                var="employee"
                                                                itemValue="#{employee}"
                                                                itemLabel="#{beanHelper.renderEmployee(employee)}"
                                                        <f:converter converterId="EmployeeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{employeeController.allEmployees()}"
+                                                               value="#{employeeListController.allEmployees}"
                                                                var="employee"
                                                                itemValue="#{employee}"
                                                                itemLabel="#{beanHelper.renderEmployee(employee)}"
                                        <h:outputText value="#{basicData.companyTaxNumber}" />
                                </p:column>
 
+                               <p:column
+                                       headerText="#{msg.LANDLINE_NUMBER_HEADER}"
+                                       sortBy="#{basicData.companyLandLineNumber}"
+                                       filterBy="#{basicData.companyLandLineNumber}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{beanHelper.renderPhoneNumber(basicData.companyLandLineNumber)}" />
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.FAX_NUMBER_HEADER}"
+                                       sortBy="#{basicData.companyFaxNumber}"
+                                       filterBy="#{basicData.companyFaxNumber}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{beanHelper.renderPhoneNumber(basicData.companyFaxNumber)}" />
+                               </p:column>
+
                                <p:column
                                        headerText="#{msg.ENTRY_CREATED_HEADER}"
-                                       sortBy="#{basicData.companyCreated}"
-                                       filterBy="#{basicData.companyCreated}"
+                                       sortBy="#{basicData.companyEntryCreated}"
+                                       filterBy="#{basicData.companyEntryCreated}"
                                        filterMatchMode="contains"
                                        >
-                                       <h:outputText value="#{basicData.companyCreated}">
+                                       <h:outputText value="#{basicData.companyEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{basicData.companyEntryUpdated}"
+                                       filterBy="#{basicData.companyEntryUpdated}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{basicData.companyEntryUpdated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
                                        sortable="false"
                                        filterable="false"
                                        >
-                                       <links:outputBasicDataAdminDropdownMenu basicData="#{basicData}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_basic_data"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_BASIC_DATA_TITLE}"
+                                                       >
+                                                       <f:param name="basicDataId" value="#{basicData.basicDataId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_basic_data"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_BASIC_DATA_TITLE}"
+                                                       >
+                                                       <f:param name="basicDataId" value="#{basicData.basicDataId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_basic_data">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_BASIC_DATA_TITLE}"
+                                                               />
+                                                       <f:param name="basicDataId" value="#{basicData.basicDataId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
 
index 26522083848e198b08314b0181bd2e8ca06eba05..fa234ae3ea8db0b67353b1aa52fb6656887d0b96 100644 (file)
@@ -23,7 +23,7 @@
                        <p:dataTable
                                id="branchOfficeList"
                                var="branchOffice"
-                               value="#{branchOfficeListController.allBranchOffices()}"
+                               value="#{branchOfficeListController.allBranchOffices}"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                filteredValue="#{branchOfficeListController.filteredBranchOffices}"
                                                        <f:converter converterId="EmployeeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{employeeController.allEmployees()}"
+                                                               value="#{employeeListController.allEmployees}"
                                                                var="employee"
                                                                itemValue="#{employee}"
                                                                itemLabel="#{beanHelper.renderEmployee(employee)}"
 
                                <p:column
                                        headerText="#{msg.ENTRY_CREATED_HEADER}"
-                                       sortBy="#{branchOffice.branchCreated}"
+                                       sortBy="#{branchOffice.branchEntryCreated}"
                                        filterable="false"
                                        >
-                                       <h:outputText id="branchCreated" value="#{branchOffice.branchCreated}">
+                                       <h:outputText value="#{branchOffice.branchEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{branchOffice.branchEntryUpdated}"
+                                       filterable="false"
+                                       >
+                                       <h:outputText value="#{branchOffice.branchEntryUpdated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
                                        sortable="false"
                                        filterable="false"
                                        >
-                                       <links:outputBranchOfficeAdminDropdownMenu branchOffice="#{branchOffice}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_branch_office"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_BRANCH_OFFICE_TITLE}"
+                                                       >
+                                                       <f:param name="branchId" value="#{branchOffice.branchId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_branch_office"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_BRANCH_OFFICE_TITLE}"
+                                                       >
+                                                       <f:param name="branchId" value="#{branchOffice.branchId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_branch_office">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_BRANCH_OFFICE_TITLE}"
+                                                               />
+                                                       <f:param name="branchId" value="#{branchOffice.branchId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
 
index 42abae09ba0b16c037dbe5fd9a89e7d75c22ae2b..bb35042bb188de3e8ec08bdc7388d6231d48958d 100644 (file)
                                                <h:outputText value="#{msg.ADMIN_EXPORT_CONTACT_CREATED}" />
                                        </f:facet>
 
-                                       <h:outputText id="contactCreated" value="#{contact.contactCreated}">
-                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" locale="#{localizationController.locale}" />
+                                       <h:outputText value="#{contact.contactEntryCreated}">
+                                               <f:convertDateTime
+                                                       type="both"
+                                                       timeStyle="short"
+                                                       dateStyle="short"
+                                                       locale="#{localizationController.locale}"
+                                                       />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column>
+                                       <f:facet name="header">
+                                               <h:outputText value="#{msg.ADMIN_EXPORT_CONTACT_UPDATED}" />
+                                       </f:facet>
+
+                                       <h:outputText value="#{contact.contactEntryUpdated}">
+                                               <f:convertDateTime
+                                                       type="both"
+                                                       timeStyle="short"
+                                                       dateStyle="short"
+                                                       locale="#{localizationController.locale}"
+                                                       />
                                        </h:outputText>
                                </p:column>
                        </p:dataTable>
index 83bfb78fb29a346b9587c50bfd1d802e5a466d09..d07b6c24ff20f13da29f7ce000a0bf311c5eba21 100644 (file)
 
                                <p:column
                                        headerText="#{msg.ENTRY_CREATED_HEADER}"
-                                       sortBy="#{contact.contactCreated}"
-                                       filterBy="#{contact.contactCreated}"
+                                       sortBy="#{contact.contactEntryCreated}"
+                                       filterBy="#{contact.contactEntryCreated}"
                                        filterMatchMode="contains"
                                        >
-                                       <h:outputText value="#{contact.contactCreated}">
+                                       <h:outputText value="#{contact.contactEntryCreated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
 
                                <p:column
                                        headerText="#{msg.ENTRY_UPDATED_HEADER}"
-                                       sortBy="#{contact.contactUpdated}"
-                                       filterBy="#{contact.contactUpdated}"
+                                       sortBy="#{contact.contactEntryUpdated}"
+                                       filterBy="#{contact.contactEntryUpdated}"
                                        filterMatchMode="contains"
                                        >
-                                       <h:outputText value="#{contact.contactUpdated}">
+                                       <h:outputText value="#{contact.contactEntryUpdated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
index aa699eb71d94f5662fb53667aa11e1f46dd6add6..49b41a66128b467b8671537c5a3c5dd83a5d8d41 100644 (file)
@@ -62,7 +62,7 @@
                </h:form>
 
                <h:outputFormat styleClass="alert-danger" value="#{msg.ERROR_MOBILE_NUMBER_CONTACT_NOT_LINKED}" rendered="#{not empty beanHelper.mobileNumber and not empty beanHelper.contact and beanHelper.contact.contactMobileNumber != beanHelper.mobileNumber}">
-                       <f:param value="#{beanHelper.mobileNumber.phoneId}" />
+                       <f:param value="#{beanHelper.mobileNumber.mobileId}" />
                        <f:param value="#{beanHelper.contact.contactId}" />
                </h:outputFormat>
        </ui:define>
index 8f1e91cca9e4370e3215455e91f27fe210582553..b77176e45aaed50c056a247813362ee4db7fceff 100644 (file)
                                        filterable="false"
                                        sortable="false"
                                        >
-                                       <links:outputCountryAdminDropdownMenu country="#{country}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_country"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_COUNTRY_TITLE}"
+                                                       >
+                                                       <f:param name="countryId" value="#{country.countryId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_country"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_COUNTRY_TITLE}"
+                                                       >
+                                                       <f:param name="countryId" value="#{country.countryId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_country">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_COUNTRY_TITLE}"
+                                                               />
+                                                       <f:param name="countryId" value="#{country.countryId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
 
index 7b7d8f4fcf32a1dbc80640dd0ed6907bbe21a318..6d02e8c241655fa40d4140f530c4a9cdbd070544 100644 (file)
                                                        <f:converter converterId="BranchOfficeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{branchOfficeListController.allBranchOffices()}"
+                                                               value="#{branchOfficeListController.allBranchOffices}"
                                                                var="branchOffice"
                                                                itemValue="#{branchOffice}"
                                                                itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}"
                                                        <f:converter converterId="EmployeeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{employeeController.allEmployees()}"
+                                                               value="#{employeeListController.allEmployees}"
                                                                var="employee"
                                                                itemValue="#{employee}"
                                                                itemLabel="#{beanHelper.renderEmployee(employee)}"
                                        sortable="false"
                                        filterable="false"
                                        >
-                                       <links:outputDepartmentAdminDropdownMenu department="#{department}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_department"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_DEPARTMENT_TITLE}"
+                                                       >
+                                                       <f:param name="departmentId" value="#{department.departmentId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_department"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_DEPARTMENT_TITLE}"
+                                                       >
+                                                       <f:param name="departmentId" value="#{department.departmentId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_department">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_DEPARTMENT_TITLE}"
+                                                               />
+                                                       <f:param name="departmentId" value="#{department.departmentId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
 
index eabf74684189bad46fc435084ab5a699b7de769d..0363e00a63c1e98d2bbe03637e4276461addc0d0 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <h:form id="form-list-company-employees">
+               <h:form id="form-list-employees">
                        <p:dataTable
                                id="employeeList"
                                var="employee"
-                               value="#{employeeController.allEmployees()}"
-                               filteredValue="#{employeeController.filteredEmployees}"
+                               value="#{employeeListController.allEmployees}"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
+                               filteredValue="#{employeeListController.filteredEmployees}"
                                rows="10"
+                               rowKey="#{employee.employeeId}"
                                reflow="true"
                                resizableColumns="true"
                                rowsPerPageTemplate="5,10,20,50,100"
                                sortMode="multiple"
-                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_EMPLOYEES}"
-                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_EMPLOYEES}"
+                               summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_EMPLOYEESS}"
+                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_EMPLOYEESS}"
                                widgetVar="employeeList"
+                               selectionMode="single"
+                               selection="#{employeeListController.selectedEmployee}"
+                               skipChildren="true"
                                >
 
                                <f:facet name="header">
-                                       <p:panelGrid columns="2" columnClasses="ui-grid-col-10,ui-grid-col-2" layout="grid" styleClass="ui-noborder ui-transparent-widget">
-                                               <h:outputText value="#{msg.ADMIN_LIST_EMPLOYEES_HEADER}" />
+                                       <p:panelGrid
+                                               columns="3"
+                                               layout="grid"
+                                               columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+                                               >
+                                               <p:spacer />
+
+                                               <p:panelGrid
+                                                       columns="2"
+                                                       columnClasses="ui-grid-4,ui-grid-8"
+                                                       layout="grid"
+                                                       styleClass="ui-noborder"
+                                                       >
+                                                       <p:outputLabel
+                                                               for="globalFilter"
+                                                               value="#{msg.SEARCH_ALL_FIELDS}"
+                                                               style="float: right"
+                                                               />
+
+                                                       <p:inputText
+                                                               id="globalFilter"
+                                                               onkeyup="PF('employeeList').filter()"
+                                                               placeholder="#{msg.ENTER_KEYWORD}"
+                                                               />
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
 
-                                               <h:panelGroup>
                                                        <p:commandButton
                                                                id="toggler"
                                                                type="button"
                                                                />
 
                                                        <p:columnToggler datasource="employeeList" trigger="toggler" />
-                                               </h:panelGroup>
+                                               </p:outputPanel>
                                        </p:panelGrid>
                                </f:facet>
 
+                               <p:ajax
+                                       event="rowSelect"
+                                       update="form-list-employees:employee-details"
+                                       oncomplete="PF('employeeDialog').show()"
+                                       />
+
                                <p:column
                                        headerText="#{msg.ID_HEADER}"
                                        sortBy="#{employee.employeeId}"
                                                        <f:converter converterId="BranchOfficeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{branchOfficeListController.allBranchOffices()}"
+                                                               value="#{branchOfficeListController.allBranchOffices}"
                                                                var="branchOffice"
                                                                itemValue="#{branchOffice}"
                                                                itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}"
 
                                <p:column
                                        headerText="#{msg.ENTRY_CREATED_HEADER}"
-                                       sortBy="#{employee.employeeCreated}"
+                                       sortBy="#{employee.employeeEntryCreated}"
+                                       filterable="false"
+                                       >
+                                       <h:outputText value="#{employee.employeeEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{employee.employeeEntryUpdated}"
                                        filterable="false"
                                        >
-                                       <h:outputText id="employeeCreated" value="#{employee.employeeCreated}">
+                                       <h:outputText value="#{employee.employeeEntryUpdated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
                                        sortable="false"
                                        filterable="false"
                                        >
-                                       <links:outputEmployeeAdminDropdownMenu employee="#{employee}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_employee"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_EMPLOYEE_TITLE}"
+                                                       >
+                                                       <f:param name="employeeId" value="#{employee.employeeId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_employee"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_EMPLOYEE_TITLE}"
+                                                       >
+                                                       <f:param name="employeeId" value="#{employee.employeeId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_employee">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_EMPLOYEE_TITLE}"
+                                                               />
+                                                       <f:param name="employeeId" value="#{employee.employeeId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_EMPLOYEE_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="employeeDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="employee-details">
+                                       <p:panelGrid
+                                               columns="2"
+                                               rendered="#{not empty employeeListController.selectedEmployee}"
+                                               >
+                                               <f:facet name="header">
+                                                       <h:outputFormat
+                                                               value="#{msg.ADMIN_EMPLOYEE_NUMBER_DETAILS_HEADER}"
+                                                               rendered="#{empty employeeListController.selectedEmployee.employeePersonalData}"
+                                                               >
+                                                               <f:param value="#{employeeListController.selectedEmployee.employeeId}" />
+                                                       </h:outputFormat>
+
+                                                       <h:outputFormat
+                                                               value="#{msg.ADMIN_EMPLOYEE_NAME_DETAILS_HEADER}"
+                                                               rendered="#{not empty employeeListController.selectedEmployee.employeePersonalData}"
+                                                               >
+                                                               <f:param value="#{beanHelper.renderContact(employeeListController.selectedEmployee.employeePersonalData)}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.EMPLOYEE_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{employeeListController.selectedEmployee.employeeId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
                <h:form>
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_EMPLOYEE}"
                                                        action="#{adminEmployeeController.addEmployee()}"
-                                                       update="form-list-company-employees:employeeList"
+                                                       update="form-list-employees:employeeList"
                                                        />
                                        </p:panelGrid>
                                </f:facet>
index ded3715245eb8831ba7acbc33c8348c0113e6fd5..2146923a83eb989d281eba4622941b7871e23495 100644 (file)
@@ -21,7 +21,7 @@
                <p:dataTable
                        id="table_list_fax"
                        var="faxNumber"
-                       value="#{phoneController.allFaxNumbers()}"
+                       value="#{phoneListController.allFaxNumbers}"
                        paginator="true"
                        rows="10"
                        summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_FAXS}"
@@ -51,7 +51,7 @@
 
                        <p:column>
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_SHOW_PHONE_CREATED}" />
+                                       <h:outputText value="#{msg.ENTRY_CREATED_HEADER}" />
                                </f:facet>
 
                                <h:outputText value="#{faxNumber.phoneEntryCreated}">
@@ -61,7 +61,7 @@
 
                        <p:column>
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_SHOW_PHONE_UPDATED}" />
+                                       <h:outputText value="#{msg.ENTRY_UPDATED_HEADER}" />
                                </f:facet>
 
                                <h:outputText value="#{faxNumber.phoneEntryUpdated}">
index 1c52c3ed9237b9400f5d2fa268b5cf5785084652..32e13320cee4392163e0fe3b6b335cad244ff87e 100644 (file)
@@ -30,7 +30,7 @@
                <p:dataTable
                        id="contact_fax_link"
                        var="contact"
-                       value="#{contactPhoneController.allCurrentFaxNumberContacts}"
+                       value="#{contactPhoneController.allCurrentFaxNumberContacts()}"
                        summary="#{msg.TABLE_SUMMARY_ADMIN_SHOW_ADMINISTRATIVE_LINKS}"
                        >
                        <f:facet name="header">
index d985667d06c7e501e0ec2e49c278441452d1e8ba..c0268868076c634e8d5ee0f155c1e9ccec77e775 100644 (file)
                                                        <f:converter converterId="EmployeeConverter" />
 
                                                        <f:selectItems
-                                                               value="#{employeeController.allEmployees()}"
+                                                               value="#{employeeListController.allEmployees}"
                                                                var="employee"
                                                                itemValue="#{employee}"
                                                                itemLabel="#{beanHelper.renderEmployee(employee)}"
                                        sortable="false"
                                        filterable="false"
                                        >
-                                       <links:outputHeadquarterAdminDropdownMenu headquarter="#{headquarter}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_headquarter"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_HEADQUARTER_TITLE}"
+                                                       >
+                                                       <f:param name="headquarterId" value="#{headquarter.headquarterId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_headquarter"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_HEADQUARTER_TITLE}"
+                                                       >
+                                                       <f:param name="headquarterId" value="#{headquarter.headquarterId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_headquarter">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_HEADQUARTER_TITLE}"
+                                                               />
+                                                       <f:param name="headquarterId" value="#{headquarter.headquarterId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
 
index 129da61047695646962333f14e5a4c1eae620625..95c8c794e829c83c9af04238f2edb4f549d9777a 100644 (file)
@@ -20,7 +20,7 @@
                <p:dataTable
                        id="table_list_landline"
                        var="landLineNumber"
-                       value="#{phoneController.allLandLineNumbers()}"
+                       value="#{phoneListController.allLandLineNumbers}"
                        paginator="true"
                        rows="10"
                        summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_LAND_LINES}"
@@ -50,7 +50,7 @@
 
                        <p:column>
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_SHOW_PHONE_CREATED}" />
+                                       <h:outputText value="#{msg.ENTRY_CREATED_HEADER}" />
                                </f:facet>
 
                                <h:outputText value="#{landLineNumber.phoneEntryCreated}">
@@ -60,7 +60,7 @@
 
                        <p:column>
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_SHOW_PHONE_UPDATED}" />
+                                       <h:outputText value="#{msg.ENTRY_UPDATED_HEADER}" />
                                </f:facet>
 
                                <h:outputText value="#{landLineNumber.phoneEntryUpdated}">
index 7747849baef88e0be3024cfcefb8aab386866069..d99b94d72532219ca060bc7a397426db4f68cd60 100644 (file)
@@ -20,7 +20,7 @@
                <p:dataTable
                        id="table_list_mobiles"
                        var="mobile"
-                       value="#{phoneController.allMobileNumbers()}"
+                       value="#{phoneListController.allMobileNumbers}"
                        paginator="true"
                        rows="10"
                        summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_MOBILE_NUMBERS}"
index f7ff0a47559dbdb34fb1fad93ea2e9fc5ea7502b..5ac28359c65c0c2badcf7eec02120ff0ce174272 100644 (file)
@@ -31,7 +31,7 @@
                        <h:panelGroup layout="block">
                                <div class="table-header">
                                        <h:outputFormat value="#{msg.ADMIN_EDIT_MOBILE_NUMBER_TITLE}">
-                                               <f:param value="#{beanHelper.mobileNumber.phoneId}" />
+                                               <f:param value="#{beanHelper.mobileNumber.mobileId}" />
                                        </h:outputFormat>
                                </div>
 
index db23ca344e4cf321699b7c9615fd92b19aaf044e..1ab86f424d35692744b3c4b1d468a38fa89118b4 100644 (file)
@@ -20,7 +20,7 @@
                <p:dataTable
                        id="mobileNumberList"
                        var="mobileNumber"
-                       value="#{phoneController.allMobileNumbers()}"
+                       value="#{mobileListController.allMobileNumbers}"
                        paginator="true"
                        rows="10"
                        summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_MOBILES}"
 
                                <p:link
                                        outcome="admin_show_mobile"
-                                       value="#{mobileNumber.phoneId}"
+                                       value="#{mobileNumber.mobileId}"
                                        title="#{msg.ADMIN_LINK_SHOW_MOBILE_NUMBER_TITLE}"
                                        >
-                                       <f:param name="phoneId" value="#{mobileNumber.phoneId}" />
+                                       <f:param name="mobileId" value="#{mobileNumber.mobileId}" />
                                </p:link>
                        </p:column>
 
 
                        <p:column>
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_SHOW_PHONE_CREATED}" />
+                                       <h:outputText value="#{msg.ENTRY_CREATED_HEADER}" />
                                </f:facet>
 
-                               <h:outputText value="#{mobileNumber.phoneEntryCreated}">
+                               <h:outputText value="#{mobileNumber.mobileEntryCreated}">
                                        <f:convertDateTime type="both" />
                                </h:outputText>
                        </p:column>
 
                        <p:column>
                                <f:facet name="header">
-                                       <h:outputText value="#{msg.ADMIN_SHOW_PHONE_UPDATED}" />
+                                       <h:outputText value="#{msg.ENTRY_UPDATED_HEADER}" />
                                </f:facet>
 
-                               <h:outputText value="#{mobileNumber.phoneEntryUpdated}">
+                               <h:outputText value="#{mobileNumber.mobileEntryUpdated}">
                                        <f:convertDateTime type="both" />
                                </h:outputText>
                        </p:column>
index 37f347c0e4dd70727acf7848eb12befbc8665ab0..d804c4803d8362768f8297f6a930d13ec2121f72 100644 (file)
                <p:dataTable
                        id="contact_mobile_link"
                        var="contact"
-                       value="#{contactPhoneController.allCurrentMobileNumberContacts()}"
+                       value="#{contactMobileController.allCurrentMobileNumberContacts()}"
                        summary="#{msg.TABLE_SUMMARY_ADMIN_SHOW_ADMINISTRATIVE_LINKS}"
                        >
                        <f:facet name="header">
                                <h:outputFormat value="#{msg.ADMIN_SHOW_MOBILE_NUMBER_LINKS_HEADER}">
-                                       <f:param value="#{beanHelper.mobileNumber.phoneId}" />
+                                       <f:param value="#{beanHelper.mobileNumber.mobileId}" />
                                </h:outputFormat>
                        </f:facet>
 
@@ -98,7 +98,7 @@
                                                                outcome="admin_unlink_contact_mobile"
                                                                >
                                                                <h:outputText styleClass="link-warning" value="#{msg.ADMIN_LINK_UNLINK_SHORT}" title="#{msg.ADMIN_LINK_UNLINK_MOBILE_NUMBER_CONTACT_TITLE}" />
-                                                               <f:param name="phoneId" value="#{beanHelper.mobileNumber.phoneId}" />
+                                                               <f:param name="phoneId" value="#{beanHelper.mobileNumber.mobileId}" />
                                                                <f:param name="contactId" value="#{contact.contactId}" />
                                                        </p:link>
                                                </li>
index 8487edd6ef780a4060f3083a649ccd00a807283a..dd3b0b1691463dc0be7fd01164308c427bf22c1d 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <h:form id="form-list-mobile-provider">
+               <h:form id="form-list-mobile-providers">
                        <p:dataTable
                                id="mobileProviderList"
                                var="mobileProvider"
-                               value="#{mobileProviderController.allMobileProviders()}"
+                               value="#{mobileProviderListController.allMobileProviders}"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
-                               filteredValue="#{mobileProviderController.filteredMobileProviders}"
+                               filteredValue="#{mobileProviderListController.filteredMobileProviders}"
                                rows="10"
+                               rowKey="#{mobileProvider.providerId}"
                                reflow="true"
                                resizableColumns="true"
                                rowsPerPageTemplate="5,10,20,50,100"
                                sortMode="multiple"
                                summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_MOBILE_PROVIDERS}"
-                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_MOBILE_PROVIDER}"
+                               emptyMessage="#{msg.ADMIN_EMPTY_LIST_MOBILE_PROVIDERS}"
                                widgetVar="mobileProviderList"
+                               selectionMode="single"
+                               selection="#{mobileProviderListController.selectedMobileProvider}"
+                               skipChildren="true"
                                >
 
                                <f:facet name="header">
-                                       <p:panelGrid columns="2" columnClasses="ui-grid-col-10,ui-grid-col-2" layout="grid" styleClass="ui-noborder ui-transparent-widget">
-                                               <h:outputText value="#{msg.ADMIN_LIST_MOBILE_PROVIDERS_HEADER}" />
+                                       <p:panelGrid
+                                               columns="3"
+                                               layout="grid"
+                                               columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+                                               >
+                                               <p:spacer />
+
+                                               <p:panelGrid
+                                                       columns="2"
+                                                       columnClasses="ui-grid-4,ui-grid-8"
+                                                       layout="grid"
+                                                       styleClass="ui-noborder"
+                                                       >
+                                                       <p:outputLabel
+                                                               for="globalFilter"
+                                                               value="#{msg.SEARCH_ALL_FIELDS}"
+                                                               style="float: right"
+                                                               />
+
+                                                       <p:inputText
+                                                               id="globalFilter"
+                                                               onkeyup="PF('mobileProviderList').filter()"
+                                                               placeholder="#{msg.ENTER_KEYWORD}"
+                                                               />
+                                               </p:panelGrid>
 
-                                               <p:commandButton
-                                                       id="toggler"
-                                                       type="button"
-                                                       value="#{msg.SELECT_SHOWN_COLUMNS}"
-                                                       styleClass="column-selector"
-                                                       />
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
 
-                                               <p:columnToggler datasource="mobileProviderList" trigger="toggler" />
+                                                       <p:commandButton
+                                                               id="toggler"
+                                                               type="button"
+                                                               value="#{msg.SELECT_SHOWN_COLUMNS}"
+                                                               styleClass="column-selector"
+                                                               />
+
+                                                       <p:columnToggler datasource="mobileProviderList" trigger="toggler" />
+                                               </p:outputPanel>
                                        </p:panelGrid>
                                </f:facet>
 
+                               <p:ajax
+                                       event="rowSelect"
+                                       update="form-list-mobile-providers:mobile-provider-details"
+                                       oncomplete="PF('mobileProviderDialog').show()"
+                                       />
+
                                <p:column
                                        headerText="#{msg.ID_HEADER}"
                                        sortBy="#{mobileProvider.providerId}"
                                        headerText="#{msg.ENTRY_CREATED_HEADER}"
                                        sortBy="#{mobileProvider.providerEntryCreated}"
                                        >
-                                       <h:outputText id="providerEntryCreated" value="#{mobileProvider.providerEntryCreated}">
+                                       <h:outputText value="#{mobileProvider.providerEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{mobileProvider.providerEntryUpdated}"
+                                       >
+                                       <h:outputText value="#{mobileProvider.providerEntryUpdated}">
                                                <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
                                        </h:outputText>
                                </p:column>
                                        headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}"
                                        sortable="false"
                                        >
-                                       <links:outputMobileProviderAdminDropdownMenu mobileProvider="#{mobileProvider}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem
+                                                       outcome="admin_show_mobile_provider"
+                                                       value="#{msg.ADMIN_LINK_SHOW_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_SHOW_MOBILE_PROVIDER_TITLE}"
+                                                       >
+                                                       <f:param name="providerId" value="#{mobileProvider.providerId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem
+                                                       outcome="admin_edit_mobile_provider"
+                                                       value="#{msg.ADMIN_LINK_EDIT_SHORT}"
+                                                       title="#{msg.ADMIN_LINK_EDIT_MOBILE_PROVIDER_TITLE}"
+                                                       >
+                                                       <f:param name="providerId" value="#{mobileProvider.providerId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_mobile_provider">
+                                                       <h:outputText
+                                                               styleClass="link-danger"
+                                                               value="#{msg.ADMIN_LINK_DELETE_SHORT}"
+                                                               title="#{msg.ADMIN_LINK_DELETE_MOBILE_PROVIDER_TITLE}"
+                                                               />
+                                                       <f:param name="providerId" value="#{mobileProvider.providerId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_MOBILE_PROVIDER_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="mobileProviderDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="mobile-provider-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty mobileProviderListController.selectedMobileProvider}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_MOBILE_PROVIDER_DETAILS_HEADER}">
+                                                               <f:param value="#{mobileProviderListController.selectedMobileProvider.providerName}" />
+                                                               <f:param value="#{mobileProviderListController.selectedMobileProvider.providerId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.MOBILE_PROVIDER_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{mobileProviderListController.selectedMobileProvider.providerId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
                <h:form>
                                                type="submit"
                                                value="#{msg.BUTTON_ADMIN_ADD_MOBILE_PROVIDER}"
                                                action="#{adminMobileProviderController.addMobileProvider()}"
-                                               update="form-list-mobile-provider:mobileProviderList"
+                                               update="form-list-mobile-providers:mobileProviderList"
                                                />
                                </p:panelGrid>
                        </h:panelGroup>
index 21f9d6d19b0fc3ae6169b99a5990a5878e25f8b7..5c9d3b972f948225e7f303071560e286158de66c 100644 (file)
        </ui:define>
 
        <ui:define name="content">
-               <h:form id="form-list-opening-time">
+               <h:form id="form-list-opening-times">
                        <p:dataTable
                                id="openingTimeList"
                                var="openingTime"
-                               value="#{openingTimeController.allOpeningTimes()}"
+                               value="#{openingTimeListController.allOpeningTimes}"
                                paginator="true"
                                paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
-                               filteredValue="#{openingTimeController.filteredOpeningTimes}"
+                               filteredValue="#{openingTimeListController.filteredOpeningTimes}"
                                rows="10"
+                               rowKey="#{openingTime.openingTimeId}"
                                reflow="true"
                                resizableColumns="true"
                                rowsPerPageTemplate="5,10,20,50,100"
                                summary="#{msg.TABLE_SUMMARY_ADMIN_LIST_OPENING_TIMES}"
                                emptyMessage="#{msg.ADMIN_EMPTY_LIST_OPENING_TIMES}"
                                widgetVar="openingTimeList"
+                               selectionMode="single"
+                               selection="#{openingTimeListController.selectedOpeningTime}"
+                               skipChildren="true"
                                >
 
                                <f:facet name="header">
-                                       <p:panelGrid columns="2" columnClasses="ui-grid-col-10,ui-grid-col-2" layout="grid" styleClass="ui-noborder ui-transparent-widget">
-                                               <h:outputText value="#{msg.ADMIN_LIST_OPENING_TIMES_HEADER}" />
+                                       <p:panelGrid
+                                               columns="3"
+                                               layout="grid"
+                                               columnClasses="ui-grid-col-4,ui-grid-col-6,ui-grid-col-2"
+                                               >
+                                               <p:spacer />
+
+                                               <p:panelGrid
+                                                       columns="2"
+                                                       columnClasses="ui-grid-4,ui-grid-8"
+                                                       layout="grid"
+                                                       styleClass="ui-noborder"
+                                                       >
+                                                       <p:outputLabel
+                                                               for="globalFilter"
+                                                               value="#{msg.SEARCH_ALL_FIELDS}"
+                                                               style="float: right"
+                                                               />
+
+                                                       <p:inputText
+                                                               id="globalFilter"
+                                                               onkeyup="PF('openingTimeList').filter()"
+                                                               placeholder="#{msg.ENTER_KEYWORD}"
+                                                               />
+                                               </p:panelGrid>
+
+                                               <p:outputPanel>
+                                                       <p:spacer height="4" />
 
-                                               <h:panelGroup>
                                                        <p:commandButton
                                                                id="toggler"
                                                                type="button"
                                                                />
 
                                                        <p:columnToggler datasource="openingTimeList" trigger="toggler" />
-                                               </h:panelGroup>
+                                               </p:outputPanel>
                                        </p:panelGrid>
                                </f:facet>
 
+                               <p:ajax
+                                       event="rowSelect"
+                                       update="form-list-opening-times:opening-time-details"
+                                       oncomplete="PF('openingTimeDialog').show()"
+                                       />
+
                                <p:column
                                        headerText="#{msg.ID_HEADER}"
-                                       sortBy="#{openingTime.openingId}"
+                                       sortBy="#{openingTime.openingTimeId}"
                                        filterable="false"
                                        >
                                        <p:link
                                                outcome="admin_show_opening_time"
-                                               value="#{openingTime.openingId}"
-                                               title="#{msg.ADMIN_LINK_SHOW_DEPARTMENT_TITLE}"
+                                               value="#{openingTime.openingTimeId}"
+                                               title="#{msg.ADMIN_LINK_SHOW_OPENING_TIME_TITLE}"
                                                >
-                                               <f:param name="openingId" value="#{openingTime.openingId}" />
+                                               <f:param name="openingTimeId" value="#{openingTime.openingTimeId}" />
                                        </p:link>
                                </p:column>
 
                                        </h:outputText>
                                </p:column>
 
+                               <p:column
+                                       headerText="#{msg.ENTRY_CREATED_HEADER}"
+                                       sortBy="#{openingTime.openingTimeEntryCreated}"
+                                       filterBy="#{openingTime.openingTimeEntryCreated}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{openingTime.openingTimeEntryCreated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column
+                                       headerText="#{msg.ENTRY_UPDATED_HEADER}"
+                                       sortBy="#{openingTime.openingTimeEntryUpdated}"
+                                       filterBy="#{openingTime.openingTimeEntryUpdated}"
+                                       filterMatchMode="contains"
+                                       >
+                                       <h:outputText value="#{openingTime.openingTimeEntryUpdated}">
+                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" />
+                                       </h:outputText>
+                               </p:column>
+
                                <p:column
                                        headerText="#{msg.ADMIN_ACTION_LINKS_HEADER}"
                                        sortable="false"
                                        filterable="false"
                                        >
-                                       <links:outputOpeningTimeAdminDropdownMenu openingTime="#{openingTime}" />
+                                       <p:menuButton value="#{msg.OPTIONS}">
+                                               <p:menuitem outcome="admin_show_opening_time" value="#{msg.ADMIN_LINK_SHOW_SHORT}" title="#{msg.ADMIN_LINK_SHOW_OPENING_TIME_TITLE}">
+                                                       <f:param name="openingTimeId" value="#{openingTime.openingTimeId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_edit_opening_time" value="#{msg.ADMIN_LINK_EDIT_SHORT}" title="#{msg.ADMIN_LINK_EDIT_OPENING_TIME_TITLE}">
+                                                       <f:param name="openingTimeId" value="#{openingTime.openingTimeId}" />
+                                               </p:menuitem>
+
+                                               <p:menuitem outcome="admin_delete_opening_time">
+                                                       <h:outputText styleClass="link-danger" value="#{msg.ADMIN_LINK_DELETE_SHORT}" title="#{msg.ADMIN_LINK_DELETE_OPENING_TIME_TITLE}" />
+                                                       <f:param name="openingTimeId" value="#{openingTime.openingTimeId}" />
+                                               </p:menuitem>
+                                       </p:menuButton>
                                </p:column>
                        </p:dataTable>
+
+                       <p:dialog
+                               dynamic="true"
+                               modal="true"
+                               resizable="false"
+                               header="#{msg.ADMIN_SINGLE_OPENING_TIME_DETAILS_HEADER}"
+                               hideEffect="fade"
+                               showEffect="fade"
+                               widgetVar="openingTimeDialog"
+                               position="top"
+                               responsive="true"
+                               closeOnEscape="true"
+                               >
+                               <p:outputPanel id="opening-time-details">
+                                       <p:panelGrid columns="2" rendered="#{not empty openingTimeListController.selectedOpeningTime}">
+                                               <f:facet name="header">
+                                                       <h:outputFormat value="#{msg.ADMIN_OPENING_TIME_DETAILS_HEADER}">
+                                                               <f:param value="#{openingTimeListController.selectedOpeningTime.openingTimeId}" />
+                                                       </h:outputFormat>
+                                               </f:facet>
+
+                                               <p:outputLabel value="#{msg.ID_HEADER}" title="#{msg.OPENING_TIME_ID_NUMBER_TITLE}" />
+                                               <h:outputText value="#{openingTimeListController.selectedOpeningTime.openingTimeId}" />
+                                       </p:panelGrid>
+                               </p:outputPanel>
+                       </p:dialog>
                </h:form>
 
                <h:form>
                                                        type="submit"
                                                        value="#{msg.BUTTON_ADMIN_ADD_OPENING_TIME}"
                                                        action="#{adminOpeningTimeController.addOpeningTime()}"
-                                                       update="form-list-opening-time:openingTimeList"
+                                                       update="form-list-opening-times:openingTimeList"
                                                        />
                                        </p:panelGrid>
                                </f:facet>
index 6a8bb38d6f02269928d62973d9ac6ceb670742ce..60ede6cf975fa3cbfa1072a3eb8352c65608b183 100644 (file)
                                                <h:outputText value="#{msg.ADMIN_EXPORT_CONTACT_CREATED}" />
                                        </f:facet>
 
-                                       <h:outputText id="contactCreated" value="#{user.userContact.contactCreated}">
-                                               <f:convertDateTime type="both" timeStyle="short" dateStyle="short" locale="#{localizationController.locale}" />
+                                       <h:outputText value="#{user.userContact.contactEntryCreated}">
+                                               <f:convertDateTime
+                                                       type="both"
+                                                       timeStyle="short"
+                                                       dateStyle="short"
+                                                       locale="#{localizationController.locale}"
+                                                       />
+                                       </h:outputText>
+                               </p:column>
+
+                               <p:column>
+                                       <f:facet name="header">
+                                               <h:outputText value="#{msg.ADMIN_EXPORT_CONTACT_UPDATED}" />
+                                       </f:facet>
+
+                                       <h:outputText value="#{user.userContact.contactEntryUpdated}">
+                                               <f:convertDateTime
+                                                       type="both"
+                                                       timeStyle="short"
+                                                       dateStyle="short"
+                                                       locale="#{localizationController.locale}"
+                                                       />
                                        </h:outputText>
                                </p:column>
                        </p:dataTable>
index 5c12d183329cfe432a381d41a79a417e33722f80..842434822f6c00e5e18191c72925bf392a170481 100644 (file)
 
        <ui:define name="metadata">
                <f:metadata>
-                       <f:viewParam name="userId" value="#{beanHelper.user}" converter="UserConverter" required="true" requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}" converterMessage="#{msg.PARAMETER_USER_ID_INVALID}" />
+                       <f:viewParam
+                               name="userId"
+                               value="#{beanHelper.user}"
+                               converter="UserConverter"
+                               required="true"
+                               requiredMessage="#{msg.ERROR_PARAMETER_USER_ID_NOT_SET}"
+                               converterMessage="#{msg.PARAMETER_USER_ID_INVALID}"
+                               />
                        <f:viewAction action="#{beanHelper.notifyControllerUserConverted()}" />
                </f:metadata>
        </ui:define>
        </ui:define>
 
        <ui:define name="content">
-               <core:outputMessageBox panelGroupId="errorUserProfileDisabled" message="#{msg.ERROR_GUEST_USER_PROFILE_DISABLED}" messageStyleClass="alert-danger" rendered="#{not userController.isPublicUserProfileEnabled()}" />
+               <core:outputMessageBox
+                       panelGroupId="errorUserProfileDisabled"
+                       message="#{msg.ERROR_GUEST_USER_PROFILE_DISABLED}"
+                       messageStyleClass="alert-danger"
+                       rendered="#{not featureController.isFeatureEnabled("public_user_profile")}"
+                       />
 
-               <core:outputMessageBox panelGroupId="errorUserIdEmpty" message="#{msg.TABLE_HEADER_ERROR_HANDLING_USER_ID}" rendered="#{userController.isUserIdEmpty()}" />
+               <core:outputMessageBox
+                       panelGroupId="errorUserIdEmpty"
+                       message="#{msg.TABLE_HEADER_ERROR_HANDLING_USER_ID}"
+                       rendered="#{userLoginController.isUserIdEmpty()}"
+                       />
 
-               <ui:fragment rendered="#{userController.isPublicUserProfileEnabled()}">
-                       <core:outputMessageBox panelGroupId="errorUserProfileHidden" message="#{msg.ERROR_PROFILE_NOT_VISIBLE}" messageStyleClass="alert-danger" rendered="#{not profileController.isProfileLinkVisibleById(userController.userId)}" />
+               <ui:fragment rendered="#{featureController.isFeatureEnabled("public_user_profile")}">
+                       <core:outputMessageBox
+                               panelGroupId="errorUserProfileHidden"
+                               message="#{msg.ERROR_PROFILE_NOT_VISIBLE}"
+                               messageStyleClass="alert-danger"
+                               rendered="#{not profileController.isProfileLinkVisibleById(userLoginController.userId)}"
+                               />
 
-                       <ui:fragment rendered="#{profileController.isProfileLinkVisibleById(userController.userId)}">
+                       <ui:fragment rendered="#{profileController.isProfileLinkVisibleById(userLoginController.userId)}">
                                <p:panelGrid>
                                        <f:facet name="header">
                                                <h:outputText value="#{msg.PUBLIC_USER_PROFILE}" />
index 27f83c814f2ccad7a0d26ffb91f0037f12b7483f..7b5c18de955c7b9fbbad5143aba68bd6d36e5de1 100644 (file)
@@ -38,7 +38,9 @@
                        </div>
 
                        <h:form>
-                               <ui:include src="/WEB-INF/templates/contact/form_contact_data.tpl" />
+                               <ui:include src="/WEB-INF/templates/contact/form_contact_data.tpl">
+                                       <ui:param name="targetController" value="#{userLoginController}" />
+                               </ui:include>
 
                                <ui:include src="/WEB-INF/templates/login/user/user_enter_current_password.tpl" />