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

org.jbpm.sim.def.DefaultJbpmSimulationModel Maven / Gradle / Ivy

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

import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.sim.jpdl.SimulationJpdlXmlReader;

public class DefaultJbpmSimulationModel extends JbpmSimulationModel {
  
  private ProcessDefinition[] processDefinitions;
  
  public DefaultJbpmSimulationModel(String processXml) {
    readFromXml( new String[] { processXml } );
  }
  
  public DefaultJbpmSimulationModel(String[] processXml) {
    readFromXml( processXml );
  }
  
  public DefaultJbpmSimulationModel(ProcessDefinition processDefinition) {
    this.processDefinitions = new ProcessDefinition[] {processDefinition};
  }

  public DefaultJbpmSimulationModel(ProcessDefinition[] processDefinitions) {
    this.processDefinitions = processDefinitions;
  }

  public ProcessDefinition[] getProcessDefinitions() {
    return processDefinitions;
  }
  
  private ProcessDefinition[] readFromXml(String[] processXml) {
    processDefinitions = new ProcessDefinition[processXml.length];
    for (int i = 0; i < processXml.length; i++) {
      SimulationJpdlXmlReader reader = new SimulationJpdlXmlReader(processXml[i]);
      processDefinitions[i] = reader.readProcessDefinition();
    }
    return processDefinitions;
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy