use of io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl in project automatiko-engine by automatiko-io.
the class LightWorkItemManager method internalAbortWorkItem.
public void internalAbortWorkItem(WorkItem workItem) {
ProcessInstance processInstance = workItem.getProcessInstance();
((WorkItemImpl) workItem).setState(ABORTED);
// process instance may have finished already
if (processInstance != null) {
processInstance.signalEvent("workItemAborted", workItem);
}
workItems.remove(workItem.getId());
}
use of io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl in project automatiko-engine by automatiko-io.
the class HandleMessageAction method execute.
public void execute(ProcessContext context) throws Exception {
Object variable = VariableUtil.resolveVariable(variableName, context.getNodeInstance());
if (transformation != null) {
variable = new EventTransformerImpl(transformation).transformEvent(variable);
}
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("Send Task");
workItem.setNodeInstanceId(context.getNodeInstance().getId());
workItem.setProcessInstanceId(context.getProcessInstance().getId());
workItem.setProcessInstanceId(context.getProcessInstance().getParentProcessInstanceId());
workItem.setNodeId(context.getNodeInstance().getNodeId());
workItem.setParameter("MessageType", messageType);
if (variable != null) {
workItem.setParameter("Message", variable);
}
((DefaultWorkItemManager) context.getProcessRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);
}
use of io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl in project automatiko-engine by automatiko-io.
the class SignalProcessInstanceAction method execute.
public void execute(ProcessContext context) throws Exception {
String variableName = VariableUtil.resolveVariable(this.variableName, context.getNodeInstance());
Object variable = variableName == null ? eventDataSupplier.apply(context) : context.getVariable(variableName);
if (transformation != null) {
variable = new io.automatiko.engine.workflow.base.core.event.EventTransformerImpl(transformation).transformEvent(context.getProcessInstance().getVariables());
}
if (DEFAULT_SCOPE.equals(scope)) {
context.getProcessRuntime().signalEvent(VariableUtil.resolveVariable(signalName, context.getNodeInstance()), variable);
} else if (PROCESS_INSTANCE_SCOPE.equals(scope)) {
context.getProcessInstance().signalEvent(VariableUtil.resolveVariable(signalName, context.getNodeInstance()), variable);
} else if (EXTERNAL_SCOPE.equals(scope)) {
WorkItemImpl workItem = new WorkItemImpl();
workItem.setName("External Send Task");
workItem.setNodeInstanceId(context.getNodeInstance().getId());
workItem.setProcessInstanceId(context.getProcessInstance().getId());
workItem.setProcessInstanceId(context.getProcessInstance().getParentProcessInstanceId());
workItem.setNodeId(context.getNodeInstance().getNodeId());
workItem.setParameter("Signal", VariableUtil.resolveVariable(signalName, context.getNodeInstance()));
workItem.setParameter("SignalProcessInstanceId", context.getVariable("SignalProcessInstanceId"));
workItem.setParameter("SignalWorkItemId", context.getVariable("SignalWorkItemId"));
workItem.setParameter("SignalDeploymentId", context.getVariable("SignalDeploymentId"));
if (variable == null) {
workItem.setParameter("Data", variable);
}
((DefaultWorkItemManager) context.getProcessRuntime().getWorkItemManager()).internalExecuteWorkItem(workItem);
}
}
use of io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl in project automatiko-engine by automatiko-io.
the class LightWorkItemManager method failWorkItem.
@Override
public void failWorkItem(String id, Throwable error) {
WorkItemImpl workItem = (WorkItemImpl) workItems.get(id);
// work item may have been aborted
if (workItem != null) {
ProcessInstance processInstance = workItem.getProcessInstance();
workItem.setState(FAILED);
// process instance may have finished already
if (processInstance != null) {
workItem.setResult("Error", error);
processInstance.signalEvent("workItemFailed", workItem);
}
workItems.remove(id);
}
}
use of io.automatiko.engine.workflow.base.instance.impl.workitem.WorkItemImpl in project automatiko-engine by automatiko-io.
the class LightWorkItemManager method retryWorkItemWithParams.
public void retryWorkItemWithParams(String workItemId, Map<String, Object> map) {
WorkItem workItem = workItems.get(workItemId);
if (workItem != null) {
((WorkItemImpl) workItem).setParameters(map);
retryWorkItem(workItem);
}
}
Aggregations