Search in sources :

Example 1 with MigratingTransitionInstance

use of org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance 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));
}
Also used : JobEntity(org.camunda.bpm.engine.impl.persistence.entity.JobEntity) ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) MigrationInstruction(org.camunda.bpm.engine.migration.MigrationInstruction) MigratingTransitionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) MigratingActivityInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance)

Example 2 with MigratingTransitionInstance

use of org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance 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);
        }
    }
}
Also used : MigratingTransitionInstanceValidator(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidator) MigratingCompensationEventSubscriptionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance) MigratingActivityInstanceValidationReportImpl(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidationReportImpl) HashMap(java.util.HashMap) MigratingActivityInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance) MigratingEventScopeInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingEventScopeInstance) MigratingTransitionInstanceValidationReportImpl(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidationReportImpl) MigratingTransitionInstance(org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance) MigratingCompensationInstanceValidator(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingCompensationInstanceValidator) MigratingActivityInstanceValidator(org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidator)

Aggregations

MigratingActivityInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance)2 MigratingTransitionInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingTransitionInstance)2 HashMap (java.util.HashMap)1 MigratingCompensationEventSubscriptionInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingCompensationEventSubscriptionInstance)1 MigratingEventScopeInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingEventScopeInstance)1 MigratingActivityInstanceValidationReportImpl (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidationReportImpl)1 MigratingActivityInstanceValidator (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingActivityInstanceValidator)1 MigratingCompensationInstanceValidator (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingCompensationInstanceValidator)1 MigratingTransitionInstanceValidationReportImpl (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidationReportImpl)1 MigratingTransitionInstanceValidator (org.camunda.bpm.engine.impl.migration.validation.instance.MigratingTransitionInstanceValidator)1 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)1 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)1 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)1 MigrationInstruction (org.camunda.bpm.engine.migration.MigrationInstruction)1