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() != new Integer(historyLevelProperty.getValue())) {
historyLevelProperty.setValue(Integer.toString(processEngineConfiguration.getHistoryLevel()));
dbEntityManager.merge(historyLevelProperty);
}
} else {
SchemaOperationsProcessEngineBuild.dbCreateHistoryLevel(dbEntityManager);
}