use of org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidationReportImpl in project camunda-bpm-platform by camunda.
the class CreateMigrationPlanCmd method wrapMigrationInstructions.
protected ValidatingMigrationInstructions wrapMigrationInstructions(MigrationPlan migrationPlan, ProcessDefinitionImpl sourceProcessDefinition, ProcessDefinitionImpl targetProcessDefinition, MigrationPlanValidationReportImpl planReport) {
ValidatingMigrationInstructions validatingMigrationInstructions = new ValidatingMigrationInstructions();
for (MigrationInstruction migrationInstruction : migrationPlan.getInstructions()) {
MigrationInstructionValidationReportImpl instructionReport = new MigrationInstructionValidationReportImpl(migrationInstruction);
String sourceActivityId = migrationInstruction.getSourceActivityId();
String targetActivityId = migrationInstruction.getTargetActivityId();
if (sourceActivityId != null && targetActivityId != null) {
ActivityImpl sourceActivity = sourceProcessDefinition.findActivity(sourceActivityId);
ActivityImpl targetActivity = targetProcessDefinition.findActivity(migrationInstruction.getTargetActivityId());
if (sourceActivity != null && targetActivity != null) {
validatingMigrationInstructions.addInstruction(new ValidatingMigrationInstructionImpl(sourceActivity, targetActivity, migrationInstruction.isUpdateEventTrigger()));
} else {
if (sourceActivity == null) {
instructionReport.addFailure("Source activity '" + sourceActivityId + "' does not exist");
}
if (targetActivity == null) {
instructionReport.addFailure("Target activity '" + targetActivityId + "' does not exist");
}
}
} else {
if (sourceActivityId == null) {
instructionReport.addFailure("Source activity id is null");
}
if (targetActivityId == null) {
instructionReport.addFailure("Target activity id is null");
}
}
if (instructionReport.hasFailures()) {
planReport.addInstructionReport(instructionReport);
}
}
return validatingMigrationInstructions;
}
use of org.camunda.bpm.engine.impl.migration.validation.instruction.MigrationInstructionValidationReportImpl 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);
}
}
Aggregations