use of io.automatiko.engine.workflow.process.core.impl.ExtendedNodeImpl 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.ExtendedNodeImpl in project automatiko-engine by automatiko-io.
the class ProcessHandler method handleIntermediateOrEndThrowCompensationEvent.
protected void handleIntermediateOrEndThrowCompensationEvent(ExtendedNodeImpl throwEventNode) {
if (throwEventNode.getMetaData("compensation-activityRef") != null) {
String activityRef = (String) throwEventNode.getMetaData().remove("compensation-activityRef");
NodeContainer nodeParent = (NodeContainer) throwEventNode.getParentContainer();
if (nodeParent instanceof EventSubProcessNode) {
boolean compensationEventSubProcess = false;
List<Trigger> startTriggers = ((EventSubProcessNode) nodeParent).findStartNode().getTriggers();
CESP_CHECK: for (Trigger trigger : startTriggers) {
if (trigger instanceof EventTrigger) {
for (EventFilter filter : ((EventTrigger) trigger).getEventFilters()) {
if (((EventTypeFilter) filter).getType().equals("Compensation")) {
compensationEventSubProcess = true;
break CESP_CHECK;
}
}
}
}
if (compensationEventSubProcess) {
// BPMN2 spec, p. 252, p. 248: intermediate and end compensation event
// visibility scope
nodeParent = (NodeContainer) ((NodeImpl) nodeParent).getParentContainer();
}
}
String parentId;
if (nodeParent instanceof ExecutableProcess) {
parentId = ((ExecutableProcess) nodeParent).getId();
} else {
parentId = (String) ((NodeImpl) nodeParent).getMetaData("UniqueId");
}
String compensationEvent;
if (activityRef.length() == 0) {
// general/implicit compensation
compensationEvent = CompensationScope.IMPLICIT_COMPENSATION_PREFIX + parentId;
} else {
// specific compensation
compensationEvent = activityRef;
}
throwEventNode.setMetaData("CompensationEvent", compensationEvent);
ConsequenceAction compensationAction = new ConsequenceAction("java", "");
compensationAction.setMetaData("Action", new ProcessInstanceCompensationAction(compensationEvent));
if (throwEventNode instanceof ActionNode) {
((ActionNode) throwEventNode).setAction(compensationAction);
} else if (throwEventNode instanceof EndNode) {
List<ProcessAction> actions = new ArrayList<ProcessAction>();
actions.add(compensationAction);
((EndNode) throwEventNode).setActions(EndNode.EVENT_NODE_ENTER, actions);
}
throwEventNode.setMetaData("TriggerType", "Compensation");
}
}
use of io.automatiko.engine.workflow.process.core.impl.ExtendedNodeImpl in project automatiko-engine by automatiko-io.
the class ExtendedNodeInstanceImpl method triggerEvent.
protected void triggerEvent(String type) {
ExtendedNodeImpl extendedNode = getExtendedNode();
if (extendedNode == null) {
return;
}
List<ProcessAction> actions = extendedNode.getActions(type);
if (actions != null) {
for (ProcessAction processAction : actions) {
Action action = (Action) processAction.getMetaData(ACTION);
executeAction(action);
}
}
}
Aggregations