Пример #1
0
        protected internal virtual void migrateProcessElementInstance(MigratingProcessElementInstance migratingInstance, MigratingScopeInstanceBranch migratingInstanceBranch)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final MigratingScopeInstance parentMigratingInstance = migratingInstance.getParent();
            MigratingScopeInstance parentMigratingInstance = migratingInstance.Parent;

            ScopeImpl sourceScope     = migratingInstance.SourceScope;
            ScopeImpl targetScope     = migratingInstance.TargetScope;
            ScopeImpl targetFlowScope = targetScope.FlowScope;
            ScopeImpl parentActivityInstanceTargetScope = parentMigratingInstance != null ? parentMigratingInstance.TargetScope : null;

            if (sourceScope != sourceScope.ProcessDefinition && targetFlowScope != parentActivityInstanceTargetScope)
            {
                // create intermediate scopes

                // 1. manipulate execution tree

                // determine the list of ancestor scopes (parent, grandparent, etc.) for which
                //     no executions exist yet
                IList <ScopeImpl> nonExistingScopes = collectNonExistingFlowScopes(targetFlowScope, migratingInstanceBranch);

                // get the closest ancestor scope that is instantiated already
                ScopeImpl existingScope = nonExistingScopes.Count == 0 ? targetFlowScope : nonExistingScopes[0].FlowScope;

                // and its scope instance
                MigratingScopeInstance ancestorScopeInstance = migratingInstanceBranch.getInstance(existingScope);

                // Instantiate the scopes as children of the scope execution
                instantiateScopes(ancestorScopeInstance, migratingInstanceBranch, nonExistingScopes);

                MigratingScopeInstance targetFlowScopeInstance = migratingInstanceBranch.getInstance(targetFlowScope);

                // 2. detach instance
                // The order of steps 1 and 2 avoids intermediate execution tree compaction
                // which in turn could overwrite some dependent instances (e.g. variables)
                migratingInstance.detachState();

                // 3. attach to newly created activity instance
                migratingInstance.attachState(targetFlowScopeInstance);
            }

            // 4. update state (e.g. activity id)
            migratingInstance.migrateState();

            // 5. migrate instance state other than execution-tree structure
            migratingInstance.migrateDependentEntities();
        }
Пример #2
0
 protected internal override bool canMigrate(MigratingProcessElementInstance instance)
 {
     return(instance is MigratingEventScopeInstance || instance is MigratingCompensationEventSubscriptionInstance);
 }
Пример #3
0
 protected internal override bool canMigrate(MigratingProcessElementInstance instance)
 {
     return(instance is MigratingActivityInstance || instance is MigratingTransitionInstance);
 }
Пример #4
0
 protected internal abstract bool canMigrate(MigratingProcessElementInstance instance);
Пример #5
0
 public MigrationContext(MigratingProcessElementInstance processElementInstance, MigratingScopeInstanceBranch scopeInstanceBranch)
 {
     this.processElementInstance = processElementInstance;
     this.scopeInstanceBranch    = scopeInstanceBranch;
 }