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();
}
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);
}
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));
});
}
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);
});
}
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);
});
}
Aggregations