private final static Logger log = Logger.getLogger(SchemaOperationsProcessEngineBuild.class.getName());
public Object execute(CommandContext commandContext) {
String databaseSchemaUpdate = Context.getProcessEngineConfiguration().getDatabaseSchemaUpdate();
PersistenceSession persistenceSession = commandContext.getSession(PersistenceSession.class);
if (ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)) {
try {
persistenceSession.dbSchemaDrop();
} catch (RuntimeException e) {
// ignore
}
}
if ( ProcessEngineConfiguration.DB_SCHEMA_UPDATE_CREATE_DROP.equals(databaseSchemaUpdate)
|| ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_DROP_CREATE.equals(databaseSchemaUpdate)
|| ProcessEngineConfigurationImpl.DB_SCHEMA_UPDATE_CREATE.equals(databaseSchemaUpdate)
) {
persistenceSession.dbSchemaCreate();
} else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE.equals(databaseSchemaUpdate)) {
persistenceSession.dbSchemaCheckVersion();
} else if (ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE.equals(databaseSchemaUpdate)) {
persistenceSession.dbSchemaUpdate();
}
DbEntityManager entityManager = commandContext.getSession(DbEntityManager.class);
checkHistoryLevel(entityManager);