/** Execute the OPD using OPM execution semantics. */
  @Override
  protected void executing() {
    createLocalVariables();
    final Set<OPMProcess> initialProcesses = OPDExecutionAnalysis.calculateInitialProcesses(opdDag);

    for (OPMProcess process : initialProcesses)
      waitingInstances.add(createProcessInstance(process, process.getKind()));

    Preconditions.checkState(waitingInstances.size() > 0, "Did not find any process to execute.");

    while (!isStopped() && ((waitingInstances.size() > 0) || !executingInstances.isEmpty())) {
      tryToExecuteWaitingInstances();
      if (!executingInstances.isEmpty()) waitForInstanceToFinish();
    }
  }
Example #2
0
 public OPMObjectProcessDiagram createModel() {
   OPMObjectProcessDiagram opd = factory.createOPMObjectProcessDiagram();
   OPMObject object1 = factory.createOPMObject();
   object1.setName("O1");
   opd.getNodes().add(object1);
   OPMObject object2 = factory.createOPMObject();
   object2.setName("O2");
   opd.getNodes().add(object2);
   OPMProcess process = factory.createOPMProcess();
   process.setName("P1");
   opd.getNodes().add(process);
   OPMLink link = factory.createOPMAgentLink();
   link.setSource(object1);
   link.setTarget(process);
   opd.getLinks().add(link);
   return opd;
 }
 private void putProcessesInWaitingList(final Set<OPMProcess> processes) {
   for (OPMProcess process : processes) {
     OPMProcessInstance processInstance = createProcessInstance(process, process.getKind());
     waitingInstances.add(processInstance);
   }
 }