use of io.automatiko.engine.workflow.process.core.node.CompositeNode in project automatiko-engine by automatiko-io.
the class ExecutableProcessValidator method checkAllNodesConnectedToStart.
private void checkAllNodesConnectedToStart(final NodeContainer container, boolean isDynamic, final List<ProcessValidationError> errors, ExecutableProcess process) {
final Map<Node, Boolean> processNodes = new HashMap<>();
final Node[] nodes;
if (container instanceof CompositeNode) {
nodes = ((CompositeNode) container).internalGetNodes();
} else {
nodes = container.getNodes();
}
List<Node> eventNodes = new ArrayList<>();
List<CompositeNode> compositeNodes = new ArrayList<>();
for (int i = 0; i < nodes.length; i++) {
final Node node = nodes[i];
processNodes.put(node, Boolean.FALSE);
if (node instanceof EventNode) {
eventNodes.add(node);
}
if (node instanceof CompositeNode) {
compositeNodes.add((CompositeNode) node);
}
}
if (isDynamic) {
for (Node node : nodes) {
if (node.getIncomingConnections(io.automatiko.engine.workflow.process.core.Node.CONNECTION_DEFAULT_TYPE).isEmpty()) {
processNode(node, processNodes);
}
}
} else {
final List<Node> start = ExecutableProcess.getStartNodes(nodes);
if (start != null) {
for (Node s : start) {
processNode(s, processNodes);
}
}
if (container instanceof CompositeNode) {
for (CompositeNode.NodeAndType nodeAndTypes : ((CompositeNode) container).getLinkedIncomingNodes().values()) {
processNode(nodeAndTypes.getNode(), processNodes);
}
}
}
for (Node eventNode : eventNodes) {
processNode(eventNode, processNodes);
}
for (CompositeNode compositeNode : compositeNodes) {
checkAllNodesConnectedToStart(compositeNode, compositeNode instanceof DynamicNode, errors, process);
}
for (final Iterator<Node> it = processNodes.keySet().iterator(); it.hasNext(); ) {
final Node node = it.next();
if (Boolean.FALSE.equals(processNodes.get(node)) && !(node instanceof StartNode) && !(node instanceof EventSubProcessNode)) {
addErrorMessage(process, node, errors, "Has no connection to the start node.");
}
}
}
use of io.automatiko.engine.workflow.process.core.node.CompositeNode in project automatiko-engine by automatiko-io.
the class ExecutableProcessFactory method linkBoundaryEvents.
protected void linkBoundaryEvents(NodeContainer nodeContainer) {
for (Node node : nodeContainer.getNodes()) {
if (node instanceof CompositeNode) {
CompositeNode compositeNode = (CompositeNode) node;
linkBoundaryEvents(compositeNode.getNodeContainer());
}
if (node instanceof EventNode) {
final String attachedTo = (String) node.getMetaData().get(ATTACHED_TO);
if (attachedTo != null) {
Node attachedNode = findNodeByIdOrUniqueIdInMetadata(nodeContainer, attachedTo, "Could not find node to attach to: " + attachedTo);
for (EventFilter filter : ((EventNode) node).getEventFilters()) {
String type = ((EventTypeFilter) filter).getType();
if (type.startsWith("Timer-")) {
linkBoundaryTimerEvent(node, attachedTo, attachedNode);
} else if (node.getMetaData().get(SIGNAL_NAME) != null || type.startsWith("Message-")) {
linkBoundarySignalEvent(node, attachedTo);
} else if (type.startsWith("Error-")) {
linkBoundaryErrorEvent(nodeContainer, node, attachedTo, attachedNode);
} else if (type.startsWith("Condition-") || type.startsWith("RuleFlowStateEvent-")) {
linkBoundaryConditionEvent(nodeContainer, node, attachedTo, attachedNode);
} else if (type.startsWith("Compensation")) {
addCompensationScope(getExecutableProcess(), node, nodeContainer, attachedTo);
}
}
}
}
}
}
Aggregations