use of org.camunda.bpm.engine.impl.migration.instance.MigratingEventScopeInstance in project camunda-bpm-platform by camunda.
the class CompensationInstanceHandler method createMigratingEventScopeInstance.
protected MigratingProcessElementInstance createMigratingEventScopeInstance(MigratingInstanceParseContext parseContext, EventSubscriptionEntity element) {
ActivityImpl compensatingActivity = parseContext.getSourceProcessDefinition().findActivity(element.getActivityId());
MigrationInstruction migrationInstruction = getMigrationInstruction(parseContext, compensatingActivity);
ActivityImpl eventSubscriptionTargetScope = null;
if (migrationInstruction != null) {
if (compensatingActivity.isCompensationHandler()) {
ActivityImpl targetEventScope = (ActivityImpl) parseContext.getTargetActivity(migrationInstruction).getEventScope();
eventSubscriptionTargetScope = targetEventScope.findCompensationHandler();
} else {
eventSubscriptionTargetScope = parseContext.getTargetActivity(migrationInstruction);
}
}
ExecutionEntity eventScopeExecution = CompensationUtil.getCompensatingExecution(element);
MigrationInstruction eventScopeInstruction = parseContext.findSingleMigrationInstruction(eventScopeExecution.getActivityId());
ActivityImpl targetScope = parseContext.getTargetActivity(eventScopeInstruction);
MigratingEventScopeInstance migratingCompensationInstance = parseContext.getMigratingProcessInstance().addEventScopeInstance(eventScopeInstruction, eventScopeExecution, eventScopeExecution.getActivity(), targetScope, migrationInstruction, element, compensatingActivity, eventSubscriptionTargetScope);
parseContext.consume(element);
parseContext.submit(migratingCompensationInstance);
parseDependentEntities(parseContext, migratingCompensationInstance);
return migratingCompensationInstance;
}
use of org.camunda.bpm.engine.impl.migration.instance.MigratingEventScopeInstance in project camunda-bpm-platform by camunda.
the class MigrateProcessInstanceCmd method validateInstructions.
protected void validateInstructions(CommandContext commandContext, MigratingProcessInstance migratingProcessInstance, MigratingProcessInstanceValidationReportImpl processInstanceReport) {
List<MigratingActivityInstanceValidator> migratingActivityInstanceValidators = commandContext.getProcessEngineConfiguration().getMigratingActivityInstanceValidators();
List<MigratingTransitionInstanceValidator> migratingTransitionInstanceValidators = commandContext.getProcessEngineConfiguration().getMigratingTransitionInstanceValidators();
List<MigratingCompensationInstanceValidator> migratingCompensationInstanceValidators = commandContext.getProcessEngineConfiguration().getMigratingCompensationInstanceValidators();
Map<MigratingActivityInstance, MigratingActivityInstanceValidationReportImpl> instanceReports = new HashMap<MigratingActivityInstance, MigratingActivityInstanceValidationReportImpl>();
for (MigratingActivityInstance migratingActivityInstance : migratingProcessInstance.getMigratingActivityInstances()) {
MigratingActivityInstanceValidationReportImpl instanceReport = validateActivityInstance(migratingActivityInstance, migratingProcessInstance, migratingActivityInstanceValidators);
instanceReports.put(migratingActivityInstance, instanceReport);
}
for (MigratingEventScopeInstance migratingEventScopeInstance : migratingProcessInstance.getMigratingEventScopeInstances()) {
MigratingActivityInstance ancestorInstance = migratingEventScopeInstance.getClosestAncestorActivityInstance();
validateEventScopeInstance(migratingEventScopeInstance, migratingProcessInstance, migratingCompensationInstanceValidators, instanceReports.get(ancestorInstance));
}
for (MigratingCompensationEventSubscriptionInstance migratingEventSubscriptionInstance : migratingProcessInstance.getMigratingCompensationSubscriptionInstances()) {
MigratingActivityInstance ancestorInstance = migratingEventSubscriptionInstance.getClosestAncestorActivityInstance();
validateCompensateSubscriptionInstance(migratingEventSubscriptionInstance, migratingProcessInstance, migratingCompensationInstanceValidators, instanceReports.get(ancestorInstance));
}
for (MigratingActivityInstanceValidationReportImpl instanceReport : instanceReports.values()) {
if (instanceReport.hasFailures()) {
processInstanceReport.addActivityInstanceReport(instanceReport);
}
}
for (MigratingTransitionInstance migratingTransitionInstance : migratingProcessInstance.getMigratingTransitionInstances()) {
MigratingTransitionInstanceValidationReportImpl instanceReport = validateTransitionInstance(migratingTransitionInstance, migratingProcessInstance, migratingTransitionInstanceValidators);
if (instanceReport.hasFailures()) {
processInstanceReport.addTransitionInstanceReport(instanceReport);
}
}
}
Aggregations