@Bean public DmnEngine dmnEngine(@SuppressWarnings("unused") ProcessEngine processEngine) { // The process engine needs to be injected, as otherwise it won't be initialized, which means that the DmnEngine is not initialized yet if (!DmnEngines.isInitialized()) { throw new IllegalStateException("DMN engine has not been initialized"); } return DmnEngines.getDefaultDmnEngine(); } }
@Bean public DmnEngine dmnEngine(@SuppressWarnings("unused") AppEngine appEngine) { // The app engine needs to be injected, as otherwise it won't be initialized, which means that the DmnEngine is not initialized yet if (!DmnEngines.isInitialized()) { throw new IllegalStateException("DMN engine has not been initialized"); } return DmnEngines.getDefaultDmnEngine(); } }
@Override protected void initializeDmnEngine() { if (cachedDmnEngine == null) { LOGGER.info("No cached dmn engine found for test. Retrieving the default engine."); DmnEngines.destroy(); // Just to be sure we're not getting any previously cached version cachedDmnEngine = DmnEngines.getDefaultDmnEngine(); if (cachedDmnEngine == null) { throw new FlowableException("no default dmn engine available"); } } dmnEngine = cachedDmnEngine; dmnEngineConfiguration = ((DmnEngineImpl) dmnEngine).getDmnEngineConfiguration(); }
public static void main(String[] args) { try { DmnEngine dmnEngine = DmnEngines.getDefaultDmnEngine(); DataSource dataSource = dmnEngine.getDmnEngineConfiguration().getDataSource(); DatabaseConnection connection = new JdbcConnection(dataSource.getConnection()); Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(connection); database.setDatabaseChangeLogTableName(DmnEngineConfiguration.LIQUIBASE_CHANGELOG_PREFIX + database.getDatabaseChangeLogTableName()); database.setDatabaseChangeLogLockTableName(DmnEngineConfiguration.LIQUIBASE_CHANGELOG_PREFIX + database.getDatabaseChangeLogLockTableName()); if (StringUtils.isNotEmpty(dmnEngine.getDmnEngineConfiguration().getDatabaseSchema())) { database.setDefaultSchemaName(dmnEngine.getDmnEngineConfiguration().getDatabaseSchema()); database.setLiquibaseSchemaName(dmnEngine.getDmnEngineConfiguration().getDatabaseSchema()); } if (StringUtils.isNotEmpty(dmnEngine.getDmnEngineConfiguration().getDatabaseCatalog())) { database.setDefaultCatalogName(dmnEngine.getDmnEngineConfiguration().getDatabaseCatalog()); database.setLiquibaseCatalogName(dmnEngine.getDmnEngineConfiguration().getDatabaseCatalog()); } Liquibase liquibase = new Liquibase("org/flowable/dmn/db/liquibase/flowable-dmn-db-changelog.xml", new ClassLoaderResourceAccessor(), database); liquibase.dropAll(); liquibase.getDatabase().close(); } catch (Exception e) { e.printStackTrace(); } } }