org.camunda.bpm.engine.impl.migration
Class MigrateProcessInstanceCmd

java.lang.Object
  extended by org.camunda.bpm.engine.impl.migration.MigrateProcessInstanceCmd
All Implemented Interfaces:
Command<Void>

public class MigrateProcessInstanceCmd
extends Object
implements Command<Void>

How migration works:

  1. Validate migration instructions.
  2. Delete activity instances that are not going to be migrated, invoking execution listeners and io mappings. This is performed in a bottom-up fashion in the activity instance tree and ensures that the "upstream" tree is always consistent with respect to the old process definition.
  3. Migrate and create activity instances. Creation invokes execution listeners and io mappings. This is performed in a top-down fashion in the activity instance tree and ensures that the "upstream" tree is always consistent with respect to the new process definition.

    Author:
    Thorben Lindhauer

    Field Summary
    protected static MigrationLogger LOGGER
               
    protected  MigrationPlan migrationPlan
               
    protected  List<String> processInstanceIds
               
     
    Constructor Summary
    MigrateProcessInstanceCmd(MigrationPlan migrationPlan, List<String> processInstanceIds)
               
     
    Method Summary
    protected  Set<MigratingActivityInstance> collectLeafInstances(MigratingProcessInstance migratingProcessInstance)
               
    protected  List<ScopeImpl> collectNonExistingFlowScopes(ScopeImpl scope, MigratingExecutionBranch migratingExecutionBranch)
              Returns a list of flow scopes from the given scope until a scope is reached that is already present in the given MigratingExecutionBranch (exclusive).
    protected  void deleteUnmappedActivityInstances(MigratingProcessInstance migratingProcessInstance)
              delete unmapped instances in a bottom-up fashion (similar to deleteCascade and regular BPMN execution)
     Void execute(CommandContext commandContext)
               
    protected  void instantiateScopes(ExecutionEntity ancestorScopeExecution, MigratingExecutionBranch executionBranch, List<ScopeImpl> scopesToInstantiate)
              Creates scope executions for the given list of scopes; Registers these executions with the migrating execution branch;
    protected  void migrateActivityInstance(MigratingProcessInstance migratingProcessInstance, MigratingExecutionBranch migratingExecutionBranch, MigratingActivityInstance migratingActivityInstance)
               
     Void migrateProcessInstance(CommandContext commandContext, String processInstanceId, ProcessDefinitionEntity targetProcessDefinition)
               
    protected  void migrateProcessInstance(MigratingProcessInstance migratingProcessInstance)
              Migrate activity instances to their new activities and process definition.
    protected  void validateInstructions(MigratingProcessInstance migratingProcessInstance)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    migrationPlan

    protected MigrationPlan migrationPlan

    processInstanceIds

    protected List<String> processInstanceIds

    LOGGER

    protected static final MigrationLogger LOGGER
    Constructor Detail

    MigrateProcessInstanceCmd

    public MigrateProcessInstanceCmd(MigrationPlan migrationPlan,
                                     List<String> processInstanceIds)
    Method Detail

    execute

    public Void execute(CommandContext commandContext)
    Specified by:
    execute in interface Command<Void>

    migrateProcessInstance

    public Void migrateProcessInstance(CommandContext commandContext,
                                       String processInstanceId,
                                       ProcessDefinitionEntity targetProcessDefinition)

    deleteUnmappedActivityInstances

    protected void deleteUnmappedActivityInstances(MigratingProcessInstance migratingProcessInstance)
    delete unmapped instances in a bottom-up fashion (similar to deleteCascade and regular BPMN execution)


    collectLeafInstances

    protected Set<MigratingActivityInstance> collectLeafInstances(MigratingProcessInstance migratingProcessInstance)

    validateInstructions

    protected void validateInstructions(MigratingProcessInstance migratingProcessInstance)

    migrateProcessInstance

    protected void migrateProcessInstance(MigratingProcessInstance migratingProcessInstance)
    Migrate activity instances to their new activities and process definition. Creates new scope instances as necessary.


    migrateActivityInstance

    protected void migrateActivityInstance(MigratingProcessInstance migratingProcessInstance,
                                           MigratingExecutionBranch migratingExecutionBranch,
                                           MigratingActivityInstance migratingActivityInstance)

    collectNonExistingFlowScopes

    protected List<ScopeImpl> collectNonExistingFlowScopes(ScopeImpl scope,
                                                           MigratingExecutionBranch migratingExecutionBranch)
    Returns a list of flow scopes from the given scope until a scope is reached that is already present in the given MigratingExecutionBranch (exclusive). The order of the returned list is top-down, i.e. the highest scope is the first element of the list.


    instantiateScopes

    protected void instantiateScopes(ExecutionEntity ancestorScopeExecution,
                                     MigratingExecutionBranch executionBranch,
                                     List<ScopeImpl> scopesToInstantiate)
    Creates scope executions for the given list of scopes; Registers these executions with the migrating execution branch;

    Parameters:
    ancestorScopeExecution - the execution for the scope that the scopes to instantiate are subordinates to
    executionBranch - the migrating execution branch that manages scopes and their executions
    scopesToInstantiate - a list of hierarchical scopes to instantiate, ordered top-down


    Copyright © 2016 camunda services GmbH. All rights reserved.