use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class AdditionalFlowScopeInstructionValidator method validate.
public void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ValidatingMigrationInstruction ancestorScopeInstruction = getClosestPreservedAncestorScopeMigrationInstruction(instruction, instructions);
ScopeImpl targetScope = instruction.getTargetActivity();
if (ancestorScopeInstruction != null && targetScope != null && targetScope != targetScope.getProcessDefinition()) {
ScopeImpl parentInstanceTargetScope = ancestorScopeInstruction.getTargetActivity();
if (parentInstanceTargetScope != null && !parentInstanceTargetScope.isAncestorFlowScopeOf(targetScope)) {
report.addFailure("The closest mapped ancestor '" + ancestorScopeInstruction.getSourceActivity().getId() + "' is mapped to scope '" + parentInstanceTargetScope.getId() + "' which is not an ancestor of target scope '" + targetScope.getId() + "'");
}
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class CannotAddMultiInstanceBodyValidator method validate.
@Override
public void validate(ValidatingMigrationInstruction instruction, final ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl targetActivity = instruction.getTargetActivity();
FlowScopeWalker flowScopeWalker = new FlowScopeWalker(targetActivity.getFlowScope());
MiBodyCollector miBodyCollector = new MiBodyCollector();
flowScopeWalker.addPreVisitor(miBodyCollector);
// walk until a target scope is found that is mapped
flowScopeWalker.walkWhile(new WalkCondition<ScopeImpl>() {
@Override
public boolean isFulfilled(ScopeImpl element) {
return element == null || !instructions.getInstructionsByTargetScope(element).isEmpty();
}
});
if (miBodyCollector.firstMiBody != null) {
report.addFailure("Target activity '" + targetActivity.getId() + "' is a descendant of multi-instance body '" + miBodyCollector.firstMiBody.getId() + "' that is not mapped from the source process definition.");
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class MigratingProcessElementInstanceVisitor method collectNonExistingFlowScopes.
/**
* Returns a list of flow scopes from the given scope until a scope is reached that is already present in the given
* {@link MigratingScopeInstanceBranch} (exclusive). The order of the returned list is top-down, i.e. the highest scope
* is the first element of the list.
*/
protected List<ScopeImpl> collectNonExistingFlowScopes(ScopeImpl scope, final MigratingScopeInstanceBranch migratingExecutionBranch) {
FlowScopeWalker walker = new FlowScopeWalker(scope);
final List<ScopeImpl> result = new LinkedList<ScopeImpl>();
walker.addPreVisitor(new TreeVisitor<ScopeImpl>() {
@Override
public void visit(ScopeImpl obj) {
result.add(0, obj);
}
});
walker.walkWhile(new ReferenceWalker.WalkCondition<ScopeImpl>() {
@Override
public boolean isFulfilled(ScopeImpl element) {
return migratingExecutionBranch.hasInstance(element);
}
});
return result;
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class MigratingExternalTaskInstance method migrateState.
@Override
public void migrateState() {
ScopeImpl targetActivity = migratingActivityInstance.getTargetScope();
ProcessDefinition targetProcessDefinition = (ProcessDefinition) targetActivity.getProcessDefinition();
externalTask.setActivityId(targetActivity.getId());
externalTask.setProcessDefinitionId(targetProcessDefinition.getId());
externalTask.setProcessDefinitionKey(targetProcessDefinition.getKey());
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class SameEventScopeInstructionValidator method validate.
public void validate(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl sourceActivity = instruction.getSourceActivity();
if (isCompensationBoundaryEvent(sourceActivity)) {
// event scopes need not be active at runtime
return;
}
ScopeImpl sourceEventScope = instruction.getSourceActivity().getEventScope();
ScopeImpl targetEventScope = instruction.getTargetActivity().getEventScope();
if (sourceEventScope == null || sourceEventScope == sourceActivity.getFlowScope()) {
// => validation not necessary for event subprocesses
return;
}
if (targetEventScope == null) {
report.addFailure("The source activity's event scope (" + sourceEventScope.getId() + ") must be mapped but the " + "target activity has no event scope");
} else {
ScopeImpl mappedSourceEventScope = findMappedEventScope(sourceEventScope, instruction, instructions);
if (mappedSourceEventScope == null || !mappedSourceEventScope.getId().equals(targetEventScope.getId())) {
report.addFailure("The source activity's event scope (" + sourceEventScope.getId() + ") " + "must be mapped to the target activity's event scope (" + targetEventScope.getId() + ")");
}
}
}
Aggregations