Search in sources :

Example 1 with MigrationPlanExecutionBuilder

use of org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder in project camunda-bpm-platform by camunda.

the class MigrationRestServiceImpl method createMigrationPlanExecutionBuilder.

protected MigrationPlanExecutionBuilder createMigrationPlanExecutionBuilder(MigrationExecutionDto migrationExecution) {
    MigrationPlan migrationPlan = createMigrationPlan(migrationExecution.getMigrationPlan());
    List<String> processInstanceIds = migrationExecution.getProcessInstanceIds();
    MigrationPlanExecutionBuilder executionBuilder = processEngine.getRuntimeService().newMigration(migrationPlan).processInstanceIds(processInstanceIds);
    ProcessInstanceQueryDto processInstanceQueryDto = migrationExecution.getProcessInstanceQuery();
    if (processInstanceQueryDto != null) {
        ProcessInstanceQuery processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
        executionBuilder.processInstanceQuery(processInstanceQuery);
    }
    if (migrationExecution.isSkipCustomListeners()) {
        executionBuilder.skipCustomListeners();
    }
    if (migrationExecution.isSkipIoMappings()) {
        executionBuilder.skipIoMappings();
    }
    return executionBuilder;
}
Also used : ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) MigrationPlan(org.camunda.bpm.engine.migration.MigrationPlan) MigrationPlanExecutionBuilder(org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)

Example 2 with MigrationPlanExecutionBuilder

use of org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder in project camunda-bpm-platform by camunda.

the class MigrationBatchJobHandler method execute.

@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
    ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
    MigrationBatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
    MigrationPlanExecutionBuilder executionBuilder = commandContext.getProcessEngineConfiguration().getRuntimeService().newMigration(batchConfiguration.getMigrationPlan()).processInstanceIds(batchConfiguration.getIds());
    if (batchConfiguration.isSkipCustomListeners()) {
        executionBuilder.skipCustomListeners();
    }
    if (batchConfiguration.isSkipIoMappings()) {
        executionBuilder.skipIoMappings();
    }
    // uses internal API in order to skip writing user operation log (CommandContext#disableUserOperationLog
    // is not sufficient with legacy engine config setting "restrictUserOperationLogToAuthenticatedUsers" = false)
    ((MigrationPlanExecutionBuilderImpl) executionBuilder).execute(false);
    commandContext.getByteArrayManager().delete(configurationEntity);
}
Also used : MigrationPlanExecutionBuilderImpl(org.camunda.bpm.engine.impl.migration.MigrationPlanExecutionBuilderImpl) ByteArrayEntity(org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity) MigrationPlanExecutionBuilder(org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder)

Aggregations

MigrationPlanExecutionBuilder (org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder)2 MigrationPlanExecutionBuilderImpl (org.camunda.bpm.engine.impl.migration.MigrationPlanExecutionBuilderImpl)1 ByteArrayEntity (org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity)1 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)1 ProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)1 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)1