Search in sources :

Example 1 with MigratingEventSubscriptionInstance

use of org.camunda.bpm.engine.impl.migration.instance.MigratingEventSubscriptionInstance in project camunda-bpm-platform by camunda.

the class EventSubscriptionInstanceHandler method handle.

@Override
public void handle(MigratingInstanceParseContext parseContext, MigratingActivityInstance owningInstance, List<EventSubscriptionEntity> elements) {
    Map<String, EventSubscriptionDeclaration> targetDeclarations = getDeclarationsByTriggeringActivity(owningInstance.getTargetScope());
    for (EventSubscriptionEntity eventSubscription : elements) {
        if (!getSupportedEventTypes().contains(eventSubscription.getEventType())) {
            // ignore unsupported event subscriptions
            continue;
        }
        MigrationInstruction migrationInstruction = parseContext.findSingleMigrationInstruction(eventSubscription.getActivityId());
        ActivityImpl targetActivity = parseContext.getTargetActivity(migrationInstruction);
        if (targetActivity != null && owningInstance.migratesTo(targetActivity.getEventScope())) {
            // the event subscription is migrated
            EventSubscriptionDeclaration targetDeclaration = targetDeclarations.remove(targetActivity.getId());
            owningInstance.addMigratingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription, targetActivity, migrationInstruction.isUpdateEventTrigger(), targetDeclaration));
        } else {
            // the event subscription will be removed
            owningInstance.addRemovingDependentInstance(new MigratingEventSubscriptionInstance(eventSubscription));
        }
        parseContext.consume(eventSubscription);
    }
    if (owningInstance.migrates()) {
        addEmergingEventSubscriptions(owningInstance, targetDeclarations);
    }
}
Also used : MigratingEventSubscriptionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingEventSubscriptionInstance) ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) MigrationInstruction(org.camunda.bpm.engine.migration.MigrationInstruction) EventSubscriptionDeclaration(org.camunda.bpm.engine.impl.bpmn.parser.EventSubscriptionDeclaration) EventSubscriptionEntity(org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)

Aggregations

EventSubscriptionDeclaration (org.camunda.bpm.engine.impl.bpmn.parser.EventSubscriptionDeclaration)1 MigratingEventSubscriptionInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingEventSubscriptionInstance)1 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)1 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)1 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)1