use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.
the class RestartProcessInstancesCmd method resolveStartActivityInstance.
protected HistoricActivityInstance resolveStartActivityInstance(HistoricProcessInstance processInstance) {
HistoryService historyService = Context.getProcessEngineConfiguration().getHistoryService();
String processInstanceId = processInstance.getId();
String startActivityId = processInstance.getStartActivityId();
ensureNotNull("startActivityId", startActivityId);
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).activityId(startActivityId).orderPartiallyByOccurrence().asc().list();
ensureNotEmpty("historicActivityInstances", historicActivityInstances);
HistoricActivityInstance startActivityInstance = historicActivityInstances.get(0);
return startActivityInstance;
}
use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.
the class RestartProcessInstancesCmd method collectInitialVariables.
protected VariableMap collectInitialVariables(CommandContext commandContext, HistoricProcessInstance processInstance) {
HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService();
HistoricActivityInstance startActivityInstance = resolveStartActivityInstance(processInstance);
HistoricDetailQueryImpl query = (HistoricDetailQueryImpl) historyService.createHistoricDetailQuery().variableUpdates().executionId(processInstance.getId()).activityInstanceId(startActivityInstance.getId());
List<HistoricDetail> historicDetails = query.sequenceCounter(1).list();
VariableMap variables = new VariableMapImpl();
for (HistoricDetail detail : historicDetails) {
HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail;
variables.putValueTyped(variableUpdate.getVariableName(), variableUpdate.getTypedValue());
}
return variables;
}
use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.
the class TestHelper method clearUserOperationLog.
public static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration) {
if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) {
HistoryService historyService = processEngineConfiguration.getHistoryService();
List<UserOperationLogEntry> logs = historyService.createUserOperationLogQuery().list();
for (UserOperationLogEntry log : logs) {
historyService.deleteUserOperationLogEntry(log.getId());
}
}
}
use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.
the class HistoricBatchQueryAuthorizationTest method removeAllRunningAndHistoricBatches.
private void removeAllRunningAndHistoricBatches() {
HistoryService historyService = engineRule.getHistoryService();
ManagementService managementService = engineRule.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 SetExternalTaskRetriesUserOperationLogTest method removeAllRunningAndHistoricBatches.
@After
public void removeAllRunningAndHistoricBatches() {
HistoryService historyService = rule.getHistoryService();
ManagementService managementService = rule.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());
}
}
Aggregations