All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jbpm.sim.report.jasper.ScenarioComparisionReport Maven / Gradle / Ivy

There is a newer version: 3.2.19.ayg
Show newest version
package org.jbpm.sim.report.jasper;

import java.util.HashMap;
import java.util.Map;

import org.jbpm.sim.def.JbpmSimulationExperiment;
import org.jbpm.sim.exe.ExperimentReader;
import org.jbpm.sim.report.ExperimentReport;

/**
 * This report shows the comparison of multiple scenarios.
 * 
 * Currently waiting, if it is possible to add different tasks on 
 * one stacked bar or line chart. See JasperReports forum entry.
 * 
 * @author [email protected]
 */
public class ScenarioComparisionReport extends AbstractBaseJasperReport {

  private ExperimentReport report;

  public ScenarioComparisionReport(ExperimentReport report)  {
    this.report = report;
  }
  
  public Object[] getContent() {
    /**
     * we need at least one "pseudo" row, otherwise the report will be empty
     */
    return new Object[] {""};
  }

  public Map getReportParameters() {
    HashMap params = new HashMap();
    params.put("EXPERIMENT_REPORT", report); 
    return params;
  }

  public String getReportPath() {
    return "/org/jbpm/sim/report/jasper/ScenarioComparison.jasper";
  }

  public Map getSubreportPaths() {
    HashMap subreports = new HashMap();
    
    subreports.put("SUBREPORT_WaitingTimeBeforeTaskComparison", 
        "/org/jbpm/sim/report/jasper/WaitingTimeBeforeTaskComparison.jasper");
    subreports.put("SUBREPORT_WaitingTimeForResourceComparison", 
        "/org/jbpm/sim/report/jasper/WaitingTimeForResourceComparison.jasper");
    subreports.put("SUBREPORT_ResourceUtilizationComparison", 
        "/org/jbpm/sim/report/jasper/ResourceUtilizationComparison.jasper");
    subreports.put("SUBREPORT_ScenarioComparisonTable", 
        "/org/jbpm/sim/report/jasper/ScenarioComparisonTable.jasper");
    subreports.put("SUBREPORT_ScenarioComparisonProcessCycleTimesTable", 
        "/org/jbpm/sim/report/jasper/ScenarioComparisonProcessCycleTimesTable.jasper");
    
    return subreports;
  }
  
  /**
   * run a small simulation and show results in Report
   * @param args
   */
  public static void main(String[] args) {
    String processXml =     
      "" +

      "   " +
      "   " +

      "  " +

      "  " +
      "    " +
      "  " +
      
      "  " +
      "    " +
      "    " +
      "  " +
      
      "  " +

      "" ;    
    
    String experimentConfiguration = 
      "" +  
      "  " +  
      "    " +      
      "    " +
      "  " +
      "  " +  
      "    " +      
      "    " +
      "  " +
      "  " +  
      "    " +      
      "    " +
      "  " +
      "  " +  
      "    " +      
      "    " +
      "  " +
      "  " +  
      "    " +      
      "    " +
      "  " +
      "";   
    
    ExperimentReader reader = new ExperimentReader(experimentConfiguration);
    reader.addProcessDefinition( "test", processXml );    
    JbpmSimulationExperiment experiment = reader.readExperiment();
    experiment.setWriteDesmojHtmlOutput(true);
    experiment.run();
    
    ScenarioComparisionReport report = new ScenarioComparisionReport(experiment.getReport());
    report.show();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy