use of io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction in project automatiko-engine by automatiko-io.
the class ExecutableProcessFactory method linkBoundaryConditionEvent.
private void linkBoundaryConditionEvent(NodeContainer nodeContainer, Node node, String attachedTo, Node attachedNode) {
String processId = ((ExecutableProcess) nodeContainer).getId();
String eventType = "RuleFlowStateEvent-" + processId + "-" + ((EventNode) node).getUniqueId() + "-" + attachedTo;
((EventTypeFilter) ((EventNode) node).getEventFilters().get(0)).setType(eventType);
((ExtendedNodeImpl) attachedNode).setCondition(((EventNode) node).getCondition());
((ExtendedNodeImpl) attachedNode).setMetaData("ConditionEventType", eventType);
boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
if (cancelActivity) {
List<ProcessAction> actions = ((EventNode) node).getActions(EndNode.EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<ProcessAction>();
}
ConsequenceAction consequenceAction = new ConsequenceAction("java", "");
consequenceAction.setMetaData("Action", new CancelNodeInstanceAction(attachedTo));
actions.add(consequenceAction);
((EventNode) node).setActions(EndNode.EVENT_NODE_EXIT, actions);
}
}
use of io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction in project automatiko-engine by automatiko-io.
the class ExecutableProcessFactory method linkBoundaryErrorEvent.
private static void linkBoundaryErrorEvent(NodeContainer nodeContainer, Node node, String attachedTo, Node attachedNode) {
ContextContainer compositeNode = (ContextContainer) attachedNode;
ExceptionScope exceptionScope = (ExceptionScope) compositeNode.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
if (exceptionScope == null) {
exceptionScope = new ExceptionScope();
compositeNode.addContext(exceptionScope);
compositeNode.setDefaultContext(exceptionScope);
}
String errorCode = (String) node.getMetaData().get("ErrorEvent");
boolean hasErrorCode = (Boolean) node.getMetaData().get("HasErrorEvent");
String errorStructureRef = (String) node.getMetaData().get("ErrorStructureRef");
ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
String variable = ((EventNode) node).getVariableName();
ConsequenceAction action = new ConsequenceAction("java", null);
action.setMetaData(ACTION, new SignalProcessInstanceAction("Error-" + attachedTo + "-" + errorCode, variable, SignalProcessInstanceAction.PROCESS_INSTANCE_SCOPE));
exceptionHandler.setAction(action);
exceptionHandler.setFaultVariable(variable);
exceptionHandler.setRetryAfter((Integer) node.getMetaData().get("ErrorRetry"));
exceptionHandler.setRetryIncrement((Integer) node.getMetaData().get("ErrorRetryIncrement"));
if (node.getMetaData().get("ErrorRetryIncrementMultiplier") != null) {
exceptionHandler.setRetryIncrementMultiplier(((Number) node.getMetaData().get("ErrorRetryIncrementMultiplier")).floatValue());
}
exceptionHandler.setRetryLimit((Integer) node.getMetaData().get("ErrorRetryLimit"));
if (hasErrorCode) {
for (String error : errorCode.split(",")) {
exceptionScope.setExceptionHandler(error, exceptionHandler);
}
} else {
exceptionScope.setExceptionHandler(null, exceptionHandler);
}
if (errorStructureRef != null) {
exceptionScope.setExceptionHandler(errorStructureRef, exceptionHandler);
}
List<ProcessAction> actions = ((EventNode) node).getActions(EndNode.EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<ProcessAction>();
}
ConsequenceAction cancelAction = new ConsequenceAction("java", null);
cancelAction.setMetaData("Action", new CancelNodeInstanceAction(attachedTo));
actions.add(cancelAction);
((EventNode) node).setActions(EndNode.EVENT_NODE_EXIT, actions);
}
use of io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction in project automatiko-engine by automatiko-io.
the class ExecutableProcessFactory method linkBoundarySignalEvent.
protected void linkBoundarySignalEvent(Node node, String attachedTo) {
boolean cancelActivity = (Boolean) node.getMetaData().get(CANCEL_ACTIVITY);
if (cancelActivity) {
List<ProcessAction> actions = ((EventNode) node).getActions(EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<>();
}
ConsequenceAction action = new ConsequenceAction("java", null);
action.setMetaData(ACTION, new CancelNodeInstanceAction(attachedTo));
actions.add(action);
((EventNode) node).setActions(EVENT_NODE_EXIT, actions);
}
}
use of io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction in project automatiko-engine by automatiko-io.
the class ProcessHandler method linkBoundaryEscalationEvent.
protected void linkBoundaryEscalationEvent(NodeContainer nodeContainer, Node node, String attachedTo, Node attachedNode) {
boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
String escalationCode = (String) node.getMetaData().get("EscalationEvent");
String escalationStructureRef = (String) node.getMetaData().get("EscalationStructureRef");
ContextContainer compositeNode = (ContextContainer) attachedNode;
ExceptionScope exceptionScope = (ExceptionScope) compositeNode.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
if (exceptionScope == null) {
exceptionScope = new ExceptionScope();
compositeNode.addContext(exceptionScope);
compositeNode.setDefaultContext(exceptionScope);
}
String variable = ((EventNode) node).getVariableName();
ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
ConsequenceAction action = createJavaAction(new SignalProcessInstanceAction("Escalation-" + attachedTo + "-" + escalationCode, variable, SignalProcessInstanceAction.PROCESS_INSTANCE_SCOPE));
exceptionHandler.setAction(action);
exceptionHandler.setFaultVariable(variable);
exceptionScope.setExceptionHandler(escalationCode, exceptionHandler);
if (escalationStructureRef != null) {
exceptionScope.setExceptionHandler(escalationStructureRef, exceptionHandler);
}
if (cancelActivity) {
List<ProcessAction> actions = ((EventNode) node).getActions(EndNode.EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<ProcessAction>();
}
ConsequenceAction cancelAction = new ConsequenceAction("java", "");
cancelAction.setMetaData("Action", new CancelNodeInstanceAction(attachedTo));
actions.add(cancelAction);
((EventNode) node).setActions(EndNode.EVENT_NODE_EXIT, actions);
}
}
use of io.automatiko.engine.workflow.base.instance.impl.actions.CancelNodeInstanceAction in project automatiko-engine by automatiko-io.
the class ProcessHandler method linkBoundarySignalEvent.
protected void linkBoundarySignalEvent(NodeContainer nodeContainer, Node node, String attachedTo, Node attachedNode) {
boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
if (cancelActivity) {
List<ProcessAction> actions = ((EventNode) node).getActions(EndNode.EVENT_NODE_EXIT);
if (actions == null) {
actions = new ArrayList<ProcessAction>();
}
ConsequenceAction action = createJavaAction(new CancelNodeInstanceAction(attachedTo));
actions.add(action);
((EventNode) node).setActions(EndNode.EVENT_NODE_EXIT, actions);
}
}
Aggregations