use of org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance 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);
}
use of org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance in project camunda-bpm-platform by camunda.
the class IncidentInstanceHandler method handleIncident.
protected void handleIncident(MigratingInstanceParseContext parseContext, IncidentEntity incident) {
MigratingActivityInstance owningInstance = parseContext.getMigratingActivityInstanceById(incident.getExecution().getActivityInstanceId());
if (owningInstance != null) {
parseContext.consume(incident);
MigratingIncident migratingIncident = new MigratingIncident(incident, owningInstance.getTargetScope());
owningInstance.addMigratingDependentInstance(migratingIncident);
}
}
use of org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance in project camunda-bpm-platform by camunda.
the class DefaultHistoryEventProducer method initActivityInstanceEvent.
protected void initActivityInstanceEvent(HistoricActivityInstanceEventEntity evt, MigratingActivityInstance migratingActivityInstance, HistoryEventType eventType) {
PvmScope eventSource = migratingActivityInstance.getTargetScope();
String activityInstanceId = migratingActivityInstance.getActivityInstanceId();
MigratingActivityInstance parentInstance = migratingActivityInstance.getParent();
String parentActivityInstanceId = null;
if (parentInstance != null) {
parentActivityInstanceId = parentInstance.getActivityInstanceId();
}
ExecutionEntity execution = migratingActivityInstance.resolveRepresentativeExecution();
initActivityInstanceEvent(evt, execution, eventSource, activityInstanceId, parentActivityInstanceId, eventType);
}
use of org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance in project camunda-bpm-platform by camunda.
the class CompensationEventSubscriptionWalker method collectCompensationEventSubscriptions.
protected static List<EventSubscriptionEntity> collectCompensationEventSubscriptions(Collection<MigratingActivityInstance> activityInstances) {
List<EventSubscriptionEntity> eventSubscriptions = new ArrayList<EventSubscriptionEntity>();
for (MigratingActivityInstance activityInstance : activityInstances) {
if (activityInstance.getSourceScope().isScope()) {
ExecutionEntity scopeExecution = activityInstance.resolveRepresentativeExecution();
eventSubscriptions.addAll(scopeExecution.getCompensateEventSubscriptions());
}
}
return eventSubscriptions;
}
use of org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance in project camunda-bpm-platform by camunda.
the class TransitionInstanceHandler method handle.
@Override
public void handle(MigratingInstanceParseContext parseContext, TransitionInstance transitionInstance) {
if (!isAsyncTransitionInstance(transitionInstance)) {
return;
}
MigrationInstruction applyingInstruction = parseContext.getInstructionFor(transitionInstance.getActivityId());
ScopeImpl sourceScope = parseContext.getSourceProcessDefinition().findActivity(transitionInstance.getActivityId());
ScopeImpl targetScope = null;
if (applyingInstruction != null) {
String activityId = applyingInstruction.getTargetActivityId();
targetScope = parseContext.getTargetProcessDefinition().findActivity(activityId);
}
ExecutionEntity asyncExecution = Context.getCommandContext().getExecutionManager().findExecutionById(transitionInstance.getExecutionId());
MigratingTransitionInstance migratingTransitionInstance = parseContext.getMigratingProcessInstance().addTransitionInstance(applyingInstruction, transitionInstance, sourceScope, targetScope, asyncExecution);
MigratingActivityInstance parentInstance = parseContext.getMigratingActivityInstanceById(transitionInstance.getParentActivityInstanceId());
migratingTransitionInstance.setParent(parentInstance);
List<JobEntity> jobs = asyncExecution.getJobs();
parseContext.handleDependentTransitionInstanceJobs(migratingTransitionInstance, jobs);
parseContext.handleDependentVariables(migratingTransitionInstance, collectTransitionInstanceVariables(migratingTransitionInstance));
}
Aggregations