Java Code Examples for org.camunda.bpm.engine.impl.pvm.process.ScopeImpl#getFlowScope()
The following examples show how to use
org.camunda.bpm.engine.impl.pvm.process.ScopeImpl#getFlowScope() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdditionalFlowScopeInstructionValidator.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected ValidatingMigrationInstruction getClosestPreservedAncestorScopeMigrationInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions) { ScopeImpl parent = instruction.getSourceActivity().getFlowScope(); while (parent != null && instructions.getInstructionsBySourceScope(parent).isEmpty()) { parent = parent.getFlowScope(); } if (parent != null) { return instructions.getInstructionsBySourceScope(parent).get(0); } else { return null; } }
Example 2
Source File: MigratingTimerJobInstance.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected ScopeImpl determineTimerTriggerTargetScope(JobEntity jobEntity, ScopeImpl targetScope) { if (TimerStartEventSubprocessJobHandler.TYPE.equals(jobEntity.getJobHandlerType())) { // for event subprocess start jobs, the job handler configuration references the subprocess while // the job references the start event return targetScope.getFlowScope(); } else { return targetScope; } }
Example 3
Source File: LegacyBehavior.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
public static boolean eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution) { boolean performLegacyBehavior = isLegacyBehaviorRequired(endedExecution); if(performLegacyBehavior) { LOG.endConcurrentExecutionInEventSubprocess(); // notify the grandparent flow scope in a similar way PvmAtomicOperationAcitivtyEnd does ScopeImpl flowScope = endedExecution.getActivity().getFlowScope(); if (flowScope != null) { flowScope = flowScope.getFlowScope(); if (flowScope != null) { if (flowScope == endedExecution.getActivity().getProcessDefinition()) { endedExecution.remove(); scopeExecution.tryPruneLastConcurrentChild(); scopeExecution.forceUpdate(); } else { PvmActivity flowScopeActivity = (PvmActivity) flowScope; ActivityBehavior activityBehavior = flowScopeActivity.getActivityBehavior(); if (activityBehavior instanceof CompositeActivityBehavior) { ((CompositeActivityBehavior) activityBehavior).concurrentChildExecutionEnded(scopeExecution, endedExecution); } } } } } return performLegacyBehavior; }
Example 4
Source File: ActivityCancellationCmd.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
protected Set<String> collectParentScopeIdsForActivity(ProcessDefinitionImpl processDefinition, String activityId) { Set<String> parentScopeIds = new HashSet<String>(); ScopeImpl scope = processDefinition.findActivity(activityId); while (scope != null) { parentScopeIds.add(scope.getId()); scope = scope.getFlowScope(); } return parentScopeIds; }
Example 5
Source File: MigratingProcessElementInstanceVisitor.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
protected void migrateProcessElementInstance(MigratingProcessElementInstance migratingInstance, MigratingScopeInstanceBranch migratingInstanceBranch) { final MigratingScopeInstance parentMigratingInstance = migratingInstance.getParent(); ScopeImpl sourceScope = migratingInstance.getSourceScope(); ScopeImpl targetScope = migratingInstance.getTargetScope(); ScopeImpl targetFlowScope = targetScope.getFlowScope(); ScopeImpl parentActivityInstanceTargetScope = parentMigratingInstance != null ? parentMigratingInstance.getTargetScope() : null; if (sourceScope != sourceScope.getProcessDefinition() && targetFlowScope != parentActivityInstanceTargetScope) { // create intermediate scopes // 1. manipulate execution tree // determine the list of ancestor scopes (parent, grandparent, etc.) for which // no executions exist yet List<ScopeImpl> nonExistingScopes = collectNonExistingFlowScopes(targetFlowScope, migratingInstanceBranch); // get the closest ancestor scope that is instantiated already ScopeImpl existingScope = nonExistingScopes.isEmpty() ? targetFlowScope : nonExistingScopes.get(0).getFlowScope(); // 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(); }
Example 6
Source File: LegacyBehavior.java From camunda-bpm-platform with Apache License 2.0 | 2 votes |
/** * In case the process instance was migrated from a previous version, activities which are now parsed as scopes * do not have scope executions. Use the flow scopes of these activities in order to find their execution. * - For an event subprocess this is the scope execution of the scope in which the event subprocess is embeded in * - For a multi instance sequential subprocess this is the multi instace scope body. * * @param scope * @param activityExecutionMapping * @return */ public static PvmExecutionImpl getScopeExecution(ScopeImpl scope, Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping) { ScopeImpl flowScope = scope.getFlowScope(); return activityExecutionMapping.get(flowScope); }