use of org.finos.waltz.common.hierarchy.FlatNode in project waltz by khartec.
the class LogicalFlowDecoratorRatingsServiceHarness method main.
public static void main(String[] args) throws SQLException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
FlowClassificationRuleService authoritativeSourceService = ctx.getBean(FlowClassificationRuleService.class);
List<FlowClassificationRule> authSources = authoritativeSourceService.findAll();
OrganisationalUnitService organisationalUnitService = ctx.getBean(OrganisationalUnitService.class);
OrganisationalUnitDao organisationalUnitDao = ctx.getBean(OrganisationalUnitDao.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
dsl.select(ORGANISATIONAL_UNIT.fields()).from(ORGANISATIONAL_UNIT).fetch(organisationalUnitDao.TO_DOMAIN_MAPPER);
EntityHierarchyService hierarchyService = ctx.getBean(EntityHierarchyService.class);
List<OrganisationalUnit> allOrgUnits = organisationalUnitService.findAll();
List<FlatNode<OrganisationalUnit, Long>> ouNodes = ListUtilities.map(allOrgUnits, ou -> new FlatNode<>(ou.id().get(), ou.parentId(), ou));
Forest<OrganisationalUnit, Long> ouForest = HierarchyUtilities.toForest(ouNodes);
Map<Long, Node<OrganisationalUnit, Long>> nodeMap = ouForest.getAllNodes();
}
Aggregations