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;
// 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
*/
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
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 ... ;-)