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());
}
}
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);
}
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);
}
Aggregations