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

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


    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


      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

    boolean retval = true;
    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

    if (designtime == false)
    {
      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

  //Not used at the moment
  private void checkParameters(MasterReport report) throws Exception {
    DefaultParameterContext param_context = new DefaultParameterContext(report);
    ReportParameterDefinition param_def = report.getParameterDefinition();
    ReportParameterValidator validator = param_def.getValidator();
    ValidationResult validation_result = validator.validate(new ValidationResult(), param_def, param_context);

    for(int i = 0; i < param_def.getParameterCount(); i++)
      for(ValidationMessage msg : validation_result.getErrors(param_def.getParameterDefinition(i).getName()))
        logger.info("Parameter Error: " + msg.getMessage());
  }
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.