]> git.mxchange.org Git - jjobs-war.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Sun, 25 Sep 2022 20:36:04 +0000 (22:36 +0200)
committerRoland Häder <roland@mxchange.org>
Sun, 25 Sep 2022 20:37:05 +0000 (22:37 +0200)
- branch offices have optional email addresses (finally found the bug that you
  always must enter an email address while the form field is not marked as
  required)

src/java/org/mxchange/jjobs/validator/business/headquarter/JobsHeadquarterCompanyNameValidator.java
src/java/org/mxchange/jjobs/validator/emailaddress/branchoffice/JobsBranchOfficeEmailAddressValidator.java

index 971b916e69958e5f70a839850d3624f908c540fc..c4828b3c64308402f1517eb13bd906e76dc7d409 100644 (file)
@@ -51,7 +51,7 @@ public class JobsHeadquarterCompanyNameValidator extends BaseStringValidator {
                final String[] requiredFields = {"companyName"}; //NOI18N
 
                // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFields, false);
+               super.preValidate(context, component, value, requiredFields, Boolean.FALSE);
 
                // Convert name to string (now securely checked in BaseStringValidator)
                final String companyName = (String) value;
@@ -59,7 +59,7 @@ public class JobsHeadquarterCompanyNameValidator extends BaseStringValidator {
                // Default is to check on existing names
                Boolean checkExisting = Boolean.TRUE;
 
-               // Is attribute "allowEmptyRequiredData" set?
+               // Is attribute "checkExisting" set?
                if (component.getAttributes().containsKey("checkExisting")) { //NOI18N
                        // Get attribute
                        final Object attribute = component.getAttributes().get("checkExisting"); //NOI18N
index 2baba45e02e85242e03b8e70efd0b2b2b567e99a..f9c911a6798ada1c152a6a61b7d15507ef37f6d4 100644 (file)
@@ -56,25 +56,10 @@ public class JobsBranchOfficeEmailAddressValidator extends BaseStringValidator {
         */
        private static final long serialVersionUID = 187_536_745_607_196L;
 
-       /**
-        * Whether empty data is allowed
-        */
-       private Boolean allowEmptyRequiredData;
-
        /**
         * Default constructor
         */
        public FinancialsBranchOfficeEmailAddressValidator () {
-               this.allowEmptyRequiredData = Boolean.FALSE;
-       }
-
-       /**
-        * Setter for allowEmptyRequiredData flag
-        * <p>
-        * @param allowEmptyRequiredData Whether empty values are allowed
-        */
-       public void setAllowEmptyRequiredData (final Boolean allowEmptyRequiredData) {
-               this.allowEmptyRequiredData = allowEmptyRequiredData;
        }
 
        @Override
@@ -83,15 +68,12 @@ public class JobsBranchOfficeEmailAddressValidator extends BaseStringValidator {
                final String[] requiredFields = {"branchEmailAddress"}; //NOI18N
 
                // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFields, this.allowEmptyRequiredData);
+               super.preValidate(context, component, value, requiredFields, Boolean.TRUE);
 
                // Is the email address empty and allowed?
-               if (null == value && this.allowEmptyRequiredData) {
+               if (null == value) {
                        // Then accept this here
                        return;
-               } else if (null == value) {
-                       // Abort here
-                       throw new ValidatorException(new FacesMessage("No empty email address allowed.")); //NOI18N
                }
 
                // Get string from object ... ;-)