Search in sources :

Example 1 with OrganisationalUnitDao

use of com.khartec.waltz.data.orgunit.OrganisationalUnitDao in project waltz by khartec.

the class OrgUnitHarness method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    OrganisationalUnitDao dao = ctx.getBean(OrganisationalUnitDao.class);
    System.out.println(dao.findImmediateHierarchy(50L));
}
Also used : OrganisationalUnitDao(com.khartec.waltz.data.orgunit.OrganisationalUnitDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext)

Example 2 with OrganisationalUnitDao

use of com.khartec.waltz.data.orgunit.OrganisationalUnitDao in project waltz by khartec.

the class ServerComplexityHarness method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    OrganisationalUnitDao ouDao = ctx.getBean(OrganisationalUnitDao.class);
    ServerComplexityService serverService = ctx.getBean(ServerComplexityService.class);
    ComplexityRatingService complexityService = ctx.getBean(ComplexityRatingService.class);
    // EntityReference entityReference = EntityReference.mkRef(EntityKind.PERSON, 1);
    EntityReference entityReference = EntityReference.mkRef(EntityKind.PERSON, 63);
    List<ComplexityRating> complexity = FunctionUtilities.time("complexity", () -> complexityService.findForAppIdSelector(IdSelectionOptions.mkOpts(entityReference, HierarchyQueryScope.CHILDREN)));
}
Also used : OrganisationalUnitDao(com.khartec.waltz.data.orgunit.OrganisationalUnitDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ComplexityRatingService(com.khartec.waltz.service.complexity.ComplexityRatingService) ServerComplexityService(com.khartec.waltz.service.complexity.ServerComplexityService) EntityReference(com.khartec.waltz.model.EntityReference) DSLContext(org.jooq.DSLContext) ComplexityRating(com.khartec.waltz.model.complexity.ComplexityRating)

Example 3 with OrganisationalUnitDao

use of com.khartec.waltz.data.orgunit.OrganisationalUnitDao in project waltz by khartec.

the class EntityStatisticGenerator method apply.

@Override
public Map<String, Integer> apply(ApplicationContext context) {
    DSLContext dsl = context.getBean(DSLContext.class);
    ApplicationDao applicationDao = context.getBean(ApplicationDao.class);
    OrganisationalUnitDao organisationalUnitDao = context.getBean(OrganisationalUnitDao.class);
    EntityStatisticValueDao valueDao = context.getBean(EntityStatisticValueDao.class);
    EntityStatisticDefinitionDao definitionDao = context.getBean(EntityStatisticDefinitionDao.class);
    EntityHierarchyService entityHierarchyService = context.getBean(EntityHierarchyService.class);
    Application[] applications = applicationDao.getAll().toArray(new Application[0]);
    OrganisationalUnit[] orgUnits = organisationalUnitDao.findAll().toArray(new OrganisationalUnit[0]);
    dsl.deleteFrom(ENTITY_STATISTIC_DEFINITION).where(ENTITY_STATISTIC_DEFINITION.PROVENANCE.eq("DEMO")).execute();
    System.out.println("deleted existing statistics (provenance: '" + PROVENANCE + "')");
    dsl.update(ENTITY_STATISTIC_VALUE).set(ENTITY_STATISTIC_VALUE.CURRENT, false).where(ENTITY_STATISTIC_VALUE.PROVENANCE.eq("DEMO")).execute();
    System.out.println("marked existing statistic values as non-current (provenance: '" + PROVENANCE + "')");
    definitionDao.insert(SDLC);
    definitionDao.insert(SDLC_TECH);
    definitionDao.insert(SDLC_PROCESS);
    definitionDao.insert(SDLC_JIRA);
    definitionDao.insert(SDLC_SVN);
    definitionDao.insert(SDLC_WIKI);
    definitionDao.insert(AUDIT);
    definitionDao.insert(SERVER_COUNT);
    definitionDao.insert(PRE_COMPUTED);
    createAdoptionStatsFor(SDLC_TECH, applications, valueDao);
    createAdoptionStatsFor(SDLC_PROCESS, applications, valueDao);
    createAdoptionStatsFor(SDLC_JIRA, applications, valueDao);
    createAdoptionStatsFor(SDLC_SVN, applications, valueDao);
    createAdoptionStatsFor(SDLC_WIKI, applications, valueDao);
    createIntStatsFor(AUDIT, applications, valueDao, 20, failIfPositiveFn);
    createIntStatsFor(SDLC, applications, valueDao, 20, failIfPositiveFn);
    createIntStatsFor(SERVER_COUNT, applications, valueDao, 20, (x, y) -> "VIRTUAL");
    createIntStatsFor(SERVER_COUNT, applications, valueDao, 20, (x, y) -> "BARE_METAL");
    createPreComputedStatsFor(PRE_COMPUTED, orgUnits, valueDao);
    entityHierarchyService.buildFor(EntityKind.ENTITY_STATISTIC);
    System.out.println("Rebuilt entity hierarchy");
    return null;
}
Also used : OrganisationalUnitDao(com.khartec.waltz.data.orgunit.OrganisationalUnitDao) EntityStatisticDefinitionDao(com.khartec.waltz.data.entity_statistic.EntityStatisticDefinitionDao) EntityStatisticValueDao(com.khartec.waltz.data.entity_statistic.EntityStatisticValueDao) EntityHierarchyService(com.khartec.waltz.service.entity_hierarchy.EntityHierarchyService) DSLContext(org.jooq.DSLContext) ApplicationDao(com.khartec.waltz.data.application.ApplicationDao) OrganisationalUnit(com.khartec.waltz.model.orgunit.OrganisationalUnit) Application(com.khartec.waltz.model.application.Application)

Example 4 with OrganisationalUnitDao

use of com.khartec.waltz.data.orgunit.OrganisationalUnitDao in project waltz by khartec.

the class EndUserAppMaker method main.

public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    OrganisationalUnitDao organisationalUnitDao = ctx.getBean(OrganisationalUnitDao.class);
    DSLContext dsl = ctx.getBean(DSLContext.class);
    List<Long> ids = IdUtilities.toIds(organisationalUnitDao.findAll());
    String[] subjects = { "Trade", "Risk", "Balance", "PnL", "Rate", "Fines", "Party", "Confirmations", "Settlement", "Instruction", "Person", "Profit", "Margin", "Finance", "Account" };
    String[] types = { "Report", "Summary", "Draft", "Calculations", "Breaks", "Record", "Statement", "Information", "Pivot" };
    String[] tech = { "MS ACCESS", "MS EXCEL", "VBA" };
    dsl.delete(END_USER_APPLICATION).execute();
    final Long[] idCounter = { 1L };
    ids.forEach(ouId -> {
        for (int i = 0; i < new Random().nextInt(100) + 40; i++) {
            EndUserApplicationRecord record = dsl.newRecord(END_USER_APPLICATION);
            String name = new StringBuilder().append(randomPick(subjects)).append(" ").append(randomPick(subjects)).append(" ").append(randomPick(types)).append(" ").append(randomPick(types)).toString();
            record.setName(name);
            record.setDescription("About the " + name + " End user app");
            record.setKind(randomPick(tech));
            record.setRiskRating(randomPick(Criticality.values()).name());
            record.setLifecyclePhase(randomPick(LifecyclePhase.values()).name());
            record.setOrganisationalUnitId(ouId);
            record.setId(idCounter[0]++);
            record.insert();
        }
    });
}
Also used : OrganisationalUnitDao(com.khartec.waltz.data.orgunit.OrganisationalUnitDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Random(java.util.Random) DSLContext(org.jooq.DSLContext) EndUserApplicationRecord(com.khartec.waltz.schema.tables.records.EndUserApplicationRecord)

Example 5 with OrganisationalUnitDao

use of com.khartec.waltz.data.orgunit.OrganisationalUnitDao in project waltz by khartec.

the class LogicalFlowDecoratorRatingsServiceHarness method main.

public static void main(String[] args) throws SQLException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
    AuthoritativeSourceService authoritativeSourceService = ctx.getBean(AuthoritativeSourceService.class);
    List<AuthoritativeSource> 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();
}
Also used : OrganisationalUnitService(com.khartec.waltz.service.orgunit.OrganisationalUnitService) OrganisationalUnitDao(com.khartec.waltz.data.orgunit.OrganisationalUnitDao) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) EntityHierarchyService(com.khartec.waltz.service.entity_hierarchy.EntityHierarchyService) Node(com.khartec.waltz.common.hierarchy.Node) FlatNode(com.khartec.waltz.common.hierarchy.FlatNode) AuthoritativeSource(com.khartec.waltz.model.authoritativesource.AuthoritativeSource) DSLContext(org.jooq.DSLContext) AuthoritativeSourceService(com.khartec.waltz.service.authoritative_source.AuthoritativeSourceService) OrganisationalUnit(com.khartec.waltz.model.orgunit.OrganisationalUnit) FlatNode(com.khartec.waltz.common.hierarchy.FlatNode)

