boolean onentryEventRaised = false;
for (OnEntry onentry : es.getOnEntries()) {
executeContent(exctx, onentry);
if (!onentryEventRaised && onentry.isRaiseEvent()) {
onentryEventRaised = true;
exctx.getInternalIOProcessor().addEvent(new TriggerEvent("entry.state."+es.getId(), TriggerEvent.CHANGE_EVENT));
}
}
exctx.getNotificationRegistry().fireOnEntry(es, es);
exctx.getNotificationRegistry().fireOnEntry(exctx.getStateMachine(), es);
if (es instanceof State && step.getDefaultEntrySet().contains(es) && ((State)es).getInitial() != null) {
executeContent(exctx, ((State)es).getInitial().getTransition());
}
if (es instanceof TransitionalState) {
SimpleTransition hTransition = step.getDefaultHistoryTransitions().get(es);
if (hTransition != null) {
executeContent(exctx, hTransition);
}
}
if (es instanceof Final) {
State parent = (State)es.getParent();
if (parent == null) {
exctx.stopRunning();
}
else {
exctx.getInternalIOProcessor().addEvent(new TriggerEvent("done.state."+parent.getId(),TriggerEvent.CHANGE_EVENT));
if (parent.isRegion()) {
if (configuration == null) {
// Note: configuration may 'grow' during enterStates, but activation works downwards
// so it doesn't matter for determining if the parallel children are already
// all in final state, or may become so further down (which at that time will
// trigger the parallel parent done event)
configuration = exctx.getScInstance().getCurrentStatus().getAllStates();
}
if (isInFinalState(parent.getParent(), configuration)) {
exctx.getInternalIOProcessor().addEvent(new TriggerEvent("done.state."+parent.getParent().getId()
, TriggerEvent.CHANGE_EVENT));
}
}
}
}