Search in sources :

Example 1 with HistoricDetailQueryImpl

use of org.camunda.bpm.engine.impl.HistoricDetailQueryImpl 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;
}
Also used : HistoricVariableUpdate(org.camunda.bpm.engine.history.HistoricVariableUpdate) HistoricDetail(org.camunda.bpm.engine.history.HistoricDetail) VariableMapImpl(org.camunda.bpm.engine.variable.impl.VariableMapImpl) VariableMap(org.camunda.bpm.engine.variable.VariableMap) HistoricDetailQueryImpl(org.camunda.bpm.engine.impl.HistoricDetailQueryImpl) HistoryService(org.camunda.bpm.engine.HistoryService) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance)

Aggregations

HistoryService (org.camunda.bpm.engine.HistoryService)1 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)1 HistoricDetail (org.camunda.bpm.engine.history.HistoricDetail)1 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)1 HistoricDetailQueryImpl (org.camunda.bpm.engine.impl.HistoricDetailQueryImpl)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1 VariableMapImpl (org.camunda.bpm.engine.variable.impl.VariableMapImpl)1