Aggregations

OrganisationalUnitDao (com.khartec.waltz.data.orgunit.OrganisationalUnitDao)5 DSLContext (org.jooq.DSLContext)4 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)4 OrganisationalUnit (com.khartec.waltz.model.orgunit.OrganisationalUnit)2 EntityHierarchyService (com.khartec.waltz.service.entity_hierarchy.EntityHierarchyService)2 FlatNode (com.khartec.waltz.common.hierarchy.FlatNode)1 Node (com.khartec.waltz.common.hierarchy.Node)1 ApplicationDao (com.khartec.waltz.data.application.ApplicationDao)1 EntityStatisticDefinitionDao (com.khartec.waltz.data.entity_statistic.EntityStatisticDefinitionDao)1 EntityStatisticValueDao (com.khartec.waltz.data.entity_statistic.EntityStatisticValueDao)1 EntityReference (com.khartec.waltz.model.EntityReference)1 Application (com.khartec.waltz.model.application.Application)1 AuthoritativeSource (com.khartec.waltz.model.authoritativesource.AuthoritativeSource)1 ComplexityRating (com.khartec.waltz.model.complexity.ComplexityRating)1 EndUserApplicationRecord (com.khartec.waltz.schema.tables.records.EndUserApplicationRecord)1 AuthoritativeSourceService (com.khartec.waltz.service.authoritative_source.AuthoritativeSourceService)1 ComplexityRatingService (com.khartec.waltz.service.complexity.ComplexityRatingService)1 ServerComplexityService (com.khartec.waltz.service.complexity.ServerComplexityService)1 OrganisationalUnitService (com.khartec.waltz.service.orgunit.OrganisationalUnitService)1 Random (java.util.Random)1