Search in sources :

Example 1 with MigrationInstructionsBuilder

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());
    }
}
Also used : RuntimeService(org.camunda.bpm.engine.RuntimeService) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) MigrationInstructionsBuilder(org.camunda.bpm.engine.migration.MigrationInstructionsBuilder) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException)

Example 2 with MigrationInstructionsBuilder

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);
}
Also used : MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) MigrationInstructionsBuilder(org.camunda.bpm.engine.migration.MigrationInstructionsBuilder)

Aggregations

MigrationInstructionsBuilder (org.camunda.bpm.engine.migration.MigrationInstructionsBuilder)2 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)2 BadUserRequestException (org.camunda.bpm.engine.BadUserRequestException)1 RuntimeService (org.camunda.bpm.engine.RuntimeService)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1