Search in sources :

Example 1 with BatchConfiguration

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);
}
Also used : ByteArrayEntity(org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity) BatchConfiguration(org.camunda.bpm.engine.impl.batch.BatchConfiguration)

Example 2 with BatchConfiguration

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;
}
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 3 with BatchConfiguration

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;
}
Also used : UpdateProcessInstancesSuspendStateBatchConfiguration(org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateBatchConfiguration) BatchJobHandler(org.camunda.bpm.engine.impl.batch.BatchJobHandler) UpdateProcessInstancesSuspendStateBatchConfiguration(org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateBatchConfiguration) 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 4 with BatchConfiguration

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);
}
Also used : ByteArrayEntity(org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity) BatchConfiguration(org.camunda.bpm.engine.impl.batch.BatchConfiguration)

Aggregations

BatchConfiguration (org.camunda.bpm.engine.impl.batch.BatchConfiguration)4 BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)2 BatchJobHandler (org.camunda.bpm.engine.impl.batch.BatchJobHandler)2 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)2 ByteArrayEntity (org.camunda.bpm.engine.impl.persistence.entity.ByteArrayEntity)2 UpdateProcessInstancesSuspendStateBatchConfiguration (org.camunda.bpm.engine.impl.batch.update.UpdateProcessInstancesSuspendStateBatchConfiguration)1