Examples of ValidationError


Examples of org.apache.cocoon.woody.datatype.ValidationError

        try {
            expressionResult = testExpression.evaluate(expressionContext);
        } catch (CannotYetResolveWarning w) {
            return null;
        } catch (ExpressionException e) {
            return new ValidationError("Error evaluating expression on assert validation rule.");
        }

        if (!(expressionResult instanceof Boolean))
            return new ValidationError("Got non-boolean result from expression on assert validation rule.");

        if (((Boolean)expressionResult).booleanValue())
            return null;
        else
            return hasFailMessage() ? getFailMessage() : new ValidationError("Assertion validation rule failed.");
    }
View Full Code Here

Examples of org.apache.cocoon.woody.datatype.ValidationError

    public boolean validate(Locale locale) {
        if (value != null)
            validationError = definition.getDatatype().validate(value, new ExpressionContextImpl(this));
        else if (conversionFailed)
            validationError = new ValidationError("datatype.conversion-failed", new String[] {"datatype." + definition.getDatatype().getDescriptiveName()}, new boolean[] { true });
        else if (definition.isRequired())
            validationError = new ValidationError("general.field-required");

        return validationError == null;
    }
View Full Code Here

Examples of org.apache.cocoon.woody.datatype.ValidationError

        String email = (String)value;

        if (isEmail(email))
            return null;
        else
            return hasFailMessage() ? getFailMessage() : new ValidationError("validation.string.invalidemail");
    }
View Full Code Here

Examples of org.apache.cocoon.woody.datatype.ValidationError

    public ValidationError validate(Object value, ExpressionContext expressionContext) {
        Iterator validationRulesIt = validationRules.iterator();
        while (validationRulesIt.hasNext()) {
            ValidationRule validationRule = (ValidationRule)validationRulesIt.next();
            ValidationError result = validationRule.validate(value, expressionContext);
            if (result != null)
                return result;
        }
        return null;
    }
View Full Code Here

Examples of org.apache.cocoon.woody.validation.ValidationError

                this.value = getDatatype().convertFromString(this.enteredValue, getForm().getLocale());
                if (this.value != null) {       // Conversion successfull
                    this.needsParse = false;
                    this.needsValidate = true;
                } else {        // Conversion failed
                    this.validationError = new ValidationError(new I18nMessage(
                        "datatype.conversion-failed",
                        new String[] {"datatype." + getDatatype().getDescriptiveName()},
                        new boolean[] { true },
                        Constants.I18N_CATALOGUE
                    ));
                    // No need for further validation (and need to keep the above error)
                    this.needsValidate = false;
                }
            } else {
                this.needsParse = false;
                this.needsValidate = true;
            }
        }

        // if getValue() is called on this field while we're validating, then it's because a validation
        // rule called getValue(), so then we just return the parsed (but not validated) value to avoid an endless loop
        if (isValidating) {
            return value;
        }

        // Validate the value
        if (this.needsValidate) {
            isValidating = true;
            try {
                if (super.validate(null)) {
                    // New-style validators were successful. Check the old-style ones.
                    if (this.value != null) {
                        this.validationError = getDatatype().validate(value, new ExpressionContextImpl(this));
                    } else {        // No value : is it required ?
                        if (getFieldDefinition().isRequired()) {
                            this.validationError = new ValidationError(new I18nMessage("general.field-required", Constants.I18N_CATALOGUE));
                        }
                    }
                }
                this.needsValidate = false;
            } finally {
View Full Code Here

Examples of org.apache.padaf.preflight.ValidationResult.ValidationError

    if (catalog != null) {
      PDDocumentOutline outlineHierarchy = catalog.getDocumentOutline();
      if (outlineHierarchy != null) {
        // ---- Count entry is mandatory if there are childrens
        if (!isCountEntryPresent(outlineHierarchy.getCOSDictionary()) && (outlineHierarchy.getFirstChild() != null || outlineHierarchy.getLastChild() != null) ) {
          result.add(new ValidationError(
              ERROR_SYNTAX_TRAILER_OUTLINES_INVALID,
              "Outline Hierarchy doesn't have Count entry"));
        } else if (isCountEntryPositive(outlineHierarchy.getCOSDictionary(), handler.getDocument().getDocument())
            && (outlineHierarchy.getFirstChild() == null || outlineHierarchy.getLastChild() == null)) {
          result.add(new ValidationError(ERROR_SYNTAX_TRAILER_OUTLINES_INVALID,
              "Outline Hierarchy doesn't have First and/or Last entry(ies)"));
        } else {
          exploreOutlineLevel(outlineHierarchy.getFirstChild(), handler, result);
        }
      }
View Full Code Here

Examples of org.apache.pdfbox.preflight.ValidationResult.ValidationError

        if (vPath.isEmpty()) {
            return;
        }
        else if (!vPath.isExpectedType(PDShading.class))
        {
            context.addValidationError(new ValidationError(PreflightConstants.ERROR_GRAPHIC_MISSING_OBJECT, "ShadingPattern validation required at least a PDResources"));
        }
        else
        {
            PDShading shaddingResource = (PDShading) vPath.peek();
            PDPage page = vPath.getClosestPathElement(PDPage.class);
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

            final DateTimeField dateTimeField = (DateTimeField) dateTimeComponents[0];

            if (!(dateTimeField.getDate() != null && dateTimeField.getHours() != null
                    && dateTimeField.getMinutes() != null)) {

                ValidationError ve = new ValidationError();
                ve.setVariables(DateTimeFormValidator.this.variablesMap());
                ve.addKey(resourceKey());
                dateTimeComponents[0].error((IValidationError) ve);
            }
        }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

    {
      throw new IllegalArgumentException("Argument [[resourceKey]] cannot be null");
    }


    ValidationError error = new ValidationError().addMessageKey(resourceKey);
    final String defaultKey = getClass().getSimpleName();
    if (!resourceKey.equals(defaultKey))
    {
      error.addMessageKey(defaultKey);
    }

    error.setVariables(vars);
    validatable.error(error);
  }
View Full Code Here

Examples of org.apache.wicket.validation.ValidationError

    R value = getValue(validatable);
    final R min = getMinimum();
    final R max = getMaximum();
    if ((min != null && value.compareTo(min) < 0) || (max != null && value.compareTo(max) > 0))
    {
      ValidationError error = new ValidationError(this, getMode().getVariation());
      if (min != null)
      {
        error.setVariable("minimum", min);
      }
      if (max != null)
      {
        error.setVariable("maximum", max);
      }
      validatable.error(decorate(error, validatable));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.