use of org.camunda.bpm.engine.migration.MigrationInstructionsBuilder in project camunda-bpm-platform by camunda.
the class MigrationRestServiceImpl method generateMigrationPlan.
public MigrationPlanDto generateMigrationPlan(MigrationPlanGenerationDto generationDto) {
RuntimeService runtimeService = processEngine.getRuntimeService();
String sourceProcessDefinitionId = generationDto.getSourceProcessDefinitionId();
String targetProcessDefinitionId = generationDto.getTargetProcessDefinitionId();
try {
MigrationInstructionsBuilder instructionsBuilder = runtimeService.createMigrationPlan(sourceProcessDefinitionId, targetProcessDefinitionId).mapEqualActivities();
if (generationDto.isUpdateEventTriggers()) {
instructionsBuilder = instructionsBuilder.updateEventTriggers();
}
MigrationPlan migrationPlan = instructionsBuilder.build();
return MigrationPlanDto.from(migrationPlan);
} catch (BadUserRequestException e) {
throw new InvalidRequestException(Status.BAD_REQUEST, e, e.getMessage());
}
}
use of org.camunda.bpm.engine.migration.MigrationInstructionsBuilder in project camunda-bpm-platform by camunda.
the class MigrationPlanGenerationTest method assertGeneratedMigrationPlan.
protected MigrationPlanAssert assertGeneratedMigrationPlan(BpmnModelInstance sourceProcess, BpmnModelInstance targetProcess, boolean updateEventTriggers) {
ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(sourceProcess);
ProcessDefinition targetProcessDefinition = testHelper.deployAndGetDefinition(targetProcess);
MigrationInstructionsBuilder migrationInstructionsBuilder = rule.getRuntimeService().createMigrationPlan(sourceProcessDefinition.getId(), targetProcessDefinition.getId()).mapEqualActivities();
if (updateEventTriggers) {
migrationInstructionsBuilder.updateEventTriggers();
}
MigrationPlan migrationPlan = migrationInstructionsBuilder.build();
assertThat(migrationPlan).hasSourceProcessDefinition(sourceProcessDefinition).hasTargetProcessDefinition(targetProcessDefinition);
return assertThat(migrationPlan);
}
Aggregations