Search in sources :

Example 6 with NoStartNodeException

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();
}
Also used : MultipleStartNodesException(de.hpi.bpt.scylla.model.process.graph.exception.MultipleStartNodesException) NoStartNodeException(de.hpi.bpt.scylla.model.process.graph.exception.NoStartNodeException)

Aggregations

MultipleStartNodesException (de.hpi.bpt.scylla.model.process.graph.exception.MultipleStartNodesException)6 NoStartNodeException (de.hpi.bpt.scylla.model.process.graph.exception.NoStartNodeException)6 ProcessModel (de.hpi.bpt.scylla.model.process.ProcessModel)5 NodeNotFoundException (de.hpi.bpt.scylla.model.process.graph.exception.NodeNotFoundException)5 ProcessSimulationComponents (de.hpi.bpt.scylla.simulation.ProcessSimulationComponents)4 SimulationModel (de.hpi.bpt.scylla.simulation.SimulationModel)4 ProcessInstance (de.hpi.bpt.scylla.simulation.ProcessInstance)3 TimeInstant (desmoj.core.simulator.TimeInstant)3 TimeSpan (desmoj.core.simulator.TimeSpan)3 ScyllaRuntimeException (de.hpi.bpt.scylla.exception.ScyllaRuntimeException)2 BPMNStartEvent (de.hpi.bpt.scylla.simulation.event.BPMNStartEvent)2 ScyllaEvent (de.hpi.bpt.scylla.simulation.event.ScyllaEvent)2 TimeUnit (java.util.concurrent.TimeUnit)2 ScyllaValidationException (de.hpi.bpt.scylla.exception.ScyllaValidationException)1 EventDefinitionType (de.hpi.bpt.scylla.model.process.node.EventDefinitionType)1 MessageFlow (de.hpi.bpt.scylla.model.process.node.MessageFlow)1 TaskBeginEvent (de.hpi.bpt.scylla.simulation.event.TaskBeginEvent)1 TaskTerminateEvent (de.hpi.bpt.scylla.simulation.event.TaskTerminateEvent)1 Duration (java.time.Duration)1 Map (java.util.Map)1