Search in sources :

Example 56 with EntityReference

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

the class SurveyInstanceEvaluator method eval.

public ImmutableSurveyInstanceFormDetails eval(long surveyInstanceId) {
    List<SurveyQuestion> qs = loadQuestions(surveyInstanceId);
    Map<Long, SurveyQuestionResponse> responsesByQuestionId = loadResponses(surveyInstanceId);
    SurveyInstance instance = instanceDao.getById(surveyInstanceId);
    EntityReference subjectRef = instance.surveyEntity();
    List<SurveyQuestion> activeQs = QuestionPredicateEvaluator.eval(dsl, qs, subjectRef, responsesByQuestionId);
    Set<Long> missingMandatoryQuestions = determineMissingMandatoryQuestions(activeQs, responsesByQuestionId);
    return ImmutableSurveyInstanceFormDetails.builder().activeQuestions(activeQs).missingMandatoryQuestionIds(missingMandatoryQuestions).build();
}
Also used : EntityReference(org.finos.waltz.model.EntityReference)

Example 57 with EntityReference

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

the class AttestationExtractor method prepareReport.

private Tuple3<ExtractFormat, String, byte[]> prepareReport(ExtractFormat format, EntityKind attestedKind, Long attestedId, ApplicationAttestationInstanceInfo applicationAttestationInstanceInfo) throws IOException {
    Set<ApplicationAttestationInstanceSummary> attestationInstances = attestationInstanceService.findApplicationAttestationInstancesForKindAndSelector(attestedKind, attestedId, applicationAttestationInstanceInfo);
    EntityReference entityReference = applicationAttestationInstanceInfo.selectionOptions().entityReference();
    String fileName = format("%s-attestations-for-%s-%s", attestedKind, entityReference.kind().name().toLowerCase(), entityReference.id());
    List<String> columnDefinitions = ListUtilities.asList("Application Id", "Application Name", "Asset Code", "Criticality", "Lifecycle Phase", "Kind", "Attested At", "Attested By");
    return formatReport(format, fileName, columnDefinitions, attestationInstances);
}
Also used : EntityReference(org.finos.waltz.model.EntityReference) ApplicationAttestationInstanceSummary(org.finos.waltz.model.attestation.ApplicationAttestationInstanceSummary)

Example 58 with EntityReference

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

the class CustomEnvironmentUsageExtractor method registerEnvironmentUsagesForParentRef.

private void registerEnvironmentUsagesForParentRef(String findByParentEntityRefPath) {
    get(findByParentEntityRefPath, (request, response) -> {
        EntityReference ref = WebUtilities.getEntityReference(request);
        SelectSeekStep3<Record, String, String, String> serverUsagesQuery = getServerUsagesQuery(ref);
        SelectSeekStep3<Record, String, String, String> databaseUsagesQuery = getDatabaseUsagesQuery(ref);
        return writeAsMultiSheetExcel(dsl, mkFilename(ref), response, tuple("Instructions", mkInstructions()), tuple("Servers", serverUsagesQuery), tuple("Databases", databaseUsagesQuery));
    });
}
Also used : EntityReference(org.finos.waltz.model.EntityReference) WebUtilities.getEntityReference(org.finos.waltz.web.WebUtilities.getEntityReference)

Example 59 with EntityReference

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

the class EntityCostExtractor method registerCostsForEntity.

private void registerCostsForEntity(String costsForEntityPath) {
    get(costsForEntityPath, (request, response) -> {
        EntityReference ref = WebUtilities.getEntityReference(request);
        SelectSeekStep1<Record, Integer> qry = dsl.select(ENTITY_NAME_FIELD).select(COST_KIND.NAME.as("kind")).select(COST.YEAR, COST.AMOUNT, COST.PROVENANCE).from(COST).innerJoin(COST_KIND).on(COST.COST_KIND_ID.eq(COST_KIND.ID)).where(COST.ENTITY_ID.eq(ref.id()).and(COST.ENTITY_KIND.eq(ref.kind().name()))).orderBy(COST.YEAR.desc());
        return writeExtract(mkFilename(ref), qry, request, response);
    });
}
Also used : EntityReference(org.finos.waltz.model.EntityReference)

Example 60 with EntityReference

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

the class ChangeLogExtractor method registerExtractForApp.

private void registerExtractForApp(String path) {
    post(path, (request, response) -> {
        EntityReference entityRef = WebUtilities.getEntityReference(request);
        Select<Record> select = mkQuery(entityRef);
        SelectSeekStep1<Record4<String, String, String, Timestamp>, Timestamp> qry = dsl.select(select.field(CHANGE_LOG.SEVERITY).as("Severity"), select.field(CHANGE_LOG.MESSAGE).as("Message"), select.field(CHANGE_LOG.USER_ID).as("User"), select.field(CHANGE_LOG.CREATED_AT).as("Timestamp")).from(select).orderBy(select.field(CHANGE_LOG.CREATED_AT).desc());
        return writeExtract("change-log-" + entityRef.id(), qry, request, response);
    });
}
Also used : EntityReference(org.finos.waltz.model.EntityReference) Timestamp(java.sql.Timestamp)

Aggregations

EntityReference (org.finos.waltz.model.EntityReference)114 BaseInMemoryIntegrationTest (org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest)55 Test (org.junit.jupiter.api.Test)55 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)40 EntityKind (org.finos.waltz.model.EntityKind)23 List (java.util.List)21 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)19 Autowired (org.springframework.beans.factory.annotation.Autowired)17 DataTypeDecorator (org.finos.waltz.model.datatype.DataTypeDecorator)16 Set (java.util.Set)14 Collection (java.util.Collection)13 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)13 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)10 IdSelectionOptions.mkOpts (org.finos.waltz.model.IdSelectionOptions.mkOpts)9 DateTimeUtilities (org.finos.waltz.common.DateTimeUtilities)8 ListUtilities.newArrayList (org.finos.waltz.common.ListUtilities.newArrayList)8 Bookmark (org.finos.waltz.model.bookmark.Bookmark)8 Collections.emptyList (java.util.Collections.emptyList)7 Collectors (java.util.stream.Collectors)7 CollectionUtilities.first (org.finos.waltz.common.CollectionUtilities.first)7