public boolean validateParameters(
      List<ReportParameterMap> reportParameters, Map<String, Object> parameters)
      throws ProviderException {
    parameters = new SingleValueMap(parameters);

    if (reportParameters != null && reportParameters.size() > 0) {
      Iterator<ReportParameterMap> iterator = reportParameters.iterator();
      while (iterator.hasNext()) {
        ReportParameterMap rpMap = iterator.next();

        ReportParameter param = rpMap.getReportParameter();

        if (!parameters.containsKey(param.getName()) && rpMap.isRequired()) {
          throw new ProviderException(LocalStrings.ERROR_PARAMETER_REQUIRED);
        }

        if (param.getType().equals(ReportParameter.TEXT_PARAM)
            || param.getType().equals(ReportParameter.DATE_PARAM)) {
          String value = (String) parameters.get(param.getName());

          if (value != null && value.length() > 0) {
            try {
              validateParameter(param, value);
            } catch (Exception e) {
              throw new ProviderException(e.getMessage());
            }
          } else if (rpMap.isRequired()) {
            throw new ProviderException(LocalStrings.ERROR_PARAMETER_REQUIRED);
          }
        }
      }
    }

    return true;
  }
  public ReportParameterValue[] getParamValues(
      ReportParameter reportParameter, Map<String, Object> parameters) throws ProviderException {
    if (reportParameter.getType().equals(ReportParameter.QUERY_PARAM)) {
      return getParamValuesFromDataSource(reportParameter, parameters);
    } else if (reportParameter.getType().equals(ReportParameter.LIST_PARAM)) {
      return parseListValues(reportParameter);
    } else if (reportParameter.getType().equals(ReportParameter.BOOLEAN_PARAM)) {
      // default to Yes/No
      if (reportParameter.getData() == null || reportParameter.getData().indexOf("|") == -1) {
        reportParameter.setData("true:Yes|false:No");
      }

      return parseListValues(reportParameter);
    }

    throw new ProviderException(
        reportParameter.getName()
            + ": param-type "
            + reportParameter.getType()
            + " not supported!");
  }
  public void loadReportParameterValues(
      List<ReportParameterMap> reportParameters, Map<String, Object> parameters)
      throws ProviderException {
    for (int i = 0; i < reportParameters.size(); i++) {
      ReportParameterMap rpMap = reportParameters.get(i);
      ReportParameter rp = rpMap.getReportParameter();

      try {
        if (rp.getType().equals(ReportParameter.LIST_PARAM)
            || rp.getType().equals(ReportParameter.QUERY_PARAM)
            || rp.getType().equals(ReportParameter.BOOLEAN_PARAM)) {
          if (rp.getValues() == null) // only load once...
          {
            log.debug("loading parameter values: " + rp.getName());
            rp.setValues(getParamValues(rp, parameters));
          }
        }
      } catch (Exception e) {
        log.error("Error loading parameter values: " + rp.getName());
        throw new ProviderException("loadReportParameterValues: " + e.getMessage());
      }
    }
  }