use of org.camunda.bpm.engine.impl.batch.BatchConfiguration in project camunda-bpm-platform by camunda.
the class DeleteHistoricProcessInstancesJobHandler method execute.
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
commandContext.disableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
try {
commandContext.getProcessEngineConfiguration().getHistoryService().deleteHistoricProcessInstances(batchConfiguration.getIds());
} finally {
commandContext.enableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
}
commandContext.getByteArrayManager().delete(configurationEntity);
}
use of org.camunda.bpm.engine.impl.batch.BatchConfiguration 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;
}
use of org.camunda.bpm.engine.impl.batch.BatchConfiguration in project camunda-bpm-platform by camunda.
the class UpdateProcessInstancesSuspendStateBatchCmd method createBatch.
protected BatchEntity createBatch(CommandContext commandContext, Collection<String> processInstanceIds) {
ProcessEngineConfigurationImpl processEngineConfiguration = commandContext.getProcessEngineConfiguration();
BatchJobHandler batchJobHandler = getBatchJobHandler(processEngineConfiguration);
BatchConfiguration configuration = getAbstractIdsBatchConfiguration(new ArrayList<String>(processInstanceIds));
BatchEntity batch = new BatchEntity();
batch.setType(batchJobHandler.getType());
batch.setTotalJobs(calculateSize(processEngineConfiguration, (UpdateProcessInstancesSuspendStateBatchConfiguration) configuration));
batch.setBatchJobsPerSeed(processEngineConfiguration.getBatchJobsPerSeed());
batch.setInvocationsPerBatchJob(processEngineConfiguration.getInvocationsPerBatchJob());
batch.setConfigurationBytes(batchJobHandler.writeConfiguration(configuration));
commandContext.getBatchManager().insert(batch);
return batch;
}
use of org.camunda.bpm.engine.impl.batch.BatchConfiguration in project camunda-bpm-platform by camunda.
the class DeleteHistoricDecisionInstancesJobHandler method execute.
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
ByteArrayEntity configurationEntity = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());
BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());
boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
commandContext.disableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
try {
commandContext.getProcessEngineConfiguration().getHistoryService().deleteHistoricDecisionInstancesBulk(batchConfiguration.getIds());
} finally {
commandContext.enableUserOperationLog();
commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
}
commandContext.getByteArrayManager().delete(configurationEntity);
}
Aggregations