use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction in project automatiko-engine by automatiko-io.
the class AbstractNodeHandler method extractAction.
public static ProcessAction extractAction(Element xmlNode) {
String actionType = xmlNode.getAttribute("type");
if ("expression".equals(actionType)) {
String consequence = xmlNode.getTextContent();
ConsequenceAction action = new ConsequenceAction(xmlNode.getAttribute("dialect"), consequence);
return action;
} else {
throw new IllegalArgumentException("Unknown action type " + actionType);
}
}
use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction in project automatiko-engine by automatiko-io.
the class ActionNodeHandler method writeNode.
public void writeNode(Node node, StringBuilder xmlDump, boolean includeMeta) {
ActionNode actionNode = (ActionNode) node;
writeNode("actionNode", actionNode, xmlDump, includeMeta);
ConsequenceAction action = (ConsequenceAction) actionNode.getAction();
if (action != null || (includeMeta && containsMetaData(actionNode))) {
xmlDump.append(">" + EOL);
if (action != null) {
writeAction(action, xmlDump);
}
if (includeMeta) {
writeMetaData(actionNode, xmlDump);
}
endNode("actionNode", xmlDump);
} else {
endNode(xmlDump);
}
}
use of io.automatiko.engine.workflow.process.core.impl.ConsequenceAction 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.process.core.impl.ConsequenceAction 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.process.core.impl.ConsequenceAction 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);
}
}
Aggregations