use of de.hpi.bpt.scylla.model.process.graph.exception.NoStartNodeException in project scylla by bptlab.
the class ProcessModel method getStartNode.
/**
* Returns start node of the process model (i.e. which does not have any predecessors).
*
* @return graph node id of start node
* @throws NodeNotFoundException
* @throws MultipleStartNodesException
* @throws NoStartNodeException
*/
public Integer getStartNode() throws NodeNotFoundException, MultipleStartNodesException, NoStartNodeException {
Set<Integer> nodesWithoutSource = graph.getNodesWithoutSource();
Set<Integer> boundaryEventIds = getBoundaryEventIds();
nodesWithoutSource.removeAll(boundaryEventIds);
if (nodesWithoutSource.size() > 1) {
throw new MultipleStartNodesException("Multiple start nodes found for process " + id);
} else if (nodesWithoutSource.size() == 0) {
throw new NoStartNodeException("No start node found for process " + id);
}
return nodesWithoutSource.iterator().next();
}
Aggregations