public EventSubscriptionEntity createSubscriptionForExecution ( ExecutionEntity execution ) { EventSubscriptionEntity eventSubscriptionEntity = new EventSubscriptionEntity ( execution , eventType ) ; String eventName = resolveExpressionOfEventName ( execution ) ; eventSubscriptionEntity . setEventName ( eventName ) ; if ( activityId != null ) { ActivityImpl activity = execution . getProcessDefinition ( ) . findActivity ( activityId ) ; eventSubscriptionEntity . setActivity ( activity ) ; } eventSubscriptionEntity . insert ( ) ; LegacyBehavior . removeLegacySubscriptionOnParent ( execution , eventSubscriptionEntity ) ; return eventSubscriptionEntity ; }
Creates and inserts a subscription entity depending on the message type of this declaration .