/* (non-Javadoc)
@see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
336499
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        try {
            this.duracloudUserService.checkUsername(value);
        } catch (InvalidUsernameException ex) {
            context.disableDefaultConstraintViolation();
            String message;
            if (ex instanceof ReservedUsernameException) {
                message = RESERVED_USERNAME_MESSAGE;
            } else if (ex instanceof ReservedPrefixException) {
                message = RESERVED_PREFIX_MESSAGE;
            } else {
                message = INVALID_USERNAME_MESSAGE;
            }

            message = MessageFormat.format(message, value);
            ConstraintViolationBuilder cvb =
                context.buildConstraintViolationWithTemplate(message);
            cvb.addConstraintViolation();
            return false;
        } catch (UserAlreadyExistsException ex) {
            return false;
        }

        return true;
    }
520007
@Override
	public boolean isValid() {
		boolean mustNotCache =
				has("Pragma", "no-cache", this.response)
				|| has("Cache-Control", "no-cache", this.response);

		if (mustNotCache)
			return false;

		Date now = new Date();
		Date cacheControl = getCacheControlExpiresDate();
		Date expires = getExpiresDate();

		return now.before(cacheControl) || now.before(expires);
	}
83339
public boolean removeValidationConstraint(String type, String field, String constraintName) {
		if (!StringUtils.isBlank(type) && !StringUtils.isBlank(field) && constraintName != null) {
			Map<String, Map<String, Map<String, ?>>> fieldsMap = getValidationConstraints().get(type);
			if (fieldsMap != null && fieldsMap.containsKey(field)) {
				if (fieldsMap.get(field).containsKey(constraintName)) {
					fieldsMap.get(field).remove(constraintName);
				}
				if (fieldsMap.get(field).isEmpty()) {
					getValidationConstraints().get(type).remove(field);
				}
				if (getValidationConstraints().get(type).isEmpty()) {
					getValidationConstraints().remove(type);
				}
				return true;
			}
		}
		return false;
	}
525978
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    String valueAsString = Objects.toString(pvalue, StringUtils.EMPTY);
    if (StringUtils.isEmpty(valueAsString)) {
      return true;
    }
    if (ignoreWhiteSpaces) {
      valueAsString = valueAsString.replaceAll("\\s", StringUtils.EMPTY);
    }
    if (ignoreMinus) {
      valueAsString = valueAsString.replaceAll("-", StringUtils.EMPTY);
    }
    if (ignoreSlashes) {
      valueAsString = valueAsString.replaceAll("/", StringUtils.EMPTY);
    }
    return StringUtils.length(valueAsString) == size1 || StringUtils.length(valueAsString) == size2;
  }
110692
@Override
    public void validate(final FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }

        final Validator[] validators = getValidators();
        final Object value = getValue();

        if (!validateRequired(context, value)) {
            return;
        }

        if (validators == null) {
            return;
        }

        for (final Validator validator : validators) {
            try {
                validator.validate(context, this, value);
            }
            catch (final ValidatorException ve) {
                // If the validator throws an exception, we're
                // invalid, and we need to add a message
                setValid(false);
                FacesMessage message;
                final String validatorMessageString = getValidatorMessage();

                if (null != validatorMessageString) {
                    message = new FacesMessage(FacesMessage.SEVERITY_ERROR,
                                validatorMessageString,
                                validatorMessageString);
                    message.setSeverity(FacesMessage.SEVERITY_ERROR);
                }
                else {
                    final Collection<FacesMessage> messages = ve.getFacesMessages();
                    if (null != messages) {
                        message = null;
                        final String cid = getClientId(context);
                        for (final FacesMessage m : messages) {
                            context.addMessage(cid, m);
                        }
                    }
                    else {
                        message = ve.getFacesMessage();
                    }
                }
                if (message != null) {
                    final Sheet sheet = getSheet();
                    if (sheet == null) {
                        return;
                    }
                    context.addMessage(getClientId(context), message);
                    sheet.getInvalidUpdates().add(
                                new SheetInvalidUpdate(sheet.getRowKeyValue(context), sheet.getColumns().indexOf(this), this, value,
                                            message.getDetail()));

                }
            }
        }

    }
1341959
@Override
	public boolean isValid(Object value, ConstraintValidatorContext constraintContext) {

		// Si l'objet est null
		if(value == null) return false;
		
		// Si on a un Calendar
		if(value instanceof Calendar) {
			
			// On caste
			Calendar calendar = (Calendar) value;
			
			// On évalue
			return calendar.getTime().before(new Date());
		}

		// Si on a un Date
		if(value instanceof Date) {
			
			// On caste
			Date date = (Date) value;
			
			// On évalue
			return date.before(new Date());
		}
		
		// Si l'objet n'est pas de type date (On l'ignore en retournant true - Comme s'il n'ya eu aucun test)
		return true;
	}
171036
@Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        try {
            this.duracloudUserService.checkUsername(value);
            return false;
        } catch (InvalidUsernameException ex) {
            return false;
        } catch (UserAlreadyExistsException ex) {
            return true;
        }
    }
321928
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString;
    if (ignoreSeparators) {
      valueAsString =
          Objects.toString(pvalue, StringUtils.EMPTY).replaceAll("-", StringUtils.EMPTY);
    } else {
      valueAsString = Objects.toString(pvalue, null);
    }
    if (StringUtils.isEmpty(valueAsString)) {
      return true;
    }
    if (!StringUtils.isNumeric(valueAsString)) {
      return false;
    }
    if (valueAsString.length() == Isbn10Validator.ISBN10_LENGTH) {
      // we do have 10 digits, lets test the checksum
      return CHECK_ISBN10.isValid(valueAsString);
    }
    if (valueAsString.length() == Isbn13Validator.ISBN13_LENGTH) {
      // we do have 13 digits, lets test the checksum
      return CHECK_ISBN13.isValid(valueAsString);
    }
    // other sizes are wrong, but this is reported by AlternateSize
    return true;
  }
517839
@JsonIgnore
    public boolean isValid() {
        if (kty == null) {
            return false;
        }

        if (keyOps != null) {
            final Set<JsonWebKeyOperation> set = new HashSet<JsonWebKeyOperation>(JsonWebKeyOperation.ALL_OPERATIONS);
            for (int i = 0; i < keyOps.size(); i++) {
                if (!set.contains(keyOps.get(i))) {
                    return false;
                }
            }
        }

        if (JsonWebKeyType.OCT.equals(kty)) {
            return isValidOctet();
        } else if (JsonWebKeyType.RSA.equals(kty)) {
            return isValidRsa();
        } else if (JsonWebKeyType.RSA_HSM.equals(kty)) {
            return isValidRsaHsm();
        } else if (JsonWebKeyType.EC.equals(kty)) {
            return isValidEc();
        } else if (JsonWebKeyType.EC_HSM.equals(kty)) {
            return isValidEcHsm();
        }

        return false;
    }
1243951
public boolean validationAsBoolean()
   {
      if (this.getConnectionDefinitions() == null || this.getConnectionDefinitions().isEmpty())
         return false;

      ConnectionDefinition cdm = this.getConnectionDefinitions().get(0);
      if (cdm.getManagedConnectionFactoryClass() == null || cdm.getConnectionFactoryInterface() == null ||
          cdm.getConnectionFactoryImplClass() == null || cdm.getConnectionInterface() == null ||
          cdm.getConnectionImplClass() == null)
         return false;

      return true;
   }
468604
@Override
    public boolean isValid(Object input) {
        long value;
        try {
            value = Long.parseLong(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minAllowedValue != null && value < minAllowedValue)
            return false;
        if (maxAllowedValue != null && value > maxAllowedValue)
            return false;

        return true;
    }
238659
public boolean isValid() {
        int totalNumberOfColumns = 0;
        Set<Object> columns = new HashSet<>();
        for(Map.Entry<Object, AssociativeArray> entry : internalData.entrySet()) {
            AssociativeArray row = entry.getValue();
            if(columns.isEmpty()) {
                //this is executed only for the first row
                for(Object column : row.internalData.keySet()) {
                    columns.add(column);
                }
                totalNumberOfColumns = columns.size();
            }
            else {
                //validating the columns of next rows based on first column
                if(totalNumberOfColumns!=row.size()) {
                    return false; //if the number of rows do not much then it is invalid
                }
                
                for(Object column : columns) {
                    if(row.containsKey(column)==false) {
                        return false; //if one of the detected columns do not exist, it is invalid
                    }
                }
            }
        }
        return true;
    }
93177
@SuppressWarnings("unchecked")
    private boolean isValid() {

        for (Field<?> field : m_fields) {
            if (!field.isValid()) {
                field.focus();

                return false;
            }
        }
        for (Component c : m_resources) {
            if (c instanceof CmsRemovableFormRow<?>) {
                if (!((CmsRemovableFormRow<CmsPathSelectField>)c).getInput().isValid()) {
                    ((CmsRemovableFormRow<CmsPathSelectField>)c).getInput().focus();
                    return false;
                }
            }
        }
        return true;
    }
452664
@Override
    public boolean isValid(Object input) {
        int value;
        try {
            value = Integer.parseInt(input.toString());
        } catch (NumberFormatException e) {
            return false;
        }

        if (minAllowedValue != null && value < minAllowedValue)
            return false;
        if (maxAllowedValue != null && value > maxAllowedValue)
            return false;
        return true;
    }
1321708
@Override
  public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
    final String valueAsString = Objects.toString(pvalue, null);
    if (StringUtils.isEmpty(valueAsString)) {
      // empty field is ok
      return true;
    }
    if (valueAsString.length() < IBAN_LENGTH_MIN || valueAsString.length() > IBAN_LENGTH_MAX) {
      // to short or to long, but it's handled by size validator!
      return true;
    }
    final String countryCode = valueAsString.substring(0, 2);
    final IbanLengthDefinition validIbanLength = IBAN_LENGTH_MAP.ibanLengths().get(countryCode);
    if (validIbanLength == null || valueAsString.replaceAll("\\s", StringUtils.EMPTY)
        .length() != validIbanLength.getLength()) {
      // unknown country or wrong length for the country!
      return false;
    }
    if (!valueAsString.matches("^[A-Z]{2}[0-9A-Z]{2} ([0-9A-Z]{4}[ ])+[0-9A-Z]{1,4}$")) {
      // wrong format
      return false;
    }

    return CHECK_IBAN.isValid(IbanUtil.ibanCompress(valueAsString));
  }
966745
@Override
  public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) {
    if (StringUtils.isEmpty(pvalue)) {
      return true;
    }
    if (pvalue.length() > LENGTH_MAIL) {
      // Email is to long, but that's handled by size annotation
      return true;
    }
    if (!StringUtils.equals(pvalue, StringUtils.trim(pvalue))) {
      // mail contains leading or trailing space(s), that's not correct
      return false;
    }
    return org.apache.commons.validator.routines.EmailValidator.getInstance().isValid(pvalue);
  }
955620
public boolean isAllDataValid() {
		// Make this method smatert
		for (final JKTableColumn col : this.tableColumns) {
			final int lastRow = getRowCount() - 1;
			if (col.isVisible() && col.isRequired()) {
				final Object colValue = getValueAt(lastRow, col.getIndex());
				if (colValue == null || colValue.toString().equals("")) {
					return false;// dont allow
				}
			}
		}
		return true;
	}