From da3027a1ac2609367001a6915d635bce930ed913 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 23 Apr 2020 02:29:42 +0200 Subject: [PATCH] Please cherry-pick: - got rid of admin_form_basic_data.tpl, now moved back to original view, I guess I will do that for all forms, which would lead to "duplicate" forms elements butter with no targetController which was never resolvable anyway. - added showEmailAddress boolean flag to many renderFoo() methods to whether show email address which is mostly not wanted in selection boxes ... - added companyRoadNumber to basic-data backing bean and proper forms/list view - in converters/validators now the FOO_LIST_CONTROLLER static instance shall always be initialized directly before the try{} block MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- ...inancialsAdminBasicDataWebRequestBean.java | 53 ++++- .../FinancialsBasicDataListWebViewBean.java | 28 +++ ...ancialsBasicDataListWebViewController.java | 9 + .../helper/FinancialsWebViewHelperBean.java | 30 +-- .../FinancialsAdminUserWebRequestBean.java | 24 ++- .../FinancialsUserPasswordWebRequestBean.java | 11 +- .../FinancialsUserRegisterWebRequestBean.java | 17 +- .../FinancialsBasicCompanyDataConverter.java | 15 +- .../FinancialsBranchOfficeConverter.java | 15 +- .../FinancialsDepartmentConverter.java | 15 +- .../employee/FinancialsEmployeeConverter.java | 12 +- .../FinancialsHeadquarterConverter.java | 18 +- ...FinancialsCompanyOpeningTimeConverter.java | 15 +- .../contact/FinancialsContactConverter.java | 15 +- .../country/FinancialsCountryConverter.java | 15 +- .../fax/FinancialsFaxNumberConverter.java | 12 +- .../FinancialsLandLineNumberConverter.java | 12 +- .../FinancialsMobileNumberConverter.java | 12 +- .../FinancialsMobileProviderConverter.java | 12 +- .../user/FinancialsUserConverter.java | 14 +- .../localization/generic_de_DE.properties | 4 +- .../localization/generic_en_US.properties | 6 +- .../basic_data/admin_form_basic_data.tpl | 180 ----------------- .../admin_form_branch_office_data.tpl | 6 +- .../department/admin_form_department_data.tpl | 6 +- .../employee/admin_form_employee_data.tpl | 6 +- .../headquarter/admin_form_headquarter.tpl | 2 +- .../basic_data/admin_basic_data_list.xhtml | 191 +++++++++++++++++- .../admin_branch_office_list.xhtml | 19 +- .../department/admin_department_list.xhtml | 12 +- web/admin/employee/admin_employee_list.xhtml | 8 +- .../headquarter/admin_headquarter_list.xhtml | 4 +- 32 files changed, 442 insertions(+), 356 deletions(-) delete mode 100644 web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl 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 68d513b2..dbfb419c 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/FinancialsAdminBasicDataWebRequestBean.java @@ -96,6 +96,11 @@ public class FinancialsAdminBasicDataWebRequestBean extends BaseFinancialsBean i */ private String companyName; + /** + * Company's road number + */ + private String companyRoadNumber; + /** * Company short name */ @@ -181,15 +186,28 @@ public class FinancialsAdminBasicDataWebRequestBean extends BaseFinancialsBean i basicData.setCompanyFounder(this.getCompanyFounder()); basicData.setCompanyHeadquarterData(this.getCompanyHeadQuarter()); basicData.setCompanyName(this.getCompanyName()); + basicData.setCompanyRoadNumber(this.getCompanyRoadNumber()); basicData.setCompanyTaxNumber(this.getCompanyTaxNumber()); basicData.setCompanyUserOwner(this.getCompanyUserOwner()); basicData.setCompanyWebsiteUrl(this.getCompanyWebsiteUrl()); // Set logo instance // @TODO basicData.setCompanyLogo(); - // Generate phone number - DialableLandLineNumber landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber()); - DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber()); + // Init varibables + DialableLandLineNumber landLine = null; + DialableFaxNumber fax = null; + + // Are all 3 fields set? + if (this.getLandLineAreaCode() != null && this.getLandLineCountry() != null && this.getLandLineNumber() != null) { + // Initialize land number number instance + landLine = new LandLineNumber(this.getLandLineCountry(), this.getLandLineAreaCode(), this.getLandLineNumber()); + } + + // Are all 3 fields set? + if (this.getFaxAreaCode() != null && this.getFaxCountry() != null && this.getFaxNumber() != null) { + // Initialzie fax number instance + 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)) { @@ -233,17 +251,20 @@ public class FinancialsAdminBasicDataWebRequestBean extends BaseFinancialsBean i basicData.setCompanyFaxNumber(fax); } + // Init variable + final BasicData updatedBasicData; + // Now try to send to EJB and get an updated version back try { // Try it - final BasicData updatedBasicData = this.adminBasicCompanyDataBean.addBusinessBasicData(basicData); - - // Fire event - this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData)); + updatedBasicData = this.adminBasicCompanyDataBean.addBusinessBasicData(basicData); } catch (final BasicDataAlreadyAddedException e) { // Does already exist throw new FacesException(e); } + + // Fire event + this.businessDataAddedEvent.fire(new AdminAddedBusinessBasicDataEvent(updatedBasicData)); } /** @@ -354,6 +375,24 @@ public class FinancialsAdminBasicDataWebRequestBean extends BaseFinancialsBean i this.companyName = companyName; } + /** + * Getter for company's road number + *

