Search in sources :

Example 1 with ComplexityRating

use of com.khartec.waltz.model.complexity.ComplexityRating 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 2 with ComplexityRating

use of com.khartec.waltz.model.complexity.ComplexityRating in project waltz by khartec.

the class AppViewService method getAppView.

public AppView getAppView(long id) {
    EntityReference ref = ImmutableEntityReference.builder().kind(EntityKind.APPLICATION).id(id).build();
    Future<Application> application = dbExecutorPool.submit(() -> applicationService.getById(id));
    Future<OrganisationalUnit> orgUnit = dbExecutorPool.submit(() -> organisationalUnitService.getByAppId(id));
    Future<List<String>> tags = dbExecutorPool.submit(() -> entityTagService.findTagsForEntityReference(mkRef(EntityKind.APPLICATION, id)));
    Future<List<String>> aliases = dbExecutorPool.submit(() -> entityAliasService.findAliasesForEntityReference(ref));
    Future<ComplexityRating> complexity = dbExecutorPool.submit(() -> complexityRatingService.getForApp(id));
    return Unchecked.supplier(() -> ImmutableAppView.builder().app(application.get()).organisationalUnit(orgUnit.get()).tags(tags.get()).aliases(aliases.get()).complexity(complexity.get()).build()).get();
}
Also used : ImmutableEntityReference(com.khartec.waltz.model.ImmutableEntityReference) EntityReference(com.khartec.waltz.model.EntityReference) List(java.util.List) ComplexityRating(com.khartec.waltz.model.complexity.ComplexityRating) OrganisationalUnit(com.khartec.waltz.model.orgunit.OrganisationalUnit) Application(com.khartec.waltz.model.application.Application)

Aggregations

EntityReference (com.khartec.waltz.model.EntityReference)2 ComplexityRating (com.khartec.waltz.model.complexity.ComplexityRating)2 OrganisationalUnitDao (com.khartec.waltz.data.orgunit.OrganisationalUnitDao)1 ImmutableEntityReference (com.khartec.waltz.model.ImmutableEntityReference)1 Application (com.khartec.waltz.model.application.Application)1 OrganisationalUnit (com.khartec.waltz.model.orgunit.OrganisationalUnit)1 ComplexityRatingService (com.khartec.waltz.service.complexity.ComplexityRatingService)1 ServerComplexityService (com.khartec.waltz.service.complexity.ServerComplexityService)1 List (java.util.List)1 DSLContext (org.jooq.DSLContext)1 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)1