Search in sources :

Example 1 with DatabaseInformationDao

use of org.finos.waltz.data.database_information.DatabaseInformationDao in project waltz by khartec.

the class DatabaseHarness method main.

public static void main(String[] args) throws ParseException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DatabaseInformationService databaseInfoService = ctx.getBean(DatabaseInformationService.class);
    DatabaseInformationDao databaseDao = ctx.getBean(DatabaseInformationDao.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    /*
        List<DatabaseInformation> dbs = databaseDao.findByApplicationId(801L);
        System.out.println(dbs.size());


        List<Tally<String>> eolCounts = calculateStringTallies(
                dsl,
                DATABASE_INFORMATION,
                DSL.when(DATABASE_INFORMATION.END_OF_LIFE_DATE.lt(DSL.currentDate()), DSL.inline(EndOfLifeStatus.END_OF_LIFE.name()))
                        .otherwise(DSL.inline(EndOfLifeStatus.NOT_END_OF_LIFE.name())),
                DSL.trueCondition());

        System.out.println(eolCounts);
        */
    IdSelectionOptions options = IdSelectionOptions.mkOpts(EntityReference.mkRef(EntityKind.ORG_UNIT, 10), HierarchyQueryScope.CHILDREN);
    for (int i = 0; i < 5; i++) {
        HarnessUtilities.time("stats", () -> databaseInfoService.calculateStatsForAppIdSelector(options));
    }
}
Also used : DatabaseInformationDao(org.finos.waltz.data.database_information.DatabaseInformationDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) DSLContext(org.jooq.DSLContext) DatabaseInformationService(org.finos.waltz.service.database_information.DatabaseInformationService) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Aggregations

DatabaseInformationDao (org.finos.waltz.data.database_information.DatabaseInformationDao)1 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)1 DatabaseInformationService (org.finos.waltz.service.database_information.DatabaseInformationService)1 DSLContext (org.jooq.DSLContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1