RulesRepositoryAdministrator admin = new RulesRepositoryAdministrator(sessionForSetup);
if (!admin.isRepositoryInitialized()) {
try {
configurator.setupRepository(sessionForSetup);
} catch (RepositoryException e) {
throw new RulesRepositoryException(e);
}
}
//
//Migrate v4 ruleflows to v5
//This section checks if the repository contains drools v4
//ruleflows that need to be migrated to drools v5
//
RulesRepository repo = new RulesRepository(sessionForSetup);
try {
if (MigrateRepository.needsRuleflowMigration(repo)) {
MigrateRepository.migrateRuleflows(repo);
}
} catch (RepositoryException e) {
e.printStackTrace();
throw new RulesRepositoryException(e);
}
}