use of io.automatiko.engine.workflow.base.instance.InternalProcessRuntime in project automatiko-engine by automatiko-io.
the class SubProcessNodeInstance method cancel.
@Override
public void cancel() {
super.cancel();
if (getSubProcessNode() == null || !getSubProcessNode().isIndependent()) {
ProcessInstance processInstance = null;
InternalProcessRuntime kruntime = ((ProcessInstance) getProcessInstance()).getProcessRuntime();
processInstance = (ProcessInstance) kruntime.getProcessInstance(processInstanceId);
if (processInstance != null) {
processInstance.setState(ProcessInstance.STATE_ABORTED);
}
}
}
use of io.automatiko.engine.workflow.base.instance.InternalProcessRuntime in project automatiko-engine by automatiko-io.
the class TimerNodeInstance method triggerCompleted.
public void triggerCompleted(boolean remove) {
if (remove) {
removeEventListeners();
InternalProcessRuntime processRuntime = ((InternalProcessRuntime) getProcessInstance().getProcessRuntime());
processRuntime.getUnitOfWorkManager().currentUnitOfWork().intercept(WorkUnit.create(timerId, e -> {
processRuntime.getJobsService().cancelJob(timerId);
}));
}
internalChangeState(NodeInstanceState.Occur);
triggerCompleted(io.automatiko.engine.workflow.process.core.Node.CONNECTION_DEFAULT_TYPE, remove);
}
use of io.automatiko.engine.workflow.base.instance.InternalProcessRuntime in project automatiko-engine by automatiko-io.
the class EventNodeInstance method handleSLAViolation.
protected void handleSLAViolation() {
if (slaCompliance == ProcessInstance.SLA_PENDING) {
InternalProcessRuntime processRuntime = getProcessInstance().getProcessRuntime();
processRuntime.getProcessEventSupport().fireBeforeSLAViolated(getProcessInstance(), this, getProcessInstance().getProcessRuntime());
logger.debug("SLA violated on node instance {}", getId());
this.slaCompliance = ProcessInstance.SLA_VIOLATED;
this.slaTimerId = null;
processRuntime.getProcessEventSupport().fireAfterSLAViolated(getProcessInstance(), this, getProcessInstance().getProcessRuntime());
}
}
use of io.automatiko.engine.workflow.base.instance.InternalProcessRuntime in project automatiko-engine by automatiko-io.
the class NodeInstanceImpl method triggerNodeInstance.
protected void triggerNodeInstance(io.automatiko.engine.workflow.process.instance.NodeInstance nodeInstance, String type, boolean fireEvents) {
if (nodeInstance == null) {
return;
}
leaveTime = new Date();
boolean hidden = false;
if (getNode().getMetaData().get(HIDDEN) != null) {
hidden = true;
}
InternalProcessRuntime runtime = getProcessInstance().getProcessRuntime();
if (!hidden && fireEvents) {
runtime.getProcessEventSupport().fireBeforeNodeLeft(this, runtime);
}
// trigger next node
nodeInstance.trigger(this, type);
Collection<Connection> outgoing = getNode().getOutgoingConnections(type);
for (Connection conn : outgoing) {
if (conn.getTo().getId() == nodeInstance.getNodeId()) {
this.metaData.put(OUTGOING_CONNECTION, conn.getMetaData().get(UNIQUE_ID));
break;
}
}
if (!hidden && fireEvents) {
runtime.getProcessEventSupport().fireAfterNodeLeft(this, runtime);
}
}
use of io.automatiko.engine.workflow.base.instance.InternalProcessRuntime in project automatiko-engine by automatiko-io.
the class WorkflowProcessInstanceImpl method handleSLAViolation.
private void handleSLAViolation() {
if (slaCompliance == SLA_PENDING) {
InternalProcessRuntime processRuntime = getProcessRuntime();
processRuntime.getProcessEventSupport().fireBeforeSLAViolated(this, processRuntime);
logger.debug("SLA violated on process instance {}", getId());
this.slaCompliance = SLA_VIOLATED;
this.slaTimerId = null;
processRuntime.getProcessEventSupport().fireAfterSLAViolated(this, processRuntime);
}
}
Aggregations