use of io.automatiko.engine.api.jobs.JobsService in project automatiko-engine by automatiko-io.
the class StateBasedNodeInstance method cancelSlaTimer.
private void cancelSlaTimer() {
if (this.slaTimerId != null && !this.slaTimerId.trim().isEmpty()) {
JobsService jobService = getProcessInstance().getProcessRuntime().getJobsService();
jobService.cancelJob(this.slaTimerId);
logger.debug("SLA Timer {} has been canceled", this.slaTimerId);
}
}
use of io.automatiko.engine.api.jobs.JobsService in project automatiko-engine by automatiko-io.
the class StateBasedNodeInstance method internalTrigger.
@Override
public void internalTrigger(NodeInstance from, String type) {
super.internalTrigger(from, type);
// if node instance was cancelled, abort
if (getNodeInstanceContainer().getNodeInstance(getId()) == null) {
return;
}
addCompletionListeners();
// activate timers
Map<Timer, ProcessAction> timers = getEventBasedNode().getTimers();
if (timers != null) {
addTimerListener();
timerInstances = new ArrayList<>(timers.size());
JobsService jobService = getProcessInstance().getProcessRuntime().getJobsService();
for (Timer timer : timers.keySet()) {
ExpirationTime expirationTime = createTimerInstance(timer);
String jobId = jobService.scheduleProcessInstanceJob(ProcessInstanceJobDescription.of(timer.getId(), expirationTime, getProcessInstanceIdWithParent(), getProcessInstance().getRootProcessInstanceId(), getProcessInstance().getProcessId(), getProcessInstance().getProcess().getVersion(), getProcessInstance().getRootProcessId()));
timerInstances.add(jobId);
}
}
((WorkflowProcessInstanceImpl) getProcessInstance()).addActivatingNodeId((String) getNode().getMetaData().get("UniqueId"));
if (getExtendedNode().hasCondition()) {
ProcessContext context = new ProcessContext(getProcessInstance().getProcessRuntime());
context.setProcessInstance(getProcessInstance());
if (getExtendedNode().getMetaData("ConditionEventType") != null && getExtendedNode().isMet(context)) {
getProcessInstance().signalEvent((String) getExtendedNode().getMetaData("ConditionEventType"), null);
} else {
getProcessInstance().addEventListener("variableChanged", this, false);
}
}
}
Aggregations