コード例 #1
0
  /** **************************************************************************** Public Methods */
  public boolean validate(Validator validator, ViewDefinitionElement node) {
    boolean isValid = getStringToDataMappingDefinition().validate(validator, node);

    String defaultCase = getDefaultCase();
    if (defaultCase == null) {
      validator.getValidatorOutput().error(node, Validator.NO_DEFAULT_CASE_DEFINED_ERROR);
      return false;
    }

    if (!defaultCase.equals(NONE) && node.getChildStructure(defaultCase) == null) {
      validator
          .getValidatorOutput()
          .error(
              node,
              Validator.DEFAULT_CASE_COULD_NOT_BE_RESOLVED_ERROR_MESSAGE.format(
                  new Object[] {defaultCase}));
      return false;
    }

    String[] cases = getStringToDataMappingDefinition().getMapping().getNames();
    for (int i = 0; i < cases.length; i++) {
      if (!cases[i].equals(NONE) && node.getChildStructure(cases[i]) == null) {
        validator
            .getValidatorOutput()
            .error(
                node,
                Validator.CASE_COULD_NOT_BE_RESOLVED_ERROR_MESSAGE.format(new Object[] {cases[i]}));
        isValid = false;
      }
    }

    return isValid;
  }
コード例 #2
0
 /** **************************************************************************** Public Methods */
 public boolean validate(Validator validator, ViewDefinitionElement node) {
   if (getLength() < 1) {
     validator.getValidatorOutput().error(node, Validator.LENGTH_MUST_BE_GREATER_THAN_ZERO_ERROR);
     return false;
   }
   return true;
 }
コード例 #3
0
  /** **************************************************************************** Public Methods */
  public boolean validate(Validator validator, ViewDefinitionElement node) {
    if (stepSize < 1) {
      validator
          .getValidatorOutput()
          .error(node, Validator.STEP_SIZE_MUST_BE_GREATER_THAN_ZERO_ERROR);
      return false;
    }

    if (getDelimiterEncoding() == null) {
      validator.getValidatorOutput().error(node, Validator.NO_DELIMITER_ENCODING_DEFINED_ERROR);
      return false;
    }

    if (getDelimiterData() == null) {
      validator.getValidatorOutput().error(node, Validator.NO_DELIMITER_DATA_DEFINED_ERROR);
      return false;
    }
    return true;
  }