use of org.finos.waltz.model.EntityKind in project waltz by khartec.
the class ChangeLogExtractor method registerExtractUnattestedChangesForApp.
private void registerExtractUnattestedChangesForApp(String path) {
get(path, (request, response) -> {
EntityReference entityRef = WebUtilities.getEntityReference(request);
EntityKind childKind = WebUtilities.getKind(request, "childKind");
SelectJoinStep<Record4<String, String, String, Timestamp>> qry = mkUnattestedChangesQuery(entityRef, childKind);
String filename = format("unattested-changes-%s-%d", childKind, entityRef.id());
return writeExtract(filename, qry, request, response);
});
}
use of org.finos.waltz.model.EntityKind in project waltz by khartec.
the class ChangeLogGenerator method mkChangeLog.
private static ChangeLogRecord mkChangeLog(long appId, String email, LocalDateTime when) {
Tuple2<String, EntityKind> messageTemplate = randomPick(messages);
ChangeLogRecord record = new ChangeLogRecord();
record.setMessage(messageTemplate.v1);
record.setParentId(appId);
record.setParentKind(EntityKind.APPLICATION.name());
record.setChildKind(messageTemplate.v2.name());
record.setUserId(email);
record.setSeverity(Severity.INFORMATION.name());
record.setCreatedAt(Timestamp.valueOf(when));
return record;
}
use of org.finos.waltz.model.EntityKind in project waltz by khartec.
the class AssessmentGenerator method createAssessmentRecords.
private void createAssessmentRecords(DSLContext dsl, RatingScheme ratingScheme, Long assessmentDefnId, EntityKind targetKind, TableField<? extends Record, Long> targetIdField, double density) {
List<Long> targetIds = loadAllIds(dsl, targetIdField);
List<AssessmentRatingRecord> records = targetIds.stream().filter(d -> RandomUtilities.getRandom().nextDouble() < density).map(id -> tuple(id, randomPick(ratingScheme.ratings()))).filter(t -> t.v2.id().isPresent()).map(t -> {
AssessmentRatingRecord record = new AssessmentRatingRecord();
record.setAssessmentDefinitionId(assessmentDefnId);
record.setRatingId(t.v2.id().get());
record.setEntityKind(targetKind.name());
record.setEntityId(t.v1);
record.setLastUpdatedBy(SAMPLE_DATA_USER);
record.setProvenance(SAMPLE_DATA_PROVENANCE);
record.setDescription("sample data");
return record;
}).collect(toList());
log("About to store %d assessments for kind: %s", records.size(), targetIdField.getTable().getName());
dsl.batchInsert(records).execute();
}
use of org.finos.waltz.model.EntityKind in project waltz by khartec.
the class GenericSelectorFactory method apply.
public GenericSelector apply(IdSelectionOptions selectionOptions) {
EntityKind kind = selectionOptions.entityReference().kind();
ImmutableGenericSelector.Builder builder = ImmutableGenericSelector.builder().kind(kind);
if (selectionOptions.scope() == HierarchyQueryScope.EXACT) {
Select<Record1<Long>> select = DSL.select(DSL.val(selectionOptions.entityReference().id()));
return builder.selector(select).build();
}
Select<Record1<Long>> ids = applySelectorForKind(kind, selectionOptions);
builder.selector(ids);
return builder.build();
}
use of org.finos.waltz.model.EntityKind in project waltz by khartec.
the class EntityHierarchyEndpoint method buildByKindRoute.
private int buildByKindRoute(Request request, Response response) {
requireRole(userRoleService, request, ADMIN);
EntityKind kind = getKind(request);
LOG.info("Building entity hierarchy for kind: {}", kind);
return entityHierarchyService.buildFor(kind);
}
Aggregations