Examples of ValidationResult


Examples of org.drools.factconstraints.client.ValidationResult

        return this.createVerifierRuleTemplate(config, context, "Integer_Field_Constraint", constraints, "The value must be an integer"); //I18N
    }

    @Override
    public ValidationResult validate(Object value, ConstraintConfiguration config) {
        ValidationResult result = new ValidationResult();

        if (value == null){
            result.setSuccess(false);
            result.setMessage("The value is null"); //TODO: I18N
        }else if (value instanceof Integer){
            result.setSuccess(true);
        }else if (value instanceof String){
            try{
                Integer.parseInt((String)value);
                result.setSuccess(true);
            } catch(NumberFormatException ex){
                result.setSuccess(false);
                result.setMessage(ex.getMessage()); //TODO: I18N
            }
        }else{
            result.setSuccess(false);
            result.setMessage("Invalid value type "+value.getClass().getName()); //TODO: I18N
        }

        return result;
    }
View Full Code Here

Examples of org.drools.ide.common.client.factconstraints.ValidationResult

    }

    @Test @Ignore
    public void testValidConstraint(){

        ValidationResult result = cons.validate("Bart", conf);
        assertTrue(result.isSuccess());

        result = cons.validate("", conf);
        assertFalse(result.isSuccess());

        result = cons.validate("bart", conf);
        assertFalse(result.isSuccess());

        result = cons.validate(new Long("12"), conf);
        assertFalse(result.isSuccess());

        result = cons.validate(12L, conf);
        assertFalse(result.isSuccess());

        result = cons.validate(12.8, conf);
        assertFalse(result.isSuccess());
    }
View Full Code Here

Examples of org.eclipse.wst.validation.ValidationResult

    }

    @Override
    public ValidationResult validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor) {

        ValidationResult res = new ValidationResult();

        if (!okToValidate) {
            return res;
        }
View Full Code Here

Examples of org.eclipse.wst.validation.ValidationResult

    private final ServiceComponentHeaderValidator scValidator = new ServiceComponentHeaderValidator();

    @Override
    public ValidationResult validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor) {
       
        ValidationResult res = new ValidationResult();

        IResource resource = event.getResource();

        if (!resource.getName().equals("MANIFEST.MF") || resource.getType() != IResource.FILE) {
            return res;
        }

        IFile m = (IFile) resource;

        Logger pluginLogger = Activator.getDefault() .getPluginLogger();

        try {

            for (IFile descriptor : scValidator.findMissingScrDescriptors(m)) {
                ValidatorMessage dsMessage = ValidatorMessage.create(
                        "No DS descriptor found at path " + descriptor.getProjectRelativePath(), m);
                dsMessage.setAttribute(IMarker.LOCATION, m.getName());
                dsMessage.setAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);

                res.add(dsMessage);

            }

        } catch (CoreException e) {
            pluginLogger.warn("Failed validating project " + resource.getFullPath(), e);
View Full Code Here

Examples of org.fcrepo.client.utility.validate.ValidationResult

    @Test
    public void gettingFromPidThrowsException() {
        objectSource.throwObjectSourceExceptionOnPid(SAMPLE_PID);

        ValidationResult expected =
                expectedResult(new BasicObjectInfo(SAMPLE_PID),
                               ValidationResultNotation
                                       .objectNotFound(SAMPLE_PID));

        ValidationResult actual = validator.validate(SAMPLE_PID);
        assertEquals("result", expected, actual);
    }
View Full Code Here

Examples of org.freeplane.core.resources.components.IValidator.ValidationResult

    topDialog.getContentPane().add(ButtonBarFactory.buildOKCancelBar(cancelButton, okButton), BorderLayout.SOUTH);
  }

  private boolean validate() {
    final Properties properties = getOptionProperties();
    final ValidationResult result = new ValidationResult();
    for (final IValidator validator : Controller.getCurrentController().getOptionValidators()) {
      result.add(validator.validate(properties));
    }
    if (!result.isValid()) {
      UITools.errorMessage(formatErrors("OptionPanel.validation_error", result.getErrors()));
      LogUtils.severe(result.toString());
    }
    else if (result.hasWarnings()) {
      UITools.informationMessage(formatErrors("OptionPanel.validation_warning", result.getWarnings()));
      LogUtils.warn(result.toString());
    }
    return result.isValid();
  }
View Full Code Here

Examples of org.fusesource.ide.camel.editor.validation.ValidationResult

    IFeatureProvider featureProvider = getFeatureProvider();
    Object bo = featureProvider.getBusinessObjectForPictogramElement(pe);
    if (bo instanceof AbstractNode) {
      AbstractNode node = (AbstractNode) bo;

      ValidationResult res = ValidationFactory.getInstance().validate(node);
      if (res.getInformationCount() > 0) {
        for (String message : res.getInformations()) {
          IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_INFORMATION_TSK);
          imageRenderingDecorator.setMessage(message);
          decorators.add(imageRenderingDecorator);
        }
      }
      if (res.getWarningCount() > 0) {
        for (String message : res.getWarnings()) {
          IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_WARNING_TSK);
          imageRenderingDecorator.setMessage(message);
          decorators.add(imageRenderingDecorator);
        }
      }
      if (res.getErrorCount() > 0) {
        for (String message : res.getErrors()) {
          IDecorator imageRenderingDecorator = new ImageDecorator(IPlatformImageConstants.IMG_ECLIPSE_ERROR_TSK);
          imageRenderingDecorator.setMessage(message);
          decorators.add(imageRenderingDecorator);
        }
      }
View Full Code Here

Examples of org.geoserver.catalog.ValidationResult

   
    protected ValidationResult postValidate(CatalogInfo info, boolean isNew) {
        List<RuntimeException> errors = new ArrayList<RuntimeException>();

        if (!extendedValidation) {
            return new ValidationResult(null);
        }

        for (CatalogValidator constraint : getValidators()) {
            try {
                info.accept(new CatalogValidatorVisitor(constraint, isNew));
            } catch (RuntimeException e) {
                errors.add(e);
            }
        }
        return new ValidationResult(errors);
    }
View Full Code Here

Examples of org.graylog2.plugin.database.validators.ValidationResult

        for (Map.Entry<String, Validator> validation : validators.entrySet()) {
            Validator v = validation.getValue();
            String field = validation.getKey();

            try {
                ValidationResult validationResult = v.validate(fields.get(field));
                if (validationResult instanceof ValidationResult.ValidationFailed) {
                    LOG.debug("Validation failure: [{}] on field [{}]", v.getClass().getCanonicalName(), field);
                    if (validationErrors.get(field) == null)
                        validationErrors.put(field, new ArrayList<ValidationResult>());
                    validationErrors.get(field).add(validationResult);
View Full Code Here

Examples of org.graylog2.plugin.database.validators.ValidationResult

     * @param value The object to check
     * @return validation result
     */
    @Override
    public ValidationResult validate(Object value) {
        ValidationResult superResult = super.validate(value);
        if (superResult instanceof ValidationResult.ValidationPassed) {
            String sValue = (String)value;
            if (sValue.length() >= minLength && sValue.length() <= maxLength)
                new ValidationResult.ValidationPassed();
            else
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.