use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction in project camunda-bpm-platform by camunda.
the class CreateMigrationPlanCmd method validateMigrationPlan.
protected void validateMigrationPlan(CommandContext commandContext, MigrationPlanImpl migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition) {
List<MigrationInstructionValidator> migrationInstructionValidators = commandContext.getProcessEngineConfiguration().getMigrationInstructionValidators();
MigrationPlanValidationReportImpl planReport = new MigrationPlanValidationReportImpl(migrationPlan);
ValidatingMigrationInstructions validatingMigrationInstructions = wrapMigrationInstructions(migrationPlan, sourceProcessDefinition, targetProcessDefinition, planReport);
for (ValidatingMigrationInstruction validatingMigrationInstruction : validatingMigrationInstructions.getInstructions()) {
MigrationInstructionValidationReportImpl instructionReport = validateInstruction(validatingMigrationInstruction, validatingMigrationInstructions, migrationInstructionValidators);
if (instructionReport.hasFailures()) {
planReport.addInstructionReport(instructionReport);
}
}
if (planReport.hasInstructionReports()) {
throw LOG.failingMigrationPlanValidation(planReport);
}
}
use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction in project camunda-bpm-platform by camunda.
the class DefaultMigrationInstructionGenerator method generate.
public void generate(ScopeImpl sourceScope, ScopeImpl targetScope, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, ValidatingMigrationInstructions existingInstructions, boolean updateEventTriggers) {
List<ValidatingMigrationInstruction> flowScopeInstructions = generateInstructionsForActivities(sourceScope.getActivities(), targetScope.getActivities(), updateEventTriggers, existingInstructions);
existingInstructions.addAll(flowScopeInstructions);
List<ValidatingMigrationInstruction> eventScopeInstructions = generateInstructionsForActivities(sourceScope.getEventActivities(), targetScope.getEventActivities(), updateEventTriggers, existingInstructions);
existingInstructions.addAll(eventScopeInstructions);
existingInstructions.filterWith(migrationInstructionValidators);
for (ValidatingMigrationInstruction generatedInstruction : flowScopeInstructions) {
if (existingInstructions.contains(generatedInstruction)) {
generate(generatedInstruction.getSourceActivity(), generatedInstruction.getTargetActivity(), sourceProcessDefinition, targetProcessDefinition, existingInstructions, updateEventTriggers);
}
}
}
use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstruction in project camunda-bpm-platform by camunda.
the class DefaultMigrationInstructionGenerator method generateInstructionsForActivities.
protected List<ValidatingMigrationInstruction> generateInstructionsForActivities(Collection<ActivityImpl> sourceActivities, Collection<ActivityImpl> targetActivities, boolean updateEventTriggers, ValidatingMigrationInstructions existingInstructions) {
List<ValidatingMigrationInstruction> generatedInstructions = new ArrayList<ValidatingMigrationInstruction>();
for (ActivityImpl sourceActivity : sourceActivities) {
if (!existingInstructions.containsInstructionForSourceScope(sourceActivity)) {
for (ActivityImpl targetActivity : targetActivities) {
if (isValidActivity(sourceActivity) && isValidActivity(targetActivity) && migrationActivityMatcher.matchActivities(sourceActivity, targetActivity)) {
// for conditional events the update event trigger must be set
boolean updateEventTriggersForInstruction = sourceActivity.getActivityBehavior() instanceof ConditionalEventBehavior || updateEventTriggers && UpdateEventTriggersValidator.definesPersistentEventTrigger(sourceActivity);
ValidatingMigrationInstruction generatedInstruction = new ValidatingMigrationInstructionImpl(sourceActivity, targetActivity, updateEventTriggersForInstruction);
generatedInstructions.add(generatedInstruction);
}
}
}
}
return generatedInstructions;
}
Aggregations