use of org.camunda.bpm.engine.impl.pvm.delegate.MigrationObserverBehavior in project camunda-bpm-platform by camunda.
the class ActivityInstanceHandler method handle.
@Override
public void handle(MigratingInstanceParseContext parseContext, ActivityInstance element) {
MigratingActivityInstance migratingInstance = null;
MigrationInstruction applyingInstruction = parseContext.getInstructionFor(element.getActivityId());
ScopeImpl sourceScope = null;
ScopeImpl targetScope = null;
ExecutionEntity representativeExecution = parseContext.getMapping().getExecution(element);
if (element.getId().equals(element.getProcessInstanceId())) {
sourceScope = parseContext.getSourceProcessDefinition();
targetScope = parseContext.getTargetProcessDefinition();
} else {
sourceScope = parseContext.getSourceProcessDefinition().findActivity(element.getActivityId());
if (applyingInstruction != null) {
String activityId = applyingInstruction.getTargetActivityId();
targetScope = parseContext.getTargetProcessDefinition().findActivity(activityId);
}
}
migratingInstance = parseContext.getMigratingProcessInstance().addActivityInstance(applyingInstruction, element, sourceScope, targetScope, representativeExecution);
MigratingActivityInstance parentInstance = parseContext.getMigratingActivityInstanceById(element.getParentActivityInstanceId());
if (parentInstance != null) {
migratingInstance.setParent(parentInstance);
}
CoreActivityBehavior<?> sourceActivityBehavior = sourceScope.getActivityBehavior();
if (sourceActivityBehavior instanceof MigrationObserverBehavior) {
((MigrationObserverBehavior) sourceActivityBehavior).onParseMigratingInstance(parseContext, migratingInstance);
}
parseContext.submit(migratingInstance);
parseTransitionInstances(parseContext, migratingInstance);
parseDependentInstances(parseContext, migratingInstance);
}
Aggregations