use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class AsyncAfterMigrationValidator method validate.
@Override
public void validate(MigratingTransitionInstance migratingInstance, MigratingProcessInstance migratingProcessInstance, MigratingTransitionInstanceValidationReportImpl instanceReport) {
ActivityImpl targetActivity = (ActivityImpl) migratingInstance.getTargetScope();
if (targetActivity != null && migratingInstance.isAsyncAfter()) {
MigratingJobInstance jobInstance = migratingInstance.getJobInstance();
AsyncContinuationConfiguration config = (AsyncContinuationConfiguration) jobInstance.getJobEntity().getJobHandlerConfiguration();
String sourceTransitionId = config.getTransitionId();
if (targetActivity.getOutgoingTransitions().size() > 1) {
if (sourceTransitionId == null) {
instanceReport.addFailure("Transition instance is assigned to no sequence flow" + " and target activity has more than one outgoing sequence flow");
} else {
TransitionImpl matchingOutgoingTransition = targetActivity.findOutgoingTransition(sourceTransitionId);
if (matchingOutgoingTransition == null) {
instanceReport.addFailure("Transition instance is assigned to a sequence flow" + " that cannot be matched in the target activity");
}
}
}
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl 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.ActivityImpl in project camunda-bpm-platform by camunda.
the class GatewayMappingValidator method validateIncomingSequenceFlows.
protected void validateIncomingSequenceFlows(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl sourceActivity = instruction.getSourceActivity();
ActivityImpl targetActivity = instruction.getTargetActivity();
int numSourceIncomingFlows = sourceActivity.getIncomingTransitions().size();
int numTargetIncomingFlows = targetActivity.getIncomingTransitions().size();
if (numSourceIncomingFlows > numTargetIncomingFlows) {
report.addFailure("The target gateway must have at least the same number " + "of incoming sequence flows that the source gateway has");
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class GatewayMappingValidator method validateSingleInstruction.
protected void validateSingleInstruction(ValidatingMigrationInstruction instruction, ValidatingMigrationInstructions instructions, MigrationInstructionValidationReportImpl report) {
ActivityImpl targetActivity = instruction.getTargetActivity();
List<ValidatingMigrationInstruction> instructionsToTargetGateway = instructions.getInstructionsByTargetScope(targetActivity);
if (instructionsToTargetGateway.size() > 1) {
report.addFailure("Only one gateway can be mapped to gateway '" + targetActivity.getId() + "'");
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class MigratingAsyncJobInstance method updateAsyncAfterTargetConfiguration.
protected void updateAsyncAfterTargetConfiguration(AsyncContinuationConfiguration currentConfiguration) {
ActivityImpl targetActivity = (ActivityImpl) targetScope;
List<PvmTransition> outgoingTransitions = targetActivity.getOutgoingTransitions();
AsyncContinuationConfiguration targetConfiguration = new AsyncContinuationConfiguration();
if (outgoingTransitions.isEmpty()) {
targetConfiguration.setAtomicOperation(PvmAtomicOperation.ACTIVITY_END.getCanonicalName());
} else {
targetConfiguration.setAtomicOperation(PvmAtomicOperation.TRANSITION_NOTIFY_LISTENER_TAKE.getCanonicalName());
if (outgoingTransitions.size() == 1) {
targetConfiguration.setTransitionId(outgoingTransitions.get(0).getId());
} else {
TransitionImpl matchingTargetTransition = null;
String currentTransitionId = currentConfiguration.getTransitionId();
if (currentTransitionId != null) {
matchingTargetTransition = targetActivity.findOutgoingTransition(currentTransitionId);
}
if (matchingTargetTransition != null) {
targetConfiguration.setTransitionId(matchingTargetTransition.getId());
} else {
// should not happen since it is avoided by validation
throw new ProcessEngineException("Cannot determine matching outgoing sequence flow");
}
}
}
jobEntity.setJobHandlerConfiguration(targetConfiguration);
}
Aggregations