Search in sources :

Example 21 with HistoryService

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

the class BatchHelper method removeAllRunningAndHistoricBatches.

/**
 * Remove all batches and historic batches. Usually called in {@link org.junit.After} method.
 */
public void removeAllRunningAndHistoricBatches() {
    HistoryService historyService = getHistoryService();
    ManagementService managementService = getManagementService();
    for (Batch batch : managementService.createBatchQuery().list()) {
        managementService.deleteBatch(batch.getId(), true);
    }
    // remove history of completed batches
    for (HistoricBatch historicBatch : historyService.createHistoricBatchQuery().list()) {
        historyService.deleteHistoricBatch(historicBatch.getId());
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) ManagementService(org.camunda.bpm.engine.ManagementService) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) HistoryService(org.camunda.bpm.engine.HistoryService)

Example 22 with HistoryService

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

the class UpdateHistoricValueDelegate method execute.

public void execute(DelegateExecution execution) throws Exception {
    HistoryService historyService = execution.getProcessEngineServices().getHistoryService();
    HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery().variableName("listVar").singleResult();
    List<String> list = (List<String>) variableInstance.getValue();
    // implicit update of the list, should not trigger an update
    // of the value since we deal with historic variables
    list.add(NEW_ELEMENT);
}
Also used : HistoryService(org.camunda.bpm.engine.HistoryService) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) List(java.util.List)

Example 23 with HistoryService

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

the class UpdateHistoricDetailValueDelegate method execute.

public void execute(DelegateExecution execution) throws Exception {
    HistoryService historyService = execution.getProcessEngineServices().getHistoryService();
    HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery().variableName("listVar").singleResult();
    HistoricVariableUpdate initialUpdate = (HistoricVariableUpdate) historyService.createHistoricDetailQuery().variableUpdates().variableInstanceId(variableInstance.getId()).orderPartiallyByOccurrence().asc().list().get(0);
    List<String> list = (List<String>) initialUpdate.getValue();
    // implicit update of the list, should not trigger an update
    // of the value since we deal with historic variables
    list.add(NEW_ELEMENT);
}
Also used : HistoricVariableUpdate(org.camunda.bpm.engine.history.HistoricVariableUpdate) HistoryService(org.camunda.bpm.engine.HistoryService) HistoricVariableInstance(org.camunda.bpm.engine.history.HistoricVariableInstance) List(java.util.List)

Aggregations

HistoryService (org.camunda.bpm.engine.HistoryService)23 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)9 ManagementService (org.camunda.bpm.engine.ManagementService)5 Batch (org.camunda.bpm.engine.batch.Batch)4 ArrayList (java.util.ArrayList)3 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)3 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)3 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)3 VariableMap (org.camunda.bpm.engine.variable.VariableMap)3 List (java.util.List)2 FormService (org.camunda.bpm.engine.FormService)2 RepositoryService (org.camunda.bpm.engine.RepositoryService)2 TaskService (org.camunda.bpm.engine.TaskService)2 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)2 VariableMapImpl (org.camunda.bpm.engine.variable.impl.VariableMapImpl)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Date (java.util.Date)1 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)1 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)1