use of org.jbpm.kie.services.impl.admin.TimerInstanceImpl in project jbpm by kiegroup.
the class ListTimersCommand method buildTimer.
private TimerInstanceImpl buildTimer(org.jbpm.process.instance.timer.TimerInstance timerInstance) {
TimerInstanceImpl timer = new TimerInstanceImpl();
if (timerInstance != null) {
timer.setActivationTime(timerInstance.getActivated());
timer.setLastFireTime(timerInstance.getLastTriggered());
timer.setNextFireTime(new Date(timerInstance.getActivated().getTime() + timerInstance.getDelay()));
timer.setDelay(timerInstance.getDelay());
timer.setPeriod(timerInstance.getPeriod());
timer.setRepeatLimit(timerInstance.getRepeatLimit());
timer.setTimerId(timerInstance.getId());
timer.setProcessInstanceId(timerInstance.getProcessInstanceId());
timer.setSessionId(timerInstance.getSessionId());
}
return timer;
}
use of org.jbpm.kie.services.impl.admin.TimerInstanceImpl in project jbpm by kiegroup.
the class ListTimersCommand method processNodeInstance.
protected void processNodeInstance(TimerManager tm, NodeInstanceContainer container, List<TimerInstance> timers) {
for (NodeInstance nodeInstance : container.getNodeInstances()) {
if (nodeInstance instanceof TimerNodeInstance) {
TimerNodeInstance tni = (TimerNodeInstance) nodeInstance;
org.jbpm.process.instance.timer.TimerInstance timer = tm.getTimerMap().get(tni.getTimerId());
TimerInstanceImpl details = buildTimer(timer);
details.setTimerName(resolveVariable(tni.getNodeName(), tni));
timers.add(details);
} else if (nodeInstance instanceof StateBasedNodeInstance) {
StateBasedNodeInstance sbni = (StateBasedNodeInstance) nodeInstance;
List<Long> timerList = sbni.getTimerInstances();
if (timerList != null) {
for (Long timerId : timerList) {
org.jbpm.process.instance.timer.TimerInstance timer = tm.getTimerMap().get(timerId);
TimerInstanceImpl details = buildTimer(timer);
details.setTimerName(resolveVariable(sbni.getNodeName(), sbni));
timers.add(details);
}
}
}
if (nodeInstance instanceof NodeInstanceContainer) {
processNodeInstance(tm, (NodeInstanceContainer) nodeInstance, timers);
}
}
}
Aggregations