From: Roland Häder Date: Sat, 24 Mar 2018 16:09:34 +0000 (+0100) Subject: Please cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=341652cbd92d666fd616960422879a652d85382e;p=jfinancials-war.git Please cherry-pick: - isEmailAddressRegistered() should always, like other public methods, validate their parameter - introduced isCompanyNameUsed() which is similar to isEmailAddressRegistered() which will be used to check in JS107 cache if company name is already used - make sure only non-null email addresses are added to emailAddressCache - updated/changed copyright to Free Software Foundation - added TODO to get rid of generateRandomUserName() business method is which deprecated anyway - removed isPublicUserProfileEnabled() - AdminBranchOfficeWebRequestBean is surely a request-scoped backing bean - added to same bean properties for last house number and extension of branch office - renamed bean field employeePersonalContact -> employeePersonalData - fixed some leftovers from duplication of branch office controller for employees - same with department bean - used more MessageFormat.format() which prevents more String objects polluting both heaps - injected feature backing bean into admin user bean - added missing bean property for user's profile mode to same bean - introduced private method createUserInstance() to same bean - null-ed more fields in same bean in clear() method - fixed imports of ContactUtils -> Contacts - AdminHeadquarterWebRequestBean is surely a request-scoped backing bean - added to same bean properties for last house number and extension of headquarter - fixed some leftovers from duplication of branch office controller for headquarter Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jfinancials/beans/BaseFinancialsBean.java b/src/java/org/mxchange/jfinancials/beans/BaseFinancialsBean.java index 607a5b2e..a6f2829d 100644 --- a/src/java/org/mxchange/jfinancials/beans/BaseFinancialsBean.java +++ b/src/java/org/mxchange/jfinancials/beans/BaseFinancialsBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java index c0c3deba..9becdef3 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestController.java index 52f84e52..e0441b01 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestBean.java index 1de8415c..230195e6 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -461,6 +461,15 @@ public class FinancialsBasicDataWebRequestBean extends BaseFinancialsBean implem @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; diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestController.java index 5b28f52d..8822ce0c 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsBasicDataWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestBean.java index 99493c23..32e6fa40 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -21,7 +21,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.enterprise.inject.Any; import javax.inject.Inject; @@ -52,7 +52,7 @@ import org.mxchange.jusercore.model.user.User; * @author Roland Häder */ @Named ("adminBranchOfficeController") -@SessionScoped +@RequestScoped public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBean implements FinancialsAdminBranchOfficeWebRequestController { /** @@ -101,6 +101,16 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea */ private Short branchHouseNumber; + /** + * House number's extension (a,b,c,...) + */ + private String branchHouseNumberExtension; + + /** + * Last house number + */ + private Short branchLastHouseNumber; + /** * Number of branch office */ @@ -119,6 +129,11 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea @Inject private FinancialsBranchOfficeWebRequestController branchOfficeController; + /** + * Owner/leader of branch office + */ + private Employable branchOwner; + /** * Store */ @@ -393,6 +408,42 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea this.branchHouseNumber = branchHouseNumber; } + /** + * Getter for house number's extension + *

+ * @return House number's extension + */ + public String getBranchHouseNumberExtension () { + return this.branchHouseNumberExtension; + } + + /** + * Setter for house number's extension + *

+ * @param branchHouseNumberExtension House number's extension + */ + public void setBranchHouseNumberExtension (final String branchHouseNumberExtension) { + this.branchHouseNumberExtension = branchHouseNumberExtension; + } + + /** + * Getter for last house number + *

+ * @return Last house number + */ + public Short getBranchLastHouseNumber () { + return this.branchLastHouseNumber; + } + + /** + * Setter for last house number + *

+ * @param branchLastHouseNumber Last house number + */ + public void setBranchLastHouseNumber (final Short branchLastHouseNumber) { + this.branchLastHouseNumber = branchLastHouseNumber; + } + /** * Getter for branch office number *

@@ -431,6 +482,24 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea FinancialsAdminBranchOfficeWebRequestBean.branchOpeningTimes = branchOpeningTimes; } + /** + * Getter for branch office contact person + *

+ * @return Branch office contact person + */ + public Employable getBranchOwner () { + return this.branchOwner; + } + + /** + * Setter for branch office contact person + *

+ * @param branchOwner Branch office contact person + */ + public void setBranchOwner (final Employable branchOwner) { + this.branchOwner = branchOwner; + } + /** * Getter for store *

@@ -716,13 +785,26 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea this.setBranchCountry(null); this.setBranchEmailAddress(null); this.setBranchHouseNumber(null); + this.setBranchHouseNumberExtension(null); + this.setBranchLastHouseNumber(null); this.setBranchNumber(null); + this.setBranchOwner(null); this.setBranchStore(null); this.setBranchStreet(null); this.setBranchSuiteNumber(null); this.setBranchUserOwner(null); this.setBranchZipCode(null); - this.setBranchOpeningTimes(null); + + // Opening times list + this.setBranchOpeningTimes(new ArrayList(1)); + + // Fax and land-line number + this.setFaxAreaCode(null); + this.setFaxCountry(null); + this.setFaxNumber(null); + this.setLandLineAreaCode(null); + this.setLandLineCountry(null); + this.setLandLineNumber(null); // Extra-clear opening time this.clearOpeningTime(); @@ -753,7 +835,10 @@ public class FinancialsAdminBranchOfficeWebRequestBean extends BaseFinancialsBea // Add all other fields, too branchOffice.setBranchContactEmployee(this.getBranchContactEmployee()); branchOffice.setBranchEmailAddress(this.getBranchEmailAddress()); + branchOffice.setBranchHouseNumberExtension(this.getBranchHouseNumberExtension()); + branchOffice.setBranchLastHouseNumber(this.getBranchLastHouseNumber()); branchOffice.setBranchNumber(this.getBranchNumber()); + branchOffice.setBranchOwnerEmployee(this.getBranchOwner()); branchOffice.setBranchStore(this.getBranchStore()); branchOffice.setBranchSuiteNumber(this.getBranchSuiteNumber()); branchOffice.setBranchUserOwner(this.getBranchUserOwner()); diff --git a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestController.java index 38d70897..a499c403 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsAdminBranchOfficeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestBean.java index d1590740..9a287b16 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -204,6 +204,15 @@ public class FinancialsBranchOfficeWebRequestBean extends BaseFinancialsBean imp @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; diff --git a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestController.java index 31ac9d31..5cc185fc 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/branchoffice/FinancialsBranchOfficeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestBean.java index 5d981d25..237b24f3 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -122,7 +122,7 @@ public class FinancialsAdminDepartmentWebRequestBean extends BaseFinancialsBean // Is the department not created yet? if (this.isDepartmentCreatedByRequiredData(department)) { // Then show proper faces message - this.showFacesMessage("form-admin-add-department:branchStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED"); //NOI18N + this.showFacesMessage("form-admin-add-department:branchStreet", "ADMIN_DEPARTMENT_ALREADY_CREATED"); //NOI18N return ""; //NOI18N } diff --git a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestController.java index f960f39b..f1755688 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsAdminDepartmentWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestBean.java index d308404f..5ecc8dce 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestController.java index 0825c3a6..023e61c9 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/department/FinancialsDepartmentWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestBean.java index 8e33098a..a463c3b9 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 RRoland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -107,7 +107,7 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im /** * Assigned personal data of the employee */ - private Contact employeePersonalContact; + private Contact employeePersonalData; /** * Employee's phone extension (on top of a "main number") @@ -163,7 +163,7 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im updatedOffice = this.adminEmployeeBean.addEmployee(employee); } catch (final EmployeeAlreadyAddedException ex) { // Output message - this.showFacesMessage("form-admin-add-branch-office:branchStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED"); //NOI18N + this.showFacesMessage("form-admin-add-employee:employeeNumber", "ADMIN_EMPLOYEE_ALREADY_CREATED"); //NOI18N return ""; //NOI18N } @@ -290,17 +290,17 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im *

* @return Employee's personal contact data */ - public Contact getEmployeePersonalContact () { - return this.employeePersonalContact; + public Contact getEmployeePersonalData () { + return this.employeePersonalData; } /** * Setter for employee's personal contact data *

- * @param employeePersonalContact Employee's personal contact data + * @param employeePersonalData Employee's personal contact data */ - public void setEmployeePersonalContact (final Contact employeePersonalContact) { - this.employeePersonalContact = employeePersonalContact; + public void setEmployeePersonalData (final Contact employeePersonalData) { + this.employeePersonalData = employeePersonalData; } /** @@ -385,7 +385,7 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im this.setEmployeeDepartment(null); this.setEmployeeEmailAddress(null); this.setEmployeeHeadquarter(null); - this.setEmployeePersonalContact(null); + this.setEmployeePersonalData(null); this.setEmployeePhoneExtension(null); this.setEmployeeNumber(null); this.setEmployeeUserOwner(null); @@ -398,7 +398,7 @@ public class FinancialsAdminEmployeeWebRequestBean extends BaseFinancialsBean im */ private Employable createEmployee () { // Init instance - final Employable employee = new BusinessEmployee(this.getEmployeeCompany(), this.getEmployeeNumber(), this.getEmployeePersonalContact()); + final Employable employee = new BusinessEmployee(this.getEmployeeCompany(), this.getEmployeeNumber(), this.getEmployeePersonalData()); // Set all othewr data employee.setEmployeeBranchOffice(this.getEmployeeBranchOffice()); diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestController.java index 75d1f5a8..e2a1a424 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsAdminEmployeeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java index b4ec452f..e43bf182 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 RRoland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -22,6 +22,7 @@ import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Objects; import javax.annotation.PostConstruct; import javax.cache.Cache; import javax.ejb.EJB; @@ -123,7 +124,7 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme throw new NullPointerException("employeeId is null"); //NOI18N } else if (employeeId < 1) { // Throw IAE - throw new IllegalArgumentException("employeeId=" + employeeId + " is invalid"); //NOI18N + throw new IllegalArgumentException(MessageFormat.format("employeeId={0} is invalid", employeeId)); //NOI18N } else if (!this.employeeCache.containsKey(employeeId)) { // Not found throw new EmployeeNotFoundException(employeeId); @@ -142,7 +143,7 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme * @return Filtered list of employees */ @SuppressWarnings ("ReturnOfCollectionOrArrayField") - public List getFilteredEmployees () { //NOI18N + public List getFilteredEmployees () { return this.filteredEmployees; } @@ -152,7 +153,7 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme * @param filteredEmployees Filtered list of employees */ @SuppressWarnings ("AssignmentToCollectionOrArrayFieldFromParameter") - public void setFilteredEmployees (final List filteredEmployees) { //NOI18N + public void setFilteredEmployees (final List filteredEmployees) { this.filteredEmployees = filteredEmployees; } @@ -197,4 +198,32 @@ public class FinancialsEmployeeWebRequestBean extends BaseFinancialsBean impleme } } + @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; + } + } diff --git a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestController.java index 59eb640a..432f57da 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/employee/FinancialsEmployeeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -28,6 +28,15 @@ import org.mxchange.jcontactsbusiness.model.employee.Employable; */ public interface FinancialsEmployeeWebRequestController extends Serializable { + /** + * Validates if given email address is already in use by an employee + *

+ * @param emailAddress Email address to be validated + *

+ * @return Whether the email address is already used + */ + Boolean isEmailAddressRegistered (final String emailAddress); + /** * Returns a list of all company employees *

diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestBean.java index 994215ae..d69a8e63 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -21,7 +21,7 @@ import java.util.Date; import java.util.List; import java.util.Objects; import javax.ejb.EJB; -import javax.enterprise.context.SessionScoped; +import javax.enterprise.context.RequestScoped; import javax.enterprise.event.Event; import javax.enterprise.inject.Any; import javax.inject.Inject; @@ -51,7 +51,7 @@ import org.mxchange.jusercore.model.user.User; * @author Roland Häder */ @Named ("adminHeadquarterController") -@SessionScoped +@RequestScoped public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean implements FinancialsAdminHeadquarterWebRequestController { /** @@ -97,6 +97,11 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean */ private String headquarterCity; + /** + * Headquarter's company name + */ + private String headquarterCompanyName; + /** * Contact person in headquarter */ @@ -123,6 +128,16 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean */ private Short headquarterHouseNumber; + /** + * House number's extension + */ + private String headquarterHouseNumberExtension; + + /** + * Last house number + */ + private Short headquarterLastHouseNumber; + /** * Store */ @@ -211,7 +226,7 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean // Is the headquarter not created yet? if (this.isHeadquarterCreatedByRequiredData(headquarter)) { // Then show proper faces message - this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED"); //NOI18N + this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED"); //NOI18N return ""; //NOI18N } @@ -223,7 +238,7 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean updatedHeadquarter = this.adminHeadquarterBean.addHeadquarter(headquarter); } catch (final HeadquarterAlreadyAddedException ex) { // Output message - this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_BRANCH_OFFICE_ALREADY_CREATED"); //NOI18N + this.showFacesMessage("form-admin-add-headquarter-office:headquarterStreet", "ADMIN_HEADQUARTER_ALREADY_CREATED"); //NOI18N return ""; //NOI18N } @@ -234,7 +249,7 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean this.clear(); // Redirect to list - return "admin_list_headquarter_office"; //NOI18N + return "admin_list_headquarter"; //NOI18N } /** @@ -346,6 +361,24 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean this.headquarterCity = headquarterCity; } + /** + * Getter for headquarter's company name + *

+ * @return Headquarter's company name + */ + public String getHeadquarterCompanyName () { + return this.headquarterCompanyName; + } + + /** + * Setter for headquarter's company name + *

+ * @param headquarterCompanyName Headquarter's company name + */ + public void setHeadquarterCompanyName (final String headquarterCompanyName) { + this.headquarterCompanyName = headquarterCompanyName; + } + /** * Getter for headquarter contact person *

@@ -418,6 +451,42 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean this.headquarterHouseNumber = headquarterHouseNumber; } + /** + * Getter for house number's extension + *

+ * @return House number's extension + */ + public String getHeadquarterHouseNumberExtension () { + return this.headquarterHouseNumberExtension; + } + + /** + * Setter for house number's extension + *

+ * @param headquarterHouseNumberExtension House number's extension + */ + public void setHeadquarterHouseNumberExtension (final String headquarterHouseNumberExtension) { + this.headquarterHouseNumberExtension = headquarterHouseNumberExtension; + } + + /** + * Getter for last house number + *

+ * @return Last house number + */ + public Short getHeadquarterLastHouseNumber () { + return this.headquarterLastHouseNumber; + } + + /** + * Setter for last house number + *

+ * @param headquarterLastHouseNumber Last house number + */ + public void setHeadquarterLastHouseNumber (final Short headquarterLastHouseNumber) { + this.headquarterLastHouseNumber = headquarterLastHouseNumber; + } + /** * Getter for opening times of this headquarter *

@@ -664,10 +733,13 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean private void clear () { // Clear all headquarter data this.setHeadquarterCity(null); + this.setHeadquarterCompanyName(null); this.setHeadquarterContactEmployee(null); this.setHeadquarterCountry(null); this.setHeadquarterEmailAddress(null); this.setHeadquarterHouseNumber(null); + this.setHeadquarterHouseNumberExtension(null); + this.setHeadquarterLastHouseNumber(null); this.setHeadquarterStore(null); this.setHeadquarterStreet(null); this.setHeadquarterSuiteNumber(null); @@ -699,11 +771,13 @@ public class FinancialsAdminHeadquarterWebRequestBean extends BaseFinancialsBean */ private Headquarter createHeadquarter () { // Create new headquarter instance - final Headquarter headquarter = new BusinessHeadquarter(this.getHeadquarterCity(), this.getHeadquarterCountry(), this.getHeadquarterStreet(), this.getHeadquarterZipCode(), this.getHeadquarterHouseNumber()); + final Headquarter headquarter = new BusinessHeadquarter(this.getHeadquarterCompanyName(), this.getHeadquarterCity(), this.getHeadquarterCountry(), this.getHeadquarterStreet(), this.getHeadquarterZipCode(), this.getHeadquarterHouseNumber()); // Add all other fields, too headquarter.setHeadquarterContactEmployee(this.getHeadquarterContactEmployee()); headquarter.setHeadquarterEmailAddress(this.getHeadquarterEmailAddress()); + headquarter.setHeadquarterHouseNumberExtension(this.getHeadquarterHouseNumberExtension()); + headquarter.setHeadquarterLastHouseNumber(this.getHeadquarterLastHouseNumber()); headquarter.setHeadquarterStore(this.getHeadquarterStore()); headquarter.setHeadquarterSuiteNumber(this.getHeadquarterSuiteNumber()); headquarter.setHeadquarterUserOwner(this.getHeadquarterUserOwner()); diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestController.java index c5ffe143..57944e12 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsAdminHeadquarterWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestBean.java index 33612dc0..fbbd45e9 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -202,8 +202,45 @@ public class FinancialsHeadquarterWebRequestBean extends BaseFinancialsBean impl } } + @Override + public Boolean isCompanyNameUsed (final String companyName) { + // Validate parameter + if (null == companyName) { + // Throw NPE + throw new NullPointerException("companyName is null"); //NOI18N + } else if (companyName.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("companyName is empty"); //NOI18N + } + + // Default is not found + boolean isFound = false; + + // Check all entries + for (final Headquarter headquarter : this.allHeadquarter()) { + // Is same company name? + if (Objects.equals(headquarter.getHeadquarterCompanyName(), companyName)) { + // Found it + isFound = true; + break; + } + } + + // Return flag + return isFound; + } + @Override public Boolean isEmailAddressRegistered (final String emailAddress) { + // Validate parameter + if (null == emailAddress) { + // Throw NPE + throw new NullPointerException("emailAddress is null"); //NOI18N + } else if (emailAddress.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("emailAddress is empty"); //NOI18N + } + // Default is not found boolean isFound = false; diff --git a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestController.java index e91c4372..ab318fef 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/headquarter/FinancialsHeadquarterWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -28,6 +28,15 @@ import org.mxchange.jcontactsbusiness.model.headquarter.Headquarter; */ public interface FinancialsHeadquarterWebRequestController extends Serializable { + /** + * Checks whether given company name already exists + *

+ * @param companyName Company name to check + *

+ * @return Whether the company name exists + */ + Boolean isCompanyNameUsed (final String companyName); + /** * Checks if given email address is already registered by an other * headquarter diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestBean.java index 85103d18..203c17c1 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestController.java index 168e2022..43ae3757 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsAdminOpeningTimeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java index 7f0ef7c1..39611f61 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestController.java index 5a5e060b..6b6013b1 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/opening_time/FinancialsOpeningTimeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 Roland Häder + * Copyright (C) 2017, 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java index 69d14feb..5791012e 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -36,7 +36,7 @@ import org.mxchange.jcontacts.exceptions.ContactAlreadyAddedException; import org.mxchange.jcontacts.model.contact.AdminContactSessionBeanRemote; import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote; -import org.mxchange.jcontacts.model.contact.ContactUtils; +import org.mxchange.jcontacts.model.contact.Contacts; import org.mxchange.jcontacts.model.contact.UserContact; import org.mxchange.jcontacts.model.contact.title.PersonalTitle; import org.mxchange.jcountry.model.data.Country; @@ -1116,7 +1116,7 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp final Contact next = iterator.next(); // Is the same? - if (ContactUtils.isSameContact(contact, next)) { + if (Contacts.isSameContact(contact, next)) { // Yes, then abort loop IsFound = false; break; @@ -1158,13 +1158,13 @@ public class FinancialsAdminContactWebRequestBean extends BaseFinancialsBean imp contact.setContactCountry(this.getContactCountry()); // Update contact's cmobile number - this.isMobileNumberUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber()); + this.isMobileNumberUnlinked = Contacts.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber()); // Update contact's land-line number - this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber()); + this.isLandLineUnlinked = Contacts.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber()); // Update contact's fax number - this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber()); + this.isFaxUnlinked = Contacts.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber()); } } diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestController.java index c1aafd8c..963a1c31 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsAdminContactWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java index 0f00f682..35c5b6b1 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -36,7 +36,7 @@ import org.mxchange.jcontacts.events.contact.update.ObservableAdminUpdatedContac import org.mxchange.jcontacts.exceptions.ContactNotFoundException; import org.mxchange.jcontacts.model.contact.Contact; import org.mxchange.jcontacts.model.contact.ContactSessionBeanRemote; -import org.mxchange.jcontacts.model.contact.ContactUtils; +import org.mxchange.jcontacts.model.contact.Contacts; import org.mxchange.jcontacts.model.contact.UserContact; import org.mxchange.jcontacts.model.contact.title.PersonalTitle; import org.mxchange.jcountry.model.data.Country; @@ -601,13 +601,13 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen contact.setContactCountry(this.getCountry()); // Update contact's mobile number - this.isMobileUnlinked = ContactUtils.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber()); + this.isMobileUnlinked = Contacts.updateMobileNumber(contact, this.getMobileProvider(), this.getMobileNumber()); // Update contact's land-line number - this.isLandLineUnlinked = ContactUtils.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber()); + this.isLandLineUnlinked = Contacts.updateLandLineNumber(contact, this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber()); // Update contact's fax number - this.isFaxUnlinked = ContactUtils.updateFaxNumber(contact, this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber()); + this.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); @@ -1057,7 +1057,12 @@ public class FinancialsContactWebRequestBean extends BaseFinancialsBean implemen for (final Contact contact : contacts) { // Add it to cache this.contactCache.put(contact.getContactId(), contact); - this.emailAddressCache.put(contact.getContactId(), contact.getContactEmailAddress()); + + // Is email address given? + if (contact.getContactEmailAddress() != null) { + // Set it, too + this.emailAddressCache.put(contact.getContactId(), contact.getContactEmailAddress()); + } } } else if (this.selectableContactsCache.iterator().hasNext()) { // Has already entries, avoid executing below code diff --git a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java index 2d486bf1..1758f7eb 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/FinancialsContactWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java index fe61c992..19927c1a 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestController.java index 57b9add3..3f8f8859 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsAdminContactPhoneWebRequestController.java @@ -1,6 +1,6 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java index 24a3e32a..455b7df0 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java index f8233b31..15e4e686 100644 --- a/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/contact/phone/FinancialsContactPhoneWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java index fcc196b4..c9775bf4 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestController.java index 768eacf8..42f82a4c 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsAdminCountryWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java index 9d3d7650..bfa0098b 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java index de2e8724..050c3cb4 100644 --- a/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/country/FinancialsCountryWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/data/FinancialsDataWebApplicationBean.java b/src/java/org/mxchange/jfinancials/beans/data/FinancialsDataWebApplicationBean.java index 3b1853a2..6b5ae377 100644 --- a/src/java/org/mxchange/jfinancials/beans/data/FinancialsDataWebApplicationBean.java +++ b/src/java/org/mxchange/jfinancials/beans/data/FinancialsDataWebApplicationBean.java @@ -48,45 +48,45 @@ public class FinancialsDataWebApplicationBean extends BaseFinancialsBean { } /** - * Returns a list of all days of the week + * Returns an array of all days of the week *

- * @return A list of all days of the week + * @return An array of all days of the week */ public DayOfTheWeek[] getDayOfTheWeek () { return DayOfTheWeek.values(); } /** - * Returns a list of all payment types + * Returns an array of all payment types *

- * @return A list of all payment types + * @return An array of all payment types */ public PaymentType[] getPaymentTypes () { return PaymentType.values(); } /** - * Returns a list of all personal titles + * Returns an array of all personal titles *

- * @return A list of all personal titles + * @return An array of all personal titles */ public PersonalTitle[] getPersonalTitles () { return PersonalTitle.values(); } /** - * Returns a list of all profile modes

- * @return A list of all profile modes + * @return An array of all profile modes */ public ProfileMode[] getProfileModes () { return ProfileMode.values(); } /** - * Returns a list of all user account statuses + * Returns an array of all user account statuses *

- * @return A list of all user account statuses + * @return An array of all user account statuses */ public UserAccountStatus[] getUserAccountStatuses () { return UserAccountStatus.values(); diff --git a/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeatureWebApplicationBean.java b/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeatureWebApplicationBean.java index fc5278d9..83a7ecad 100644 --- a/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeatureWebApplicationBean.java +++ b/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeatureWebApplicationBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeaturesWebApplicationController.java b/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeaturesWebApplicationController.java index fa18edff..771a5aac 100644 --- a/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeaturesWebApplicationController.java +++ b/src/java/org/mxchange/jfinancials/beans/features/FinancialsFeaturesWebApplicationController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationBean.java b/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationBean.java index 82f68f55..dc8ea6d0 100644 --- a/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationBean.java +++ b/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationController.java b/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationController.java index ccf39c66..0d4494bd 100644 --- a/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationController.java +++ b/src/java/org/mxchange/jfinancials/beans/gender/FinancialsGenderWebApplicationController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java index bae27edf..367f38eb 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -26,6 +26,7 @@ import javax.inject.Named; import org.mxchange.jcontacts.events.contact.created.CreatedContactEvent; import org.mxchange.jcontacts.events.contact.created.ObservableCreatedContactEvent; import org.mxchange.jcontacts.model.contact.Contact; +import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice; import org.mxchange.jcontactsbusiness.model.department.Department; import org.mxchange.jcontactsbusiness.model.employee.Employable; @@ -441,6 +442,39 @@ public class FinancialsWebRequestHelperBean extends BaseFinancialsBean implement this.userCreatedEvent.fire(new CreatedUserEvent(this.getUser())); } + /** + * Renders data of basic company data + *

+ * @param basicData Basic company data instance + *

+ * @return Basic company data as string + */ + public String renderBasicData (final BasicData basicData) { + // Default is empty string, so let's get started + final StringBuilder sb = new StringBuilder(30); + + // Is basic company data set? + if (basicData instanceof BasicData) { + // Add company name + sb.append(basicData.getCompanyName()); //NOI18N + + // Is email address set? + if (basicData.getCompanyEmailAddress() != null) { + // Add it + sb.append(", ").append(basicData.getCompanyEmailAddress()); //NOI18N + } + + // Is tax number set? + if (basicData.getCompanyTaxNumber() != null) { + // Add it + sb.append(", ").append(basicData.getCompanyTaxNumber()); //NOI18N + } + } + + // Return it + return sb.toString(); + } + /** * Returns the branch office's full address. If null is provided, an empty * string is returned. @@ -455,6 +489,9 @@ public class FinancialsWebRequestHelperBean extends BaseFinancialsBean implement // Is a branch office instance given? if (branchOffice instanceof BranchOffice) { + // This should not happen: + assert (branchOffice.getBranchCompany() instanceof BasicData) : "branchOffice.branchCompany is null"; //NOI18N + // Yes, then append all data sb.append(branchOffice.getBranchCompany().getCompanyName()); sb.append(", "); //NOI18N @@ -600,7 +637,7 @@ public class FinancialsWebRequestHelperBean extends BaseFinancialsBean implement * returned. *

* @param headquarter Headquarter instance -

+ *

* @return Headquarter address */ public String renderHeadquarter (final Headquarter headquarter) { diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperController.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperController.java index 48a8d03a..4890ed6c 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperController.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebRequestHelperController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java index 5d7c55fe..4127e940 100644 --- a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java index a273f888..f898239c 100644 --- a/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/localization/FinancialsLocalizationSessionController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestBean.java index e48b4b6c..a023a82f 100644 --- a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestController.java index f1b401c8..c5530801 100644 --- a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsAdminMobileProviderWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java index 40a0b196..a40c6c91 100644 --- a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestController.java index 778a8bf8..e88c4f2b 100644 --- a/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/mobileprovider/FinancialsMobileProviderWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java index a7b21b76..3731b3a2 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestController.java index 6e03cdd2..79cbec54 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsAdminPhoneWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java index fe8d6359..8cd64781 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java index 194448c5..9983cf4d 100644 --- a/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/phone/FinancialsPhoneWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java index ee5c7f1b..45f7faf9 100644 --- a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestController.java index 2639732a..00101866 100644 --- a/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/profile/FinancialsUserProfileWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java index 3d5e7b5b..64c40d0f 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -34,6 +34,7 @@ import org.mxchange.jcoreee.utils.FacesUtils; import org.mxchange.jfinancials.beans.BaseFinancialsBean; import org.mxchange.jfinancials.beans.contact.FinancialsAdminContactWebRequestController; import org.mxchange.jfinancials.beans.contact.FinancialsContactWebRequestController; +import org.mxchange.jfinancials.beans.features.FinancialsFeaturesWebApplicationController; import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent; import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent; import org.mxchange.jusercore.events.user.created.ObservableCreatedUserEvent; @@ -115,6 +116,12 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem @Any private Event deleteUserEvent; + /** + * Features controller + */ + @Inject + private FinancialsFeaturesWebApplicationController featureController; + /** * An event fired when the administrator has updated a new user */ @@ -184,6 +191,11 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem */ private String userPasswordRepeat; + /** + * Whether the user wants a public profile + */ + private ProfileMode userProfileMode; + /** * Event being fired when administrator unlocks an account */ @@ -220,41 +232,11 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem } // Create new user instance - final User newUser = new LoginUser(); - - // Set user name, CONFIRMED and INVISIBLE - newUser.setUserName(this.getUserName()); - newUser.setUserMustChangePassword(this.getUserMustChangePassword()); - newUser.setUserAccountStatus(UserAccountStatus.CONFIRMED); - newUser.setUserProfileMode(ProfileMode.INVISIBLE); - - // Get locale from view-root - final Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale(); - - // Copy user locale - newUser.setUserLocale(locale); - - // Init instance - Contact userContact; - - // Is a contact instance in helper set? - if (this.getContact() instanceof Contact) { - // Then use it for contact linking - userContact = this.getContact(); - } else { - // Create contact instance - userContact = this.contactController.createContactInstance(); - } - - // Set contact in user - newUser.setUserContact(userContact); - - // Init variable for password - String password = null; + final User newUser = this.createUserInstance(); // Is the user name or email address used already? // @TODO Add password length check - if (this.userController.isUserNameRegistered(newUser)) { + if ((this.featureController.isFeatureEnabled("user_login_require_user_name")) && (this.userController.isUserNameRegistered(newUser))) { // User name is already used throw new FaceletException(new UserNameAlreadyRegisteredException(newUser)); } else if ((this.getContact() == null) && (this.contactController.isEmailAddressRegistered(newUser.getUserContact()))) { @@ -267,24 +249,8 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem // Skip it return ""; //NOI18N - } else if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) { - // Empty password entered, then generate one - password = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); - } else if (!this.isSamePasswordEntered()) { - // Both passwords don't match - throw new FaceletException(new UserPasswordRepeatMismatchException(newUser)); - } else { - // Both match, so get it from this bean - password = this.getUserPassword(); } - // The password should not be null and at least 5 characters long - assert (password != null) : "password is null"; //NOI18N - assert (password.length() >= FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N - - // Encrypt password and set it - newUser.setUserEncryptedPassword(UserLoginUtils.encryptPassword(password)); - try { // Now, that all is set, call EJB if (this.getContact() instanceof Contact) { @@ -294,7 +260,7 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem // Fire event this.userLinkedEvent.fire(new AdminLinkedUserEvent(updatedUser)); } else { - // Add new contact + // Add new user final User updatedUser = this.adminUserBean.addUser(newUser); // Fire event @@ -624,6 +590,24 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem this.userPasswordRepeat = userPasswordRepeat; } + /** + * Getter for user profile mode + *

+ * @return User profile mode + */ + public ProfileMode getUserProfileMode () { + return this.userProfileMode; + } + + /** + * Setter for user profile mode + *

+ * @param userProfileMode User profile mode + */ + public void setUserProfileMode (final ProfileMode userProfileMode) { + this.userProfileMode = userProfileMode; + } + /** * Locks selected user's account. This method makes sure that a lock reason * is provided that th user later can read on login attempts. @@ -734,9 +718,65 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem private void clear () { // Clear all data this.setContact(null); + this.setUserDeleteReason(null); + this.setUser(null); this.setUserLockReason(null); this.setUserMustChangePassword(null); this.setUserName(null); + this.setUserPassword(null); + this.setUserPasswordRepeat(null); + this.setUserProfileMode(null); + + } + + /** + * Creates a new user instance from all currently saved data from this bean + *

+ * @return New user instance + */ + private User createUserInstance () { + // Init variable for password + String password = null; + + // Init instance + final Contact userContact; + + // Is a contact instance in helper set? + if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) { + // Empty password entered, then generate one + password = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); + } else if (!this.isSamePasswordEntered()) { + // Both passwords don't match + throw new FaceletException(new UserPasswordRepeatMismatchException()); + } else { + // Both match, so get it from this bean + password = this.getUserPassword(); + } + + // The password should not be null and at least 5 characters long + assert (password != null) : "password is null"; //NOI18N + assert (password.length() >= FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N + + // Is contact instance given? Else create one + if (this.getContact() instanceof Contact) { + // Then use it for contact linking + userContact = this.getContact(); + } else { + // Create contact instance + userContact = this.contactController.createContactInstance(); + } + + // Create new instance + final User newUser = new LoginUser(this.getUserName(), this.getUserProfileMode(), this.getUserMustChangePassword(), UserLoginUtils.encryptPassword(password), UserAccountStatus.CONFIRMED, userContact); + + // Get locale from view-root + final Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale(); + + // Copy user locale + newUser.setUserLocale(locale); + + // Return it + return newUser; } /** diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestController.java index c3a5c905..b1723634 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java index a0a776c0..d8ee7baa 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -609,14 +609,15 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements // Is user name required? if (!this.isUserNameRequired()) { // Generate pseudo-random user name - String randomName = this.userBean.generateRandomUserName(); + // @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 - String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); + final String randomPassword = UserLoginUtils.createRandomPassword(FinancialsUserWebRequestController.MINIMUM_PASSWORD_LENGTH); // Set random password this.setUserPassword(randomPassword); @@ -938,24 +939,6 @@ public class FinancialsUserWebRequestBean extends BaseFinancialsBean implements return isFound; } - @Override - public boolean isPublicUserProfileEnabled () { - // Get context parameter - final String contextParameter = FacesContext.getCurrentInstance().getExternalContext().getInitParameter("is_public_profile_enabled"); //NOI18N - - // Is it set? - final boolean isEnabled = ((contextParameter instanceof String) && (contextParameter.toLowerCase().equals("true"))); //NOI18N - - // This requires user names being enabled, too. - if ((isEnabled) && (!this.isUserNameRequired())) { - // Not valid state, users must be able to modify their profile, especially when it is public - throw new IllegalStateException("Public user profiles are enabled but user name requirement is disabled, this is not possible."); //NOI18N - } - - // Return value - return isEnabled; - } - @Override public boolean isRequiredChangePersonalDataSet () { return ((this.getUserProfileMode() != null) && diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java index 16e49fab..ff244dd1 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsUserWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -186,12 +186,4 @@ public interface FinancialsUserWebRequestController extends Serializable { */ boolean isUserNameRequired (); - /** - * Checks wether public user profiles are enabled. This requires that user - * names are also enabled. - *

- * @return Whether public user profiles are enabled - */ - boolean isPublicUserProfileEnabled (); - } diff --git a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java index 62eaa504..6fc8b771 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java index a6ea444b..231f10db 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/activity/FinancialsUserActivityWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java index 5863b799..f9612e37 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestController.java index 054e116a..2f0cb2e3 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/confirmlink/FinancialsConfirmationLinkWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java index 2903b237..02465779 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java index c4522401..f9ea920a 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/email_address/FinancialsEmailChangeWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java b/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java index e98d9253..cc4aac96 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionController.java b/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionController.java index 47873d15..1e0a6dba 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/login/FinancialsUserLoginWebSessionController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java index c92a32a6..eadd7ac9 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestController.java index 87e91587..42c79fdc 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java index ed6ceaaf..15cd26d3 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java index dcf5fdaa..04a99850 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java index fdcf1e93..883915ae 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as diff --git a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java index 4ad42c60..5fbcce7f 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java +++ b/src/java/org/mxchange/jfinancials/beans/user/resendlink/FinancialsResendLinkWebRequestController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016, 2017 Roland Häder + * Copyright (C) 2016 - 2018 Free Software Foundation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as