protected internal override void instantiateScopes(MigratingScopeInstance ancestorScopeInstance, MigratingScopeInstanceBranch executionBranch, IList <ScopeImpl> scopesToInstantiate) { if (scopesToInstantiate.Count == 0) { return; } ExecutionEntity ancestorScopeExecution = ancestorScopeInstance.resolveRepresentativeExecution(); ExecutionEntity parentExecution = ancestorScopeExecution; foreach (ScopeImpl scope in scopesToInstantiate) { ExecutionEntity compensationScopeExecution = parentExecution.createExecution(); compensationScopeExecution.Scope = true; compensationScopeExecution.EventScope = true; compensationScopeExecution.setActivity((PvmActivity)scope); compensationScopeExecution.Active = false; compensationScopeExecution.activityInstanceStarting(); compensationScopeExecution.enterActivityInstance(); EventSubscriptionEntity eventSubscription = EventSubscriptionEntity.createAndInsert(parentExecution, EventType.COMPENSATE, (ActivityImpl)scope); eventSubscription.Configuration = compensationScopeExecution.Id; executionBranch.visited(new MigratingEventScopeInstance(eventSubscription, compensationScopeExecution, scope)); parentExecution = compensationScopeExecution; } }
public virtual void attachState(MigratingScopeInstance owningInstance) { ExecutionEntity representativeExecution = owningInstance.resolveRepresentativeExecution(); representativeExecution.addExternalTask(externalTask); externalTask.Execution = representativeExecution; }
public override void attachState(MigratingScopeInstance targetActivityInstance) { Parent = targetActivityInstance; ExecutionEntity representativeExecution = targetActivityInstance.resolveRepresentativeExecution(); eventSubscription.Execution = representativeExecution; }
public override void remove(bool skipCustomListeners, bool skipIoMappings) { // never invokes listeners and io mappings because this does not remove an active // activity instance eventScopeExecution.remove(); migratingEventSubscription.remove(); Parent = null; }
public virtual void attachState(MigratingScopeInstance newOwningInstance) { attachTo(newOwningInstance.resolveRepresentativeExecution()); foreach (MigratingInstance dependentInstance in migratingDependentInstances) { dependentInstance.attachState(newOwningInstance); } }
public virtual void visited(MigratingScopeInstance scopeInstance) { ScopeImpl targetScope = scopeInstance.TargetScope; if (targetScope.Scope) { scopeInstances[targetScope] = scopeInstance; } }
public override void attachState(MigratingScopeInstance activityInstance) { this.setParent(activityInstance); instanceBehavior.attachState(); foreach (MigratingInstance dependentInstance in migratingDependentInstances) { dependentInstance.attachState(this); } }
public override void addChild(MigratingScopeInstance migratingScopeInstance) { if (migratingScopeInstance is MigratingEventScopeInstance) { childInstances.Add((MigratingEventScopeInstance)migratingScopeInstance); } else { throw MIGRATION_LOGGER.cannotHandleChild(this, migratingScopeInstance); } }
public virtual void attachState(MigratingScopeInstance owningInstance) { ExecutionEntity representativeExecution = owningInstance.resolveRepresentativeExecution(); representativeExecution.addTask(userTask); foreach (VariableInstanceEntity variable in userTask.VariablesInternal) { variable.Execution = representativeExecution; } userTask.setExecution(representativeExecution); }
public override void setParent(MigratingScopeInstance parentInstance) { if (this.parentInstance != null) { this.parentInstance.removeChild(this); } this.parentInstance = parentInstance; if (parentInstance != null) { parentInstance.addChild(this); } }
public virtual void attachState(MigratingScopeInstance owningActivityInstance) { ExecutionEntity representativeExecution = owningActivityInstance.resolveRepresentativeExecution(); ScopeImpl currentScope = owningActivityInstance.CurrentScope; ExecutionEntity newOwningExecution = representativeExecution; if (currentScope.Scope && isConcurrentLocalInParentScope) { newOwningExecution = representativeExecution.Parent; } newOwningExecution.addVariableInternal(variable); }
public override void removeChild(MigratingScopeInstance child) { if (child is MigratingActivityInstance) { removeChild((MigratingActivityInstance)child); } else if (child is MigratingEventScopeInstance) { removeChild((MigratingEventScopeInstance)child); } else { throw MIGRATION_LOGGER.cannotHandleChild(this, child); } }
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(); }
protected internal override ICollection <MigrationContext> nextElements() { ICollection <MigrationContext> nextElements = new LinkedList <MigrationContext>(); MigrationContext currentElement = CurrentElement; // continue migration for non-leaf instances (i.e. scopes) if (currentElement.processElementInstance is MigratingScopeInstance) { // Child instances share the same scope instance branch; // This ensures "once-per-parent" instantiation semantics, // i.e. if a new parent scope is added to more than one child, all those children // will share the same new parent instance. // By changing the way how the branches are created here, it should be possible // to implement other strategies, e.g. "once-per-child" semantics MigratingScopeInstanceBranch childrenScopeBranch = currentElement.scopeInstanceBranch.copy(); MigratingScopeInstanceBranch childrenCompensationScopeBranch = currentElement.scopeInstanceBranch.copy(); MigratingScopeInstance scopeInstance = (MigratingScopeInstance)currentElement.processElementInstance; childrenScopeBranch.visited(scopeInstance); childrenCompensationScopeBranch.visited(scopeInstance); foreach (MigratingProcessElementInstance child in scopeInstance.Children) { MigratingScopeInstanceBranch instanceBranch = null; // compensation and non-compensation scopes cannot share the same scope instance branch // e.g. when adding a sub process, we want to create a new activity instance as well // as a new event scope instance for that sub process if (child is MigratingEventScopeInstance || child is MigratingCompensationEventSubscriptionInstance) { instanceBranch = childrenCompensationScopeBranch; } else { instanceBranch = childrenScopeBranch; } nextElements.Add(new MigrationContext(child, instanceBranch)); } } return(nextElements); }
public override void setParent(MigratingScopeInstance parentInstance) { if (parentInstance != null && !(parentInstance is MigratingActivityInstance)) { throw MIGRATION_LOGGER.cannotHandleChild(parentInstance, this); } MigratingActivityInstance parentActivityInstance = (MigratingActivityInstance)parentInstance; if (this.parentInstance != null) { ((MigratingActivityInstance)this.parentInstance).removeChild(this); } this.parentInstance = parentActivityInstance; if (parentInstance != null) { parentActivityInstance.addChild(this); } }
public override void attachState(MigratingScopeInstance scopeInstance) { if (!(scopeInstance is MigratingActivityInstance)) { throw MIGRATION_LOGGER.cannotHandleChild(scopeInstance, this); } MigratingActivityInstance activityInstance = (MigratingActivityInstance)scopeInstance; setParent(activityInstance); representativeExecution = activityInstance.createAttachableExecution(); representativeExecution.ActivityInstanceId = null; representativeExecution.Active = activeState; jobInstance.attachState(this); foreach (MigratingInstance dependentInstance in migratingDependentInstances) { dependentInstance.attachState(this); } }
protected internal override void instantiateScopes(MigratingScopeInstance ancestorScopeInstance, MigratingScopeInstanceBranch executionBranch, IList <ScopeImpl> scopesToInstantiate) { if (scopesToInstantiate.Count == 0) { return; } // must always be an activity instance MigratingActivityInstance ancestorActivityInstance = (MigratingActivityInstance)ancestorScopeInstance; ExecutionEntity newParentExecution = ancestorActivityInstance.createAttachableExecution(); IDictionary <PvmActivity, PvmExecutionImpl> createdExecutions = newParentExecution.instantiateScopes((System.Collections.IList)scopesToInstantiate, skipCustomListeners, skipIoMappings); foreach (ScopeImpl scope in scopesToInstantiate) { ExecutionEntity createdExecution = (ExecutionEntity)createdExecutions[scope]; createdExecution.setActivity(null); createdExecution.Active = false; executionBranch.visited(new MigratingActivityInstance(scope, createdExecution)); } }
public abstract void addChild(MigratingScopeInstance migratingActivityInstance);
public override void removeChild(MigratingScopeInstance migratingScopeInstance) { childInstances.remove(migratingScopeInstance); }
protected internal abstract void instantiateScopes(MigratingScopeInstance ancestorScopeInstance, MigratingScopeInstanceBranch executionBranch, IList <ScopeImpl> scopesToInstantiate);
public virtual void attachState(MigratingScopeInstance newOwningInstance) { attachTo(newOwningInstance.resolveRepresentativeExecution()); }
public virtual void attachState(MigratingScopeInstance newOwningInstance) { eventSubscriptionEntity.Execution = newOwningInstance.resolveRepresentativeExecution(); }
public virtual void attachState(MigratingScopeInstance targetActivityInstance) { processInstance.setSuperExecution(targetActivityInstance.resolveRepresentativeExecution()); }
public abstract void attachState(MigratingScopeInstance targetActivityInstance);