+ * @return Company's road number + */ + public String getCompanyRoadNumber () { + return this.companyRoadNumber; + } + + /** + * Setter for company's road number + *

+ * @param companyRoadNumber Company's road number + */ + public void setCompanyRoadNumber (final String companyRoadNumber) { + this.companyRoadNumber = companyRoadNumber; + } + /** * Getter for company short name *

diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java index 272f47fb..8f19ec63 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewBean.java @@ -253,6 +253,34 @@ public class FinancialsBasicDataListWebViewBean extends BaseFinancialsBean imple return isFound; } + @Override + public boolean isCompanyRoadNumberUsed (final String companyRoadNumber) { + // Validate parameter + if (null == companyRoadNumber) { + // Throw NPE + throw new NullPointerException("companyRoadNumber is null"); //NOI18N + } else if (companyRoadNumber.isEmpty()) { + // Throw IAE + throw new IllegalArgumentException("companyRoadNumber is empty"); //NOI18N + } + + // Default is not found + boolean isFound = false; + + // Check all entries + for (final BasicData basicData : this.getAllBasicData()) { + // Is same company name? + if (Objects.equals(basicData.getCompanyRoadNumber(), companyRoadNumber)) { + // Found it + isFound = true; + break; + } + } + + // Return flag + return isFound; + } + @Override public Boolean isCompanyShortNameUsed (final String companyShortName) { // Validate parameter diff --git a/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewController.java b/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewController.java index 063f590e..c4a04e60 100644 --- a/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewController.java +++ b/src/java/org/mxchange/jfinancials/beans/business/basicdata/list/FinancialsBasicDataListWebViewController.java @@ -27,6 +27,15 @@ import org.mxchange.jcontactsbusiness.model.basicdata.BasicData; */ public interface FinancialsBasicDataListWebViewController extends Serializable { + /** + * Checks whether given company's road number is already used. + *

+ * @param companyRoadNumber Company's road number + *

+ * @return Whether it is already in use + */ + boolean isCompanyRoadNumberUsed (final String companyRoadNumber); + /** * Retrieves a single business data entity for given id number or throws a * proper exception if not found. diff --git a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java index 6b6aa2b2..4e951dc6 100644 --- a/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java +++ b/src/java/org/mxchange/jfinancials/beans/helper/FinancialsWebViewHelperBean.java @@ -443,12 +443,13 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F /** * Renders data of basic company data *

- * @param basicData Basic company data instance - * @param useShortName Whether to use short name or long name of company + * @param basicData Basic company data instance + * @param useShortName Whether to use short name or long name of company + * @param showEmailAddress Whether render email address *

* @return Basic company data as string */ - public String renderBasicData (final BasicData basicData, final boolean useShortName) { + public String renderBasicData (final BasicData basicData, final boolean useShortName, final boolean showEmailAddress) { // Default is empty string, so let's get started final StringBuilder sb = new StringBuilder(30); @@ -464,7 +465,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F } // Is email address set? - if (basicData.getCompanyEmailAddress() != null) { + if (showEmailAddress && basicData.getCompanyEmailAddress() != null) { // Add it sb.append(", ").append(basicData.getCompanyEmailAddress()); //NOI18N } @@ -484,11 +485,12 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F * Returns the branch office's full address. If null is provided, an empty * string is returned. *

- * @param branchOffice Branch office instance + * @param branchOffice Branch office instance + * @param showEmailAddress Whether render email address *

* @return Branch office's address */ - public String renderBranchOffice (final BranchOffice branchOffice) { + public String renderBranchOffice (final BranchOffice branchOffice, final boolean showEmailAddress) { // Default is empty string, so let's get started final StringBuilder sb = new StringBuilder(30); @@ -510,7 +512,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F } // Yes, then append all data - sb.append(this.renderBasicData(branchOffice.getBranchCompany(), true)); + sb.append(this.renderBasicData(branchOffice.getBranchCompany(), true, showEmailAddress)); sb.append(", "); //NOI18N sb.append(branchOffice.getBranchStreet()); sb.append(" "); //NOI18N @@ -582,11 +584,12 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F * Returns the department's name and name of assigned company. If null is * provided, an empty string is returned. *

- * @param department Department instance + * @param department Department instance + * @param showEmailAddress Whether to render email address *

* @return Department's full name */ - public String renderDepartment (final Department department) { + public String renderDepartment (final Department department, final boolean showEmailAddress) { // Default is empty string, so let's get started final StringBuilder sb = new StringBuilder(10); @@ -595,7 +598,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F // Then create name sb.append(this.getMessageFromBundle(department.getDepartmentI18nKey())); sb.append(" ("); //NOI18N - sb.append(this.renderBasicData(department.getDepartmentCompany(), true)); + sb.append(this.renderBasicData(department.getDepartmentCompany(), true, showEmailAddress)); sb.append(")"); //NOI18N } @@ -607,11 +610,12 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F * Returns the employee's number, personal title, family name and name if * available. If null is provided, an empty string is returned. *

- * @param employee Employable instance + * @param employee Employable instance + * @param showEmailAddress Whether to show email address of employee *

* @return A string representing an employee */ - public String renderEmployee (final Employable employee) { + public String renderEmployee (final Employable employee, final boolean showEmailAddress) { // Default is empty string, so let's get started final StringBuilder sb = new StringBuilder(20); @@ -653,7 +657,7 @@ public class FinancialsWebViewHelperBean extends BaseFinancialsBean implements F } // Add department name - sb.append(this.renderDepartment(employee.getEmployeeDepartment())); + sb.append(this.renderDepartment(employee.getEmployeeDepartment(), showEmailAddress)); // Only add braces when employee number is given if (employee.getEmployeeNumber() != null || employee.getEmployeePersonalData() instanceof Contact) { diff --git a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java index 0f927872..548eea32 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/FinancialsAdminUserWebRequestBean.java @@ -27,7 +27,6 @@ import javax.enterprise.inject.Any; import javax.faces.FacesException; import javax.faces.application.FacesMessage; 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; @@ -49,6 +48,7 @@ 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.post.AdminPostUserDataUpdatedEvent; +import org.mxchange.jusercore.events.user.update.post.ObservableAdminPostUserDataUpdatedEvent; import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException; import org.mxchange.jusercore.exceptions.UserNotFoundException; @@ -65,7 +65,6 @@ 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) @@ -252,26 +251,31 @@ public class FinancialsAdminUserWebRequestBean extends BaseFinancialsBean implem return; } + // Init variable + final User updatedUser; + try { // Now, that all is set, call EJB if (this.getContact() instanceof Contact) { // Link contact with this user - final User updatedUser = this.adminUserBean.linkUser(newUser); - - // Fire event - this.userLinkedEvent.fire(new AdminLinkedUserEvent(updatedUser)); + updatedUser = this.adminUserBean.linkUser(newUser); } else { // Add new user - final User updatedUser = this.adminUserBean.addUser(newUser); - - // Fire event - this.addedUserEvent.fire(new AdminAddedUserEvent(updatedUser)); + updatedUser = this.adminUserBean.addUser(newUser); } } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) { // Throw again throw new FacesException(ex); } + // Now, that all is set, call EJB + if (this.getContact() instanceof Contact) { + // Fire event + this.userLinkedEvent.fire(new AdminLinkedUserEvent(updatedUser)); + } else { + // Fire event + this.addedUserEvent.fire(new AdminAddedUserEvent(updatedUser)); + } // Clear helper this.setContact(null); 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 7274a604..97e571b8 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/password/FinancialsUserPasswordWebRequestBean.java @@ -170,15 +170,15 @@ public class FinancialsUserPasswordWebRequestBean extends BaseFinancialsBean imp // Set it in user user.setUserEncryptedPassword(encryptedPassword); + // Init variable + final PasswordHistory passwordHistory; + try { // Get base URL final String baseUrl = FacesUtils.generateBaseUrl(); // All is set, then update password - PasswordHistory passwordHistory = this.userBean.updateUserPassword(user, baseUrl); - - // Fire event - this.userUpdatedPasswordEvent.fire(new UpdatedUserPasswordEvent(passwordHistory, this.getUserPassword())); + passwordHistory = this.userBean.updateUserPassword(user, baseUrl); } catch (final UserNotFoundException | UserStatusUnconfirmedException | UserStatusLockedException ex) { // Clear bean this.clear(); @@ -187,6 +187,9 @@ public class FinancialsUserPasswordWebRequestBean extends BaseFinancialsBean imp throw new FacesException(ex); } + // Fire event + this.userUpdatedPasswordEvent.fire(new UpdatedUserPasswordEvent(passwordHistory, this.getUserPassword())); + // Clear bean this.clear(); 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 01353768..cd049606 100644 --- a/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java +++ b/src/java/org/mxchange/jfinancials/beans/user/register/FinancialsUserRegisterWebRequestBean.java @@ -260,25 +260,28 @@ public class FinancialsUserRegisterWebRequestBean extends BaseFinancialsBean imp user.setUserConfirmKey(confirmKey); } + // Init variable + final User registeredUser; + try { // Get base URL final String baseUrl = FacesUtils.generateBaseUrl(); // Call bean - final User registeredUser = this.registerBean.registerUser(user, baseUrl, randomPassword); + registeredUser = this.registerBean.registerUser(user, baseUrl, randomPassword); // The id number should be set assert (registeredUser.getUserId() instanceof Long) : "registeredUser.userId is null after registerUser() was called."; //NOI18N - - // Fire event - this.userRegisteredEvent.fire(new UserRegisteredEvent(registeredUser)); - - // All fine, redirect to proper page - return "user_register_done"; //NOI18N } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) { // Continue to throw throw new FacesException(ex); } + + // Fire event + this.userRegisteredEvent.fire(new UserRegisteredEvent(registeredUser)); + + // All fine, redirect to proper page + return "user_register_done"; //NOI18N } /** diff --git a/src/java/org/mxchange/jfinancials/converter/business/basicdata/FinancialsBasicCompanyDataConverter.java b/src/java/org/mxchange/jfinancials/converter/business/basicdata/FinancialsBasicCompanyDataConverter.java index e13542a6..3ea29a34 100644 --- a/src/java/org/mxchange/jfinancials/converter/business/basicdata/FinancialsBasicCompanyDataConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/business/basicdata/FinancialsBasicCompanyDataConverter.java @@ -42,17 +42,8 @@ public class FinancialsBasicCompanyDataConverter implements Converter @Override public BasicData getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the instance there? - if (null == BASIC_DATA_LIST_CONTROLLER) { - // Get bean from CDI directly - BASIC_DATA_LIST_CONTROLLER = CDI.current().select(FinancialsBasicDataListWebViewBean.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; } @@ -60,6 +51,12 @@ public class FinancialsBasicCompanyDataConverter implements Converter // Init instance BasicData basicData = null; + // Is the instance there? + if (null == BASIC_DATA_LIST_CONTROLLER) { + // Get bean from CDI directly + BASIC_DATA_LIST_CONTROLLER = CDI.current().select(FinancialsBasicDataListWebViewBean.class).get(); + } + try { // Try to parse the value as long final Long basicDataId = Long.valueOf(submittedValue); diff --git a/src/java/org/mxchange/jfinancials/converter/business/branchoffice/FinancialsBranchOfficeConverter.java b/src/java/org/mxchange/jfinancials/converter/business/branchoffice/FinancialsBranchOfficeConverter.java index 5d661f63..555146ad 100644 --- a/src/java/org/mxchange/jfinancials/converter/business/branchoffice/FinancialsBranchOfficeConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/business/branchoffice/FinancialsBranchOfficeConverter.java @@ -42,17 +42,8 @@ public class FinancialsBranchOfficeConverter implements Converter @Override public BranchOffice getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the instance there? - if (null == BRANCH_OFFICE_LIST_CONTROLLER) { - // Get bean from CDI directly - BRANCH_OFFICE_LIST_CONTROLLER = CDI.current().select(FinancialsBranchOfficeListWebViewBean.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; } @@ -60,6 +51,12 @@ public class FinancialsBranchOfficeConverter implements Converter // Init instance BranchOffice branchOffice = null; + // Is the instance there? + if (null == BRANCH_OFFICE_LIST_CONTROLLER) { + // Get bean from CDI directly + BRANCH_OFFICE_LIST_CONTROLLER = CDI.current().select(FinancialsBranchOfficeListWebViewBean.class).get(); + } + try { // Try to parse the value as long final Long branchOfficeId = Long.valueOf(submittedValue); diff --git a/src/java/org/mxchange/jfinancials/converter/business/department/FinancialsDepartmentConverter.java b/src/java/org/mxchange/jfinancials/converter/business/department/FinancialsDepartmentConverter.java index e84e76cf..66820f99 100644 --- a/src/java/org/mxchange/jfinancials/converter/business/department/FinancialsDepartmentConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/business/department/FinancialsDepartmentConverter.java @@ -44,9 +44,6 @@ public class FinancialsDepartmentConverter implements Converter { public Department getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // 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; } @@ -54,16 +51,16 @@ public class FinancialsDepartmentConverter implements Converter { // Init instance Department companyDepartment = null; + // Is the instance there? + if (null == DEPARTMENT_LIST_CONTROLLER) { + // Get bean from CDI directly + DEPARTMENT_LIST_CONTROLLER = CDI.current().select(FinancialsDepartmentListWebViewBean.class).get(); + } + try { // Try to parse the value as long final Long departmentId = Long.valueOf(submittedValue); - // Is the instance there? - if (null == DEPARTMENT_LIST_CONTROLLER) { - // Get bean from CDI directly - DEPARTMENT_LIST_CONTROLLER = CDI.current().select(FinancialsDepartmentListWebViewBean.class).get(); - } - // Try to get user instance from it companyDepartment = DEPARTMENT_LIST_CONTROLLER.findDepartmentById(departmentId); } catch (final NumberFormatException ex) { diff --git a/src/java/org/mxchange/jfinancials/converter/business/employee/FinancialsEmployeeConverter.java b/src/java/org/mxchange/jfinancials/converter/business/employee/FinancialsEmployeeConverter.java index 0c40f09f..0a3485d1 100644 --- a/src/java/org/mxchange/jfinancials/converter/business/employee/FinancialsEmployeeConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/business/employee/FinancialsEmployeeConverter.java @@ -51,16 +51,16 @@ public class FinancialsEmployeeConverter implements Converter { // Init instance Employable companyEmployee = null; + // Is the instance there? + if (null == EMPLOYEE_LIST_CONTROLLER) { + // Get bean from CDI directly + EMPLOYEE_LIST_CONTROLLER = CDI.current().select(FinancialsEmployeeListWebViewBean.class).get(); + } + try { // 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_LIST_CONTROLLER.findEmployeeById(employeeId); } catch (final NumberFormatException ex) { diff --git a/src/java/org/mxchange/jfinancials/converter/business/headquarter/FinancialsHeadquarterConverter.java b/src/java/org/mxchange/jfinancials/converter/business/headquarter/FinancialsHeadquarterConverter.java index 7b07d312..4749d6a7 100644 --- a/src/java/org/mxchange/jfinancials/converter/business/headquarter/FinancialsHeadquarterConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/business/headquarter/FinancialsHeadquarterConverter.java @@ -42,19 +42,25 @@ public class FinancialsHeadquarterConverter implements Converter { @Override public Headquarter getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { + // Is the value null or empty? + if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { + // Return null + return null; + } + // Init instance Headquarter headquarter = null; + // Is the instance there? + if (null == HEADQUARTER_LIST_CONTROLLER) { + // Set it now + HEADQUARTER_LIST_CONTROLLER = CDI.current().select(FinancialsHeadquarterListWebViewBean.class).get(); + } + try { // Try to parse the value as long final Long headquarterId = Long.valueOf(submittedValue); - // Is the instance there? - if (null == HEADQUARTER_LIST_CONTROLLER) { - // Set it now - HEADQUARTER_LIST_CONTROLLER = CDI.current().select(FinancialsHeadquarterListWebViewBean.class).get(); - } - // Try to get user instance from it headquarter = HEADQUARTER_LIST_CONTROLLER.findHeadquarterById(headquarterId); } catch (final NumberFormatException ex) { diff --git a/src/java/org/mxchange/jfinancials/converter/business/opening_time/FinancialsCompanyOpeningTimeConverter.java b/src/java/org/mxchange/jfinancials/converter/business/opening_time/FinancialsCompanyOpeningTimeConverter.java index 86bbc8ef..6c23557d 100644 --- a/src/java/org/mxchange/jfinancials/converter/business/opening_time/FinancialsCompanyOpeningTimeConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/business/opening_time/FinancialsCompanyOpeningTimeConverter.java @@ -44,9 +44,6 @@ public class FinancialsCompanyOpeningTimeConverter implements Converter { @Override public Contact getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the instance there? - if (null == CONTACT_LIST_CONTROLLER) { - // Get bean from CDI directly - CONTACT_LIST_CONTROLLER = CDI.current().select(FinancialsContactListWebViewBean.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; } @@ -60,6 +51,12 @@ public class FinancialsContactConverter implements Converter { // Init instance Contact contact = null; + // Is the instance there? + if (null == CONTACT_LIST_CONTROLLER) { + // Get bean from CDI directly + CONTACT_LIST_CONTROLLER = CDI.current().select(FinancialsContactListWebViewBean.class).get(); + } + try { // Try to parse the value as long final Long contactId = Long.valueOf(submittedValue); diff --git a/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java b/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java index 680c31fb..07686326 100644 --- a/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/country/FinancialsCountryConverter.java @@ -44,9 +44,6 @@ public class FinancialsCountryConverter implements Converter { public Country getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { // 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; } @@ -54,17 +51,17 @@ public class FinancialsCountryConverter implements Converter { // Init value Country country = null; + // Is the instance there? + if (null == COUNTRY_LIST_CONTROLLER) { + // Get bean from CDI directly + COUNTRY_LIST_CONTROLLER = CDI.current().select(FinancialsCountryListWebViewBean.class).get(); + } + // Try this better try { // Convert it to long final Long countryId = Long.parseLong(submittedValue); - // Is the instance there? - if (null == COUNTRY_LIST_CONTROLLER) { - // Get bean from CDI directly - COUNTRY_LIST_CONTROLLER = CDI.current().select(FinancialsCountryListWebViewBean.class).get(); - } - // Try to find it country = COUNTRY_LIST_CONTROLLER.findCountryById(countryId); } catch (final NumberFormatException ex) { diff --git a/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java b/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java index 2f486c4f..afdc0b15 100644 --- a/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java +++ b/src/java/org/mxchange/jfinancials/converter/fax/FinancialsFaxNumberConverter.java @@ -51,16 +51,16 @@ public class FinancialsFaxNumberConverter implements Converter { @Override public User getAsObject (final FacesContext context, final UIComponent component, final String submittedValue) { - // Is the instance there? - if (null == USER_LIST_CONTROLLER) { - // Get bean from CDI directly - USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewBean.class).get(); - } - // Is the value null or empty? if ((null == submittedValue) || (submittedValue.trim().isEmpty())) { // Warning message @@ -60,6 +54,12 @@ public class FinancialsUserConverter implements Converter { // Init instance User user = null; + // Is the instance there? + if (null == USER_LIST_CONTROLLER) { + // Get bean from CDI directly + USER_LIST_CONTROLLER = CDI.current().select(FinancialsUserListWebViewBean.class).get(); + } + try { // Try to parse the value as long final Long userId = Long.valueOf(submittedValue); diff --git a/src/java/org/mxchange/localization/generic_de_DE.properties b/src/java/org/mxchange/localization/generic_de_DE.properties index 08f5ef92..5c16d007 100644 --- a/src/java/org/mxchange/localization/generic_de_DE.properties +++ b/src/java/org/mxchange/localization/generic_de_DE.properties @@ -811,7 +811,6 @@ ENTERED_EMAIL_ADDRESS_IS_INVALID=Die eingegebene Email-Addresse entspricht nicht ADMIN_BASIC_DATA_LEGEND=Basisdaten f\u00fcr gesch\u00e4ftlichen Kontakt: ADMIN_BASIC_DATA_LEGEND_TITLE=Geben Sie die Basisdaten f\u00fcr einen gesch\u00e4ftlichen Kontakt ein. ADMIN_BASIC_DATA_COMPANY_SHORT_NAME_REQUIRED=Bitte geben Sie den kurzen Firmennamen ein. -ADMIN_BASIC_DATA_COMPANY_LEGAL_STATUS=Rechtsform (z.B. GmbH): ADMIN_BASIC_DATA_COMPANY_EMAIL_ADDRESS=Haupt-Email-Adresse: BUTTON_ADMIN_ADD_BASIC_DATA=Basisdaten hinzuf\u00fcgen ERROR_GUEST_REGISTRATION_IN_INDEX_ENABLED=Fehler: Falscher Aufruf der Anmeldeseite, da die Eingangsseite als Anmeldeseite fungiert. @@ -1213,3 +1212,6 @@ ADMIN_CONTACT_DETAILS_HEADER=Kontaktdaten zu {0} {1} {2}: ADMIN_DEPARTMENT_DETAILS_HEADER=Daten der Abteilung {0} (Id {1}): ADMIN_HEADQUARTER_DETAILS_HEADER=Haupstelle von {0} (Id {1})): ERROR_PARAMETER_CONFIRM_KEY_IS_NOT_SET=Fehler: Parameter "confirmationKey" ist nicht gesetzt. +ROAD_NUMBER_HEADER=Betriebsnummer: +ADMIN_BASIC_DATA_COMPANY_ROAD_NUMBER=Betriebsnummer: +BASIC_DATA_COMPANY_ROAD_NUMBER_MISMATCHES_PATTERN=Die Betriebsnummer stimmt nicht mit dem regul\u00e4ren Ausruck AA BB 12345 \u00fcberein. diff --git a/src/java/org/mxchange/localization/generic_en_US.properties b/src/java/org/mxchange/localization/generic_en_US.properties index c5cef2c1..293d341c 100644 --- a/src/java/org/mxchange/localization/generic_en_US.properties +++ b/src/java/org/mxchange/localization/generic_en_US.properties @@ -795,7 +795,6 @@ ENTERED_EMAIL_ADDRESS_IS_INVALID=Your entered email address is not valid. ADMIN_BASIC_DATA_LEGEND=Basic data for business contact: ADMIN_BASIC_DATA_LEGEND_TITLE=Enter basic data for a business contact. ADMIN_BASIC_DATA_COMPANY_SHORT_NAME_REQUIRED=Please enter the company's short name. -ADMIN_BASIC_DATA_COMPANY_LEGAL_STATUS=Legal status (e.g. Inc.): ADMIN_BASIC_DATA_COMPANY_EMAIL_ADDRESS=Main email address: BUTTON_ADMIN_ADD_BASIC_DATA=Add basic data ERROR_GUEST_REGISTRATION_IN_INDEX_ENABLED=Error: Wrong request on registration page as the index page serves as registration page. @@ -1112,7 +1111,7 @@ TAX_NUMBER_HEADER=Tax number: EMPLOYEE_NUMBER_HEADER=Employee number: BACK=Back OPTIONS=Options -ADMIN_BASIC_DATA_COMPANY_SHORT_NAME=Company's short name +ADMIN_BASIC_DATA_COMPANY_SHORT_NAME=Company's short name: ADMIN_BASIC_DATA_COMPANY_SHORT_NAME_HEADER=Short name: AVAILABLE_HEADER=Available: ADMIN_MANUFACTURER_HEADER=Manufacturer: @@ -1123,3 +1122,6 @@ ADMIN_DEPARTMENT_DETAILS_HEADER=Data of department {0} (Id {1}): ADMIN_HEADQUARTER_DETAILS_HEADER=Headquarter of {0} (Id {1})): CHANGE=Change? ERROR_PARAMETER_CONFIRM_KEY_IS_NOT_SET=Error: Parameter "confirmKey" is required. +ROAD_NUMBER_HEADER=Road number: +ADMIN_BASIC_DATA_COMPANY_ROAD_NUMBER=Road number: +BASIC_DATA_COMPANY_ROAD_NUMBER_MISMATCHES_PATTERN=Company's road number does not match pattern AA BB 12345. diff --git a/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl b/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl deleted file mode 100644 index 3d91a340..00000000 --- a/web/WEB-INF/templates/admin/basic_data/admin_form_basic_data.tpl +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl b/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl index e39371c3..00b6545d 100644 --- a/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl +++ b/web/WEB-INF/templates/admin/branch_office/admin_form_branch_office_data.tpl @@ -36,7 +36,7 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData, true)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}" /> @@ -56,7 +56,7 @@ value="#{employeeListController.allEmployees}" var="companyEmployee" itemValue="#{companyEmployee}" - itemLabel="#{beanHelper.renderEmployee(companyEmployee)}" + itemLabel="#{beanHelper.renderEmployee(companyEmployee, false)}" /> @@ -76,7 +76,7 @@ value="#{employeeListController.allEmployees}" var="companyEmployee" itemValue="#{companyEmployee}" - itemLabel="#{beanHelper.renderEmployee(companyEmployee)}" + itemLabel="#{beanHelper.renderEmployee(companyEmployee, false)}" /> diff --git a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl index 2233585d..2a8e99ba 100644 --- a/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl +++ b/web/WEB-INF/templates/admin/department/admin_form_department_data.tpl @@ -43,7 +43,7 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData, true)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}" /> @@ -62,7 +62,7 @@ value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" - itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" + itemLabel="#{beanHelper.renderBranchOffice(branchOffice, false)}" /> @@ -102,7 +102,7 @@ value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" - itemLabel="#{beanHelper.renderEmployee(employee)}" + itemLabel="#{beanHelper.renderEmployee(employee, false)}" /> diff --git a/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl b/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl index 5a3e5ee9..681eb66f 100644 --- a/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl +++ b/web/WEB-INF/templates/admin/employee/admin_form_employee_data.tpl @@ -41,7 +41,7 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData, true)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}" /> @@ -61,7 +61,7 @@ value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" - itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" + itemLabel="#{beanHelper.renderBranchOffice(branchOffice, false)}" /> @@ -150,7 +150,7 @@ value="#{departmentListController.allDepartments}" var="department" itemValue="#{department}" - itemLabel="#{beanHelper.renderDepartment(department)}" + itemLabel="#{beanHelper.renderDepartment(department, false)}" /> diff --git a/web/WEB-INF/templates/admin/headquarter/admin_form_headquarter.tpl b/web/WEB-INF/templates/admin/headquarter/admin_form_headquarter.tpl index a140c38b..9f0e8845 100644 --- a/web/WEB-INF/templates/admin/headquarter/admin_form_headquarter.tpl +++ b/web/WEB-INF/templates/admin/headquarter/admin_form_headquarter.tpl @@ -47,7 +47,7 @@ value="#{employeeListController.allEmployees}" var="companyEmployee" itemValue="#{companyEmployee}" - itemLabel="#{beanHelper.renderEmployee(companyEmployee)}" + itemLabel="#{beanHelper.renderEmployee(companyEmployee, false)}" /> diff --git a/web/admin/basic_data/admin_basic_data_list.xhtml b/web/admin/basic_data/admin_basic_data_list.xhtml index 26c732d4..606fc527 100644 --- a/web/admin/basic_data/admin_basic_data_list.xhtml +++ b/web/admin/basic_data/admin_basic_data_list.xhtml @@ -6,6 +6,8 @@ xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:p="http://primefaces.org/ui" + xmlns:core="http://mxchange.org/jsf/core/widgets" + xmlns:validator="http://mxchange.org/jsf/core/validators" > @@ -156,14 +158,14 @@ value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" - itemLabel="#{beanHelper.renderEmployee(employee)}" + itemLabel="#{beanHelper.renderEmployee(employee, true)}" /> @@ -201,14 +203,14 @@ value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" - itemLabel="#{beanHelper.renderEmployee(employee)}" + itemLabel="#{beanHelper.renderEmployee(employee, false)}" /> @@ -403,7 +405,186 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/admin/branch_office/admin_branch_office_list.xhtml b/web/admin/branch_office/admin_branch_office_list.xhtml index 919baa81..0a55aa17 100644 --- a/web/admin/branch_office/admin_branch_office_list.xhtml +++ b/web/admin/branch_office/admin_branch_office_list.xhtml @@ -133,14 +133,14 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData, true)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}" /> @@ -213,7 +213,10 @@ filterBy="#{branchOffice.branchCity}" filterMatchMode="contains" > - + @@ -347,7 +350,7 @@ @@ -357,7 +360,7 @@ @@ -369,7 +372,7 @@ diff --git a/web/admin/department/admin_department_list.xhtml b/web/admin/department/admin_department_list.xhtml index 5737d719..f0e7e702 100644 --- a/web/admin/department/admin_department_list.xhtml +++ b/web/admin/department/admin_department_list.xhtml @@ -131,14 +131,14 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData, true)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}" /> @@ -166,14 +166,14 @@ value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" - itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" + itemLabel="#{beanHelper.renderBranchOffice(branchOffice, false)}" /> @@ -211,14 +211,14 @@ value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" - itemLabel="#{beanHelper.renderEmployee(employee)}" + itemLabel="#{beanHelper.renderEmployee(employee, false, false)}" /> diff --git a/web/admin/employee/admin_employee_list.xhtml b/web/admin/employee/admin_employee_list.xhtml index 399f38fd..94b24573 100644 --- a/web/admin/employee/admin_employee_list.xhtml +++ b/web/admin/employee/admin_employee_list.xhtml @@ -132,14 +132,14 @@ value="#{branchOfficeListController.allBranchOffices}" var="branchOffice" itemValue="#{branchOffice}" - itemLabel="#{beanHelper.renderBranchOffice(branchOffice)}" + itemLabel="#{beanHelper.renderBranchOffice(branchOffice, false)}" /> @@ -221,14 +221,14 @@ value="#{basicDataListController.allBasicData}" var="basicData" itemValue="#{basicData}" - itemLabel="#{beanHelper.renderBasicData(basicData, true)}" + itemLabel="#{beanHelper.renderBasicData(basicData, true, false)}" /> diff --git a/web/admin/headquarter/admin_headquarter_list.xhtml b/web/admin/headquarter/admin_headquarter_list.xhtml index c0268868..297a5c74 100644 --- a/web/admin/headquarter/admin_headquarter_list.xhtml +++ b/web/admin/headquarter/admin_headquarter_list.xhtml @@ -192,14 +192,14 @@ value="#{employeeListController.allEmployees}" var="employee" itemValue="#{employee}" - itemLabel="#{beanHelper.renderEmployee(employee)}" + itemLabel="#{beanHelper.renderEmployee(employee, false)}" /> -- 2.39.5