Search in sources :

Example 11 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.

the class ProcessInstanceModificationBatchCmd method createBatch.

protected BatchEntity createBatch(CommandContext commandContext, List<AbstractProcessInstanceModificationCommand> instructions, Collection<String> processInstanceIds, ProcessDefinitionEntity processDefinition) {
    ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
    BatchJobHandler<ModificationBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);
    ModificationBatchConfiguration configuration = new ModificationBatchConfiguration(new ArrayList<String>(processInstanceIds), builder.getProcessDefinitionId(), instructions, builder.isSkipCustomListeners(), builder.isSkipIoMappings());
    BatchEntity batch = new BatchEntity();
    batch.setType(batchJobHandler.getType());
    batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
    batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
    batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
    batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
    batch.setTenantId(processDefinition.getTenantId());
    commandContext.getBatchManager().insert(batch);
    return batch;
}
Also used : BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) ModificationBatchConfiguration(org.camunda.bpm.engine.impl.ModificationBatchConfiguration)

Example 12 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.

the class SetExternalTasksRetriesBatchCmd method execute.

@Override
public Batch execute(CommandContext commandContext) {
    List<String> externalTaskIds = collectExternalTaskIds();
    ensureNotEmpty(BadUserRequestException.class, "externalTaskIds", externalTaskIds);
    commandContext.getAuthorizationManager().checkAuthorization(Permissions.CREATE, Resources.BATCH);
    writeUserOperationLog(commandContext, builder.getRetries(), externalTaskIds.size(), true);
    BatchEntity batch = createBatch(commandContext, externalTaskIds);
    batch.createSeedJobDefinition();
    batch.createMonitorJobDefinition();
    batch.createBatchJobDefinition();
    batch.fireHistoricStartEvent();
    batch.createSeedJob();
    return batch;
}
Also used : BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity)

Example 13 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.

the class SetExternalTasksRetriesBatchCmd method createBatch.

protected BatchEntity createBatch(CommandContext commandContext, Collection<String> processInstanceIds) {
    ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
    BatchJobHandler<SetRetriesBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);
    SetRetriesBatchConfiguration configuration = new SetRetriesBatchConfiguration(new ArrayList<String>(processInstanceIds), builder.getRetries());
    BatchEntity batch = new BatchEntity();
    batch.setType(batchJobHandler.getType());
    batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
    batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
    batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
    batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
    commandContext.getBatchManager().insert(batch);
    return batch;
}
Also used : SetRetriesBatchConfiguration(org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 14 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.

the class AbstractIDBasedBatchCmd method createBatch.

protected BatchEntity createBatch(CommandContext commandContext, List<String> ids) {
    ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
    BatchJobHandler batchJobHandler = getBatchJobHandler(processEngineConfiguration);
    BatchConfiguration configuration = getAbstractIdsBatchConfiguration(ids);
    BatchEntity batch = new BatchEntity();
    batch.setType(batchJobHandler.getType());
    batch.setTotalJobs(calculateSize(processEngineConfiguration, configuration));
    batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
    batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
    batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
    commandContext.getBatchManager().insert(batch);
    return batch;
}
Also used : BatchJobHandler(org.camunda.bpm.engine.impl.batch.BatchJobHandler) BatchConfiguration(org.camunda.bpm.engine.impl.batch.BatchConfiguration) BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)

Example 15 with BatchEntity

use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.

the class DeleteProcessInstanceBatchCmd method execute.

@Override
public Batch execute(CommandContext commandContext) {
    List<String> processInstanceIds = collectProcessInstanceIds();
    ensureNotEmpty(BadUserRequestException.class, "processInstanceIds", processInstanceIds);
    checkAuthorizations(commandContext);
    writeUserOperationLog(commandContext, deleteReason, processInstanceIds.size(), true);
    BatchEntity batch = createBatch(commandContext, processInstanceIds);
    batch.createSeedJobDefinition();
    batch.createMonitorJobDefinition();
    batch.createBatchJobDefinition();
    batch.fireHistoricStartEvent();
    batch.createSeedJob();
    return batch;
}
Also used : BatchEntity(org.camunda.bpm.engine.impl.batch.BatchEntity)

Aggregations

BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)32 Test (org.junit.Test)18 HashMap (java.util.HashMap)11 ExampleVariableObject (org.camunda.bpm.engine.rest.helper.ExampleVariableObject)11 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)10 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)10 HistoricProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)6 DeleteProcessInstancesDto (org.camunda.bpm.engine.rest.dto.runtime.batch.DeleteProcessInstancesDto)6 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)5 ProcessInstanceQueryDto (org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)2 BatchConfiguration (org.camunda.bpm.engine.impl.batch.BatchConfiguration)2 BatchJobHandler (org.camunda.bpm.engine.impl.batch.BatchJobHandler)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 Date (java.util.Date)1 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)1 ModificationBatchConfiguration (org.camunda.bpm.engine.impl.ModificationBatchConfiguration)1 SetRetriesBatchConfiguration (org.camunda.bpm.engine.impl.batch.SetRetriesBatchConfiguration)1 UpdateProcessInstancesSuspendStateBatchConfiguration (org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateBatchConfiguration)1 BatchManager (org.camunda.bpm.engine.impl.persistence.entity.BatchManager)1