Get the type of the start event

Dear Camunda Community,
i would like to search a BPMN model for all none start events.
For this I first get all start events via modelInstance.getModelElementsByType(StartEvent.class).
But how can I now determine what kind of start event it is? (None, Message, Signal, etc.)

Thanks alot :slight_smile:

Hi @ThomasWolff,

The differentiator here is the attached event definition so none start event has no event definition attached whereas timer start event has timer event definition attached and so on.

EventDefinition eventDefinition;
StartEvent startEvent = (StartEvent) .....;
if (startEvent.getEventDefinitions() != null && startEvent.getEventDefinitions().size() > 0) {

	eventDefinition = startEvent.getEventDefinitions().iterator().next();
	if (eventDefinition instanceof TimerEventDefinition) {
		// timer start event
	} else if (eventDefinition instanceof MessageEventDefinition) {
		// message start event
	} else if (eventDefinition instanceof SignalEventDefinition) {
		// signal start event
	} else if (eventDefinition instanceof ConditionalEventDefinition) {
		// conditional start event
	}
	
} else {
	// none start event
}