Package org.activiti.crystalball.simulator

Examples of org.activiti.crystalball.simulator.SimulationEvent$Factory


    this.variablesKey = variablesKey;
  }

  @Override
  public void init() {
    SimulationEvent toReplayStartEvent = findProcessInstanceStartEvent();
    SimulationEvent startEvent = new SimulationEvent.Builder(eventTypeToSchedule).
                properties(toReplayStartEvent.getProperties()).
                build();
    // add start process event
    SimulationRunContext.getEventCalendar().addEvent(startEvent);
  }
View Full Code Here


  @Override
  public void init() {
        log.info(jobExecutor.getName() + " starting to acquire jobs");
        jobExecutor.start();

    SimulationEvent event = new SimulationEvent.Builder(SimulationEvent.TYPE_ACQUIRE_JOB_NOTIFICATION_EVENT).
      simulationTime(SimulationRunContext.getClock().getCurrentTime().getTime()).
      property(((SimulationDefaultJobExecutor) jobExecutor).getAcquireJobsRunnable()).
      build();
    SimulationRunContext.getEventCalendar().addEvent(event);
       
View Full Code Here

              log.trace("job acquisition thread sleeping for " + millisToWait + " millis");
              synchronized (MONITOR) {
                if(!isInterrupted) {
                  isWaiting.set(true);

                  SimulationEvent event = new SimulationEvent.Builder(SimulationEvent.TYPE_ACQUIRE_JOB_NOTIFICATION_EVENT).
                    simulationTime(SimulationRunContext.getClock().getCurrentTime().getTime() + millisToWait).
                    property(this).
                    build();
                  SimulationRunContext.getEventCalendar().addEvent(event);
                  // do not need to wait. - event scheduling is enough
                  //MONITOR.wait(millisToWait);
                }
              }
                           
              log.trace("job acquisition thread woke up");
            } finally {
//              isWaiting.set(false);
            }
          } else {
            // schedule run now
            SimulationEvent event = new SimulationEvent.Builder(SimulationEvent.TYPE_ACQUIRE_JOB_NOTIFICATION_EVENT).
              simulationTime(SimulationRunContext.getClock().getCurrentTime().getTime()).
              property(this).
              build();
            SimulationRunContext.getEventCalendar().addEvent(event);
          }
View Full Code Here

          // ensures we only notify once
          // I am OK with the race condition     
          synchronized (MONITOR) {
//            MONITOR.notifyAll();
          //Notify is not needed - event is enough
            SimulationEvent event = new SimulationEvent.Builder(SimulationEvent.TYPE_ACQUIRE_JOB_NOTIFICATION_EVENT).
              simulationTime(SimulationRunContext.getClock().getCurrentTime().getTime()).
              property(this).
              build();
            SimulationRunContext.getEventCalendar().addEvent(event);
          }
View Full Code Here

    this.events = events;
  }

  @Override
  public void notify(DelegateTask delegateTask) {
    SimulationEvent eventToSimulate = findUserTaskCompleteEvent(delegateTask);
    if (eventToSimulate != null) {
      Map<String, Object> properties = new HashMap<String, Object>();
      properties.put("taskId", delegateTask.getId());
      properties.put("variables", eventToSimulate.getProperty(UserTaskCompleteTransformer.TASK_VARIABLES));
      // we were able to resolve event to simulate automatically
      SimulationEvent e = new SimulationEvent.Builder(typeToCreate).
                          properties(properties).
                          build();
      SimulationRunContext.getEventCalendar().addEvent(e);
    }
  }
View Full Code Here

    return simulationEvents;
  }
  protected Collection<SimulationEvent> transformEntry(EventLogEntry event) {
    List<SimulationEvent> simEvents = new ArrayList<SimulationEvent>();
    for (Function<EventLogEntry, SimulationEvent> t : transformers) {
      SimulationEvent simEvent = t.apply(event);
      if (simEvent != null)
        simEvents.add(simEvent);
    }
    return simEvents;
  }
View Full Code Here

  protected abstract void store(Collection<SimulationEvent> simulationEvents);

  protected Collection<SimulationEvent> transform(ActivitiEvent event) {
    List<SimulationEvent> simEvents = new ArrayList<SimulationEvent>();
    for (Function<ActivitiEvent, SimulationEvent> t : transformers) {
      SimulationEvent simEvent = t.apply(event);
      if (simEvent != null)
        simEvents.add(simEvent);
    }
    return simEvents;
  }
View Full Code Here

TOP

Related Classes of org.activiti.crystalball.simulator.SimulationEvent$Factory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.