Package org.pentaho.reporting.engine.classic.core.parameters

Examples of org.pentaho.reporting.engine.classic.core.parameters.ValidationResult


      proc.close();
      return true;
    }
    catch (ReportParameterValidationException ve)
    {
      final ValidationResult validationResult = ve.getValidationResult();
      final List<String> strings = Arrays.asList(validationResult.toMessageList());
      DebugLog.log(strings, ve);
      return false;
    }
    catch (Throwable e)
    {
View Full Code Here


      final DefaultParameterContext parameterContext = new DefaultParameterContext(report);

      try
      {
        final ReportParameterValidator reportParameterValidator = parameters.getValidator();
        final ValidationResult validationResult =
            reportParameterValidator.validate(new ValidationResult(), parameters, parameterContext);
        // first compute the default values ...
        this.reportParameterValues = validationResult.getParameterValues();
      }
      finally
      {
        parameterContext.close();
      }
View Full Code Here

    if (validator != null)
    {
      try
      {
        final ValidationResult validationResult = validator.validate
            (new ValidationResult(), report.getParameterDefinition(), parameterContext);

        final ValidationMessage[] messages = validationResult.getErrors();
        globalErrorMessage.setText(formatMessages(messages));

        final String[] propertyNames = validationResult.getProperties();
        for (int i = 0; i < propertyNames.length; i++)
        {
          final String propertyName = propertyNames[i];
          final JLabel o = errorLabels.get(propertyName);
          final ValidationMessage[] validationMessages = validationResult.getErrors(propertyName);
          final String message = formatMessages(validationMessages);
          if (o == null)
          {
            final String s = globalErrorMessage.getText();
            if (StringUtils.isEmpty(s))
            {
              globalErrorMessage.setText(propertyName + ": " + message);
            }
            else
            {
              globalErrorMessage.setText(s + "\n" + propertyName + ": " + message);
            }
          }
          else
          {
            o.setText(message);
          }
        }

        // Set the updated and validated parameter values as new values.
        final ReportParameterValues parameterValues = validationResult.getParameterValues();
        for (final String columnName : parameterValues.getColumnNames())
        {
          final Object value = parameterValues.get(columnName);
          if (value != null)
          {
View Full Code Here

    parameterContext.open();
    try
    {
      final ReportParameterDefinition parameterDefinition = definition.getParameterDefinition();
      final ReportParameterValidator reportParameterValidator = parameterDefinition.getValidator();
      final ValidationResult validationResult =
          reportParameterValidator.validate(new ValidationResult(), parameterDefinition, parameterContext);
      if (validationResult.isEmpty() == false)
      {
        throw new ReportParameterValidationException
            ("The parameters provided for this report are not valid.", validationResult);
      }
    }
View Full Code Here

    parameterContext.open();
    final ReportParameterValues parameterValues;
    try
    {
      final ReportParameterValidator reportParameterValidator = parameters.getValidator();
      final ValidationResult validationResult =
          reportParameterValidator.validate(new ValidationResult(), parameters, parameterContext);
      parameterValues = validationResult.getParameterValues();
      return computeParameterValueSet(report, parameterValues);
    }
    finally
    {
      parameterContext.close();
View Full Code Here

    parameterContext.open();
    final ReportParameterValues parameterValues;
    try
    {
      final ReportParameterValidator reportParameterValidator = parameters.getValidator();
      final ValidationResult validationResult =
          reportParameterValidator.validate(new ValidationResult(), parameters, parameterContext);
      if (validationResult.isEmpty() == false)
      {
        throw new ReportParameterValidationException
            ("The parameters provided for this report are not valid.", validationResult);
      }
      parameterValues = validationResult.getParameterValues();
    }
    finally
    {
      parameterContext.close();
    }
View Full Code Here

    try
    {
      final ReportParameterDefinition parameterDefinition = definition.getParameterDefinition();
      final ReportParameterValidator reportParameterValidator = parameterDefinition.getValidator();
      final ValidationResult validationResult =
          reportParameterValidator.validate(new ValidationResult(), parameterDefinition, parameterContext);
      if (validationResult.isEmpty() == false)
      {
        throw new ReportParameterValidationException
            ("The parameters provided for this report are not valid.", validationResult);
      }
    }
View Full Code Here

    final MasterReport report = new MasterReport();
    final DefaultReportParameterValidator validator = new DefaultReportParameterValidator();
    report.setDataFactory(dataFactory);
    report.setParameterDefinition(parameterDefinition);
    report.getParameterValues().put("parameter", new Object[]{"K1", new Integer(1)});
    ValidationResult validate = validator.validate(null, parameterDefinition, new DefaultParameterContext(report));
    assertFalse(validate.isEmpty());

    report.getParameterValues().put("parameter", new Object[]{"K1", "K2"});
    validate = validator.validate(null, parameterDefinition, new DefaultParameterContext(report));
    assertTrue(validate.isEmpty());

    report.getParameterValues().put("parameter", new Object[]{"K1", "K2", "K5"});
    validate = validator.validate(null, parameterDefinition, new DefaultParameterContext(report));
    assertTrue(validate.isEmpty());
  }
View Full Code Here

    final MasterReport report = new MasterReport();
    final DefaultReportParameterValidator validator = new DefaultReportParameterValidator();
    report.setDataFactory(dataFactory);
    report.setParameterDefinition(parameterDefinition);
    report.getParameterValues().put("parameter", new Object[]{"K1", new Integer(1)});
    ValidationResult validate = validator.validate(null, parameterDefinition, new DefaultParameterContext(report));
    assertFalse(validate.isEmpty());

    report.getParameterValues().put("parameter", new Object[]{"K1", "K2"});
    validate = validator.validate(null, parameterDefinition, new DefaultParameterContext(report));
    assertTrue(validate.isEmpty());

    report.getParameterValues().put("parameter", new Object[]{"K1", "K2", "K5"});
    validate = validator.validate(null, parameterDefinition, new DefaultParameterContext(report));
    assertFalse(validate.isEmpty());
  }
View Full Code Here

    report.setDataFactory(new TableDataFactory("test", tableModel));

    final DefaultParameterContext paramContext = new DefaultParameterContext(report);

    final DefaultReportParameterValidator validator = new DefaultReportParameterValidator();
    final ValidationResult result = validator.validate(new ValidationResult(), definition, paramContext);
    assertTrue(result.isEmpty());
   
  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.engine.classic.core.parameters.ValidationResult

Copyright © 2018 www.massapicom. 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.