use of org.camunda.bpm.engine.impl.migration.validation.instruction.ValidatingMigrationInstructionImpl 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.ValidatingMigrationInstructionImpl 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