public static void createOrUpdateHistoryLevel(final ProcessEngineConfigurationImpl processEngineConfiguration) {
processEngineConfiguration.getCommandExecutorTxRequired()
.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
DbEntityManager dbEntityManager = commandContext.getDbEntityManager();
PropertyEntity historyLevelProperty = dbEntityManager.selectById(PropertyEntity.class, "historyLevel");
if (historyLevelProperty != null) {
if (processEngineConfiguration.getHistoryLevel().getId() != new Integer(historyLevelProperty.getValue())) {
historyLevelProperty.setValue(Integer.toString(processEngineConfiguration.getHistoryLevel().getId()));
dbEntityManager.merge(historyLevelProperty);
}
} else {
SchemaOperationsProcessEngineBuild.dbCreateHistoryLevel(dbEntityManager);
}