use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class UpdateProcessInstancesSuspendStateBatchCmd method execute.
public Batch execute(CommandContext commandContext) {
Collection<String> processInstanceIds = collectProcessInstanceIds();
EnsureUtil.ensureNotEmpty(BadUserRequestException.class, "No process instance ids given", "process Instance Ids", processInstanceIds);
EnsureUtil.ensureNotContainsNull(BadUserRequestException.class, "Cannot be null.", "Process Instance ids", processInstanceIds);
checkAuthorizations(commandContext);
writeUserOperationLog(commandContext, processInstanceIds.size(), true);
BatchEntity batch = createBatch(commandContext, processInstanceIds);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class AbstractSetJobsRetriesBatchCmd method execute.
@Override
public Batch execute(CommandContext commandContext) {
List<String> jobIds = collectJobIds(commandContext);
ensureNotEmpty(BadUserRequestException.class, "jobIds", jobIds);
EnsureUtil.ensureGreaterThanOrEqual("Retries count", retries, 0);
checkAuthorizations(commandContext);
writeUserOperationLog(commandContext, retries, jobIds.size(), true);
BatchEntity batch = createBatch(commandContext, jobIds);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class ProcessInstanceModificationBatchCmd method execute.
@Override
public Batch execute(CommandContext commandContext) {
List<AbstractProcessInstanceModificationCommand> instructions = builder.getInstructions();
Collection<String> processInstanceIds = collectProcessInstanceIds(commandContext);
ensureNotEmpty(BadUserRequestException.class, "Modification instructions cannot be empty", instructions);
ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot be empty", "Process instance ids", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "Process instance ids", processInstanceIds);
commandContext.getAuthorizationManager().checkAuthorization(Permissions.CREATE, Resources.BATCH);
ProcessDefinitionEntity processDefinition = getProcessDefinition(commandContext, builder.getProcessDefinitionId());
ensureNotNull(BadUserRequestException.class, "Process definition id cannot be null", processDefinition);
writeUserOperationLog(commandContext, processDefinition, processInstanceIds.size(), true);
BatchEntity batch = createBatch(commandContext, instructions, processInstanceIds, processDefinition);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class MigrateProcessInstanceBatchCmd method createBatch.
protected BatchEntity createBatch(CommandContext commandContext, MigrationPlan migrationPlan, Collection<String> processInstanceIds, ProcessDefinitionEntity sourceProcessDefinition) {
ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
BatchJobHandler<MigrationBatchConfiguration> batchJobHandler = getBatchJobHandler(processEngineConfiguration);
MigrationBatchConfiguration configuration = new MigrationBatchConfiguration(new ArrayList<String>(processInstanceIds), migrationPlan, executionBuilder.isSkipCustomListeners(), executionBuilder.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(sourceProcessDefinition.getTenantId());
commandContext.getBatchManager().insert(batch);
return batch;
}
use of org.camunda.bpm.engine.impl.batch.BatchEntity in project camunda-bpm-platform by camunda.
the class MigrateProcessInstanceBatchCmd method execute.
@Override
public Batch execute(CommandContext commandContext) {
MigrationPlan migrationPlan = executionBuilder.getMigrationPlan();
Collection<String> processInstanceIds = collectProcessInstanceIds(commandContext);
ensureNotNull(BadUserRequestException.class, "Migration plan cannot be null", "migration plan", migrationPlan);
ensureNotEmpty(BadUserRequestException.class, "Process instance ids cannot empty", "process instance ids", processInstanceIds);
ensureNotContainsNull(BadUserRequestException.class, "Process instance ids cannot be null", "process instance ids", processInstanceIds);
ProcessDefinitionEntity sourceProcessDefinition = resolveSourceProcessDefinition(commandContext);
ProcessDefinitionEntity targetProcessDefinition = resolveTargetProcessDefinition(commandContext);
checkAuthorizations(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds);
writeUserOperationLog(commandContext, sourceProcessDefinition, targetProcessDefinition, processInstanceIds.size(), true);
BatchEntity batch = createBatch(commandContext, migrationPlan, processInstanceIds, sourceProcessDefinition);
batch.createSeedJobDefinition();
batch.createMonitorJobDefinition();
batch.createBatchJobDefinition();
batch.fireHistoricStartEvent();
batch.createSeedJob();
return batch;
}
Aggregations