Search in sources :

Example 36 with IdSelectionOptions

use of org.finos.waltz.model.IdSelectionOptions in project waltz by khartec.

the class EntityStatisticEndpoint method calculateHistoricStatTallyRoute.

private List<TallyPack<String>> calculateHistoricStatTallyRoute(Request request, Response response) throws IOException {
    IdSelectionOptions idSelectionOptions = WebUtilities.readIdSelectionOptionsFromBody(request);
    RollupKind rollupKind = extractRollupKind(request);
    Duration duration = EnumUtilities.readEnum(request.queryParams("duration"), Duration.class, s -> Duration.MONTH);
    Long statisticId = WebUtilities.getId(request);
    return entityStatisticService.calculateHistoricStatTally(statisticId, rollupKind, idSelectionOptions, duration);
}
Also used : Duration(org.finos.waltz.model.Duration) RollupKind(org.finos.waltz.model.entity_statistic.RollupKind) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Example 37 with IdSelectionOptions

use of org.finos.waltz.model.IdSelectionOptions in project waltz by khartec.

the class AllocationsExtractor method registerExtractForAll.

private void registerExtractForAll(String path) {
    post(path, (request, response) -> {
        IdSelectionOptions idSelectionOptions = WebUtilities.readIdSelectionOptionsFromBody(request);
        SelectConditionStep<Record> qry = prepareQuery(DSL.trueCondition(), idSelectionOptions);
        return writeExtract("all_allocations", qry, request, response);
    });
}
Also used : IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Example 38 with IdSelectionOptions

use of org.finos.waltz.model.IdSelectionOptions in project waltz by khartec.

the class AllocationsExtractor method registerExtractForCategory.

private void registerExtractForCategory(String path) {
    post(path, (request, response) -> {
        long measurableCategoryId = WebUtilities.getLong(request, "measurableCategoryId");
        IdSelectionOptions applicationIdSelectionOptions = WebUtilities.readIdSelectionOptionsFromBody(request);
        Record1<String> fileName = dsl.select(DSL.concat(MEASURABLE_CATEGORY.NAME, "_all_allocations")).from(MEASURABLE_CATEGORY).where(MEASURABLE_CATEGORY.ID.eq(measurableCategoryId)).fetchOne();
        SelectConditionStep<Record> qry = prepareQuery(MEASURABLE.MEASURABLE_CATEGORY_ID.eq(measurableCategoryId), applicationIdSelectionOptions);
        return writeExtract(fileName.value1(), qry, request, response);
    });
}
Also used : IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Example 39 with IdSelectionOptions

use of org.finos.waltz.model.IdSelectionOptions in project waltz by khartec.

the class AllocationsExtractor method registerExtractForScheme.

private void registerExtractForScheme(String path) {
    post(path, (request, response) -> {
        long schemeId = WebUtilities.getLong(request, "schemeId");
        IdSelectionOptions applicationIdSelectionOptions = WebUtilities.readIdSelectionOptionsFromBody(request);
        Record2<String, String> fileNameInfoRow = dsl.select(MEASURABLE_CATEGORY.NAME, ALLOCATION_SCHEME.NAME).from(ALLOCATION_SCHEME).innerJoin(MEASURABLE_CATEGORY).on(ALLOCATION_SCHEME.MEASURABLE_CATEGORY_ID.eq(MEASURABLE_CATEGORY.ID)).where(ALLOCATION_SCHEME.ID.eq(schemeId)).fetchOne();
        SelectConditionStep<Record> qry = prepareQuery(ALLOCATION_SCHEME.ID.eq(schemeId), applicationIdSelectionOptions);
        String filename = fileNameInfoRow.value1() + "_" + fileNameInfoRow.value2();
        return writeExtract(filename, qry, request, response);
    });
}
Also used : IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Aggregations

IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)39 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)15 EntityReference (org.finos.waltz.model.EntityReference)14 Record1 (org.jooq.Record1)9 DSLContext (org.jooq.DSLContext)8 EntityKind (org.finos.waltz.model.EntityKind)7 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)6 ApplicationIdSelectorFactory (org.finos.waltz.data.application.ApplicationIdSelectorFactory)5 LogicalFlowService (org.finos.waltz.service.logical_flow.LogicalFlowService)5 Collection (java.util.Collection)4 List (java.util.List)4 GenericSelector (org.finos.waltz.data.GenericSelector)4 IdSelectionOptions.mkOpts (org.finos.waltz.model.IdSelectionOptions.mkOpts)4 Set (java.util.Set)3 MeasurableIdSelectorFactory (org.finos.waltz.data.measurable.MeasurableIdSelectorFactory)3 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)3 Collections.emptySet (java.util.Collections.emptySet)2 Collectors (java.util.stream.Collectors)2 Collectors.toList (java.util.stream.Collectors.toList)2 Checks.checkNotNull (org.finos.waltz.common.Checks.checkNotNull)2