public Map<String, List> runReport(Map<String, String[]> parameterMap)
      throws InvalidInputException, ParseException {

    this.setCachedParameterMap(parameterMap);
    Map<String, List> reportData = this.report.runNewSearch(this);
    this.cachedData = new HashMap<String, List>();

    for (String outputName : this.report.getOutputs().keySet()) {
      Output output = this.report.getOutputs().get(outputName);
      OutputElement outputElement = output.getOutputElement();

      if (!outputElement.isValueList()) {
        // remove any adapter that may have been present from before:
        this.valueListAdapters.remove(outputName);

        List outputData = reportData.get(outputName);
        if ((outputElement.getMaxRowsForCache() <= 0)
            || outputElement.getMaxRowsForCache() > outputData.size()) {
          // cache all data:
          this.cachedData.put(outputName, outputData);
        } else if (outputData.size() == outputElement.getMaxRowsForDisplayTag()) {
          // use valuelist:
          createAndAddAdapter(output, parameterMap);
        } else {
          // no cached data
          // remove cachedData:
          this.cachedData.remove(outputName);
        }
      } else { // value list:
        createAndAddAdapter(output, parameterMap);
      }
    }

    reportWasRunAndDataWasNotCleared = true;
    return reportData;
  }
 /**
  * todo: fine tune this method:
  *
  * @param output
  */
 private void createAndAddAdapter(Output output, Map<String, String[]> parameterMap)
     throws InvalidInputException, ParseException {
   CFDynaBeanAdapter adapter = new CFDynaBeanAdapter();
   adapter.setDataSource(output.getQuery().getDataSource());
   adapter.setUseName(false);
   adapter.setDefaultNumberPerPage(output.getOutputElement().getRowsPerPage());
   adapter.setDefaultSortDirection("asc");
   adapter.setShowSql(false);
   //    get query string, then add sort Column
   adapter.setSql(
       "select * from (\n"
           + output
               .getQuery()
               .getQueryString(MapToInput.convertParameterMapToInputs(parameterMap, this.report))
           + ")\n"
           + "                /~"
           + ParameterNames.sortColumn
           + ": ORDER BY \"["
           + ParameterNames.sortColumn
           + "]\" ["
           + ParameterNames.sortDirection
           + "]~/");
   this.valueListAdapters.put(output.getOutputElement().getName(), adapter);
 }
 public boolean isHasAnAdapterForOutput(Output output) {
   return this.valueListAdapters.get(output.getOutputElement().getName()) != null;
 }