/** customized insert behavior for HistoricVariableUpdateEventEntity */ protected void insertHistoricVariableUpdateEntity( HistoricVariableUpdateEventEntity historyEvent) { DbSqlSession dbSqlSession = getDbSqlSession(); // insert update only if history level = FULL int historyLevel = Context.getProcessEngineConfiguration().getHistoryLevel(); if (historyLevel == ProcessEngineConfigurationImpl.HISTORYLEVEL_FULL) { // insert byte array entity (if applicable) byte[] byteValue = historyEvent.getByteValue(); if (byteValue != null) { ByteArrayEntity byteArrayEntity = new ByteArrayEntity(historyEvent.getVariableName(), byteValue); Context.getCommandContext().getDbSqlSession().insert(byteArrayEntity); historyEvent.setByteArrayId(byteArrayEntity.getId()); } dbSqlSession.insert(historyEvent); } // always insert/update HistoricProcessVariableInstance if (HistoryEvent.VARIABLE_EVENT_TYPE_CREATE.equals(historyEvent.getEventType())) { HistoricVariableInstanceEntity persistentObject = new HistoricVariableInstanceEntity(historyEvent); dbSqlSession.insert(persistentObject); } else if (HistoryEvent.VARIABLE_EVENT_TYPE_UPDATE.equals(historyEvent.getEventType())) { HistoricVariableInstanceEntity historicVariableInstanceEntity = dbSqlSession.selectById( HistoricVariableInstanceEntity.class, historyEvent.getVariableInstanceId()); historicVariableInstanceEntity.updateFromEvent(historyEvent); } else if (HistoryEvent.VARIABLE_EVENT_TYPE_DELETE.equals(historyEvent.getEventType())) { HistoricVariableInstanceEntity historicVariableInstanceEntity = dbSqlSession.selectById( HistoricVariableInstanceEntity.class, historyEvent.getVariableInstanceId()); if (historicVariableInstanceEntity != null) { historicVariableInstanceEntity.delete(); } } }
public HistoricVariableInstanceEntity(HistoricVariableUpdateEventEntity historyEvent) { updateFromEvent(historyEvent); }