public VariableCreate(Variable variable) {
this.variable = variable;
}
public void process() {
DbSession dbSession = EnvironmentImpl.getFromCurrent(DbSession.class);
dbSession.save(variable);
HistoryProcessInstanceImpl historyProcessInstance = null;
ExecutionImpl processInstance = variable.getProcessInstance();
if (processInstance!=null) {
long processInstanceDbid = processInstance.getDbid();
historyProcessInstance = (HistoryProcessInstanceImpl)
dbSession.get(HistoryProcessInstanceImpl.class, processInstanceDbid);
}
HistoryTaskImpl historyTask = null;
TaskImpl task = variable.getTask();
if (task!=null) {
long taskDbid = task.getDbid();
historyTask = (HistoryTaskImpl)
dbSession.get(HistoryTaskImpl.class, taskDbid);
}
HistoryVariableImpl historyVariable = new HistoryVariableImpl(historyProcessInstance, historyTask, variable);
dbSession.save(historyVariable);
}