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);
}
}
Aggregations