use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class DataTypeUsageEndpoint method saveRoute.
private List<DataTypeUsage> saveRoute(Request request, Response response) throws IOException {
WebUtilities.requireRole(userRoleService, request, SystemRole.LOGICAL_DATA_FLOW_EDITOR);
String user = WebUtilities.getUsername(request);
EntityReference ref = WebUtilities.getEntityReference(request);
Long dataTypeId = WebUtilities.getLong(request, "typeId");
UsageInfo[] usages = WebUtilities.readBody(request, UsageInfo[].class);
dataTypeUsageService.save(ref, dataTypeId, newArrayList(usages), user);
return dataTypeUsageService.findForEntityAndDataType(ref, dataTypeId);
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class TechnologyEOLDatabaseExtractor method register.
@Override
public void register() {
String path = WebUtilities.mkPath("data-extract", "technology-database", ":kind", ":id");
get(path, (request, response) -> {
EntityReference ref = getReference(request);
Select<Record1<Long>> appIdSelector = applicationIdSelectorFactory.apply(mkOpts(ref));
SelectConditionStep<Record> qry = dsl.selectDistinct(ORGANISATIONAL_UNIT.NAME.as("Org Unit")).select(APPLICATION.NAME.as("Application Name"), APPLICATION.ASSET_CODE.as("Asset Code")).select(DATABASE_INFORMATION.DATABASE_NAME.as("Database Name"), DATABASE_INFORMATION.INSTANCE_NAME.as("Instance Name"), DATABASE_USAGE.ENVIRONMENT.as("DBMS Environment"), DATABASE_INFORMATION.DBMS_VENDOR.as("DBMS Vendor"), DATABASE_INFORMATION.DBMS_NAME.as("DBMS Name"), DATABASE_INFORMATION.END_OF_LIFE_DATE.as("End of Life date"), DATABASE_INFORMATION.LIFECYCLE_STATUS.as("Lifecycle")).from(DATABASE_INFORMATION).innerJoin(DATABASE_USAGE).on(DATABASE_USAGE.DATABASE_ID.eq(DATABASE_INFORMATION.ID)).innerJoin(APPLICATION).on(APPLICATION.ID.eq(DATABASE_USAGE.ENTITY_ID)).and(DATABASE_USAGE.ENTITY_KIND.eq(EntityKind.APPLICATION.name())).innerJoin(ORGANISATIONAL_UNIT).on(ORGANISATIONAL_UNIT.ID.eq(APPLICATION.ORGANISATIONAL_UNIT_ID)).where(APPLICATION.ID.in(appIdSelector)).and(APPLICATION.LIFECYCLE_PHASE.notEqual("RETIRED"));
return writeExtract(mkFilename(ref), qry, request, response);
});
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class EntityRefHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
EntityReferenceNameResolver resolver = ctx.getBean(EntityReferenceNameResolver.class);
List<EntityReference> refs = ListUtilities.newArrayList(EntityReference.mkRef(EntityKind.MEASURABLE, 136), EntityReference.mkRef(EntityKind.MEASURABLE, 138), EntityReference.mkRef(EntityKind.MEASURABLE, -138), EntityReference.mkRef(EntityKind.CHANGE_INITIATIVE, 12));
List<EntityReference> refs1 = ListUtilities.newArrayList(EntityReference.mkRef(EntityKind.MEASURABLE, 136));
dump(resolver.resolve(refs));
dump(resolver.resolve(refs1));
System.out.println("-- done");
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class FlowLineageHarness method findIncomingByRefs.
private static void findIncomingByRefs(DSLContext dsl, Set<EntityReference> entityReferences) {
Map<EntityKind, Collection<EntityReference>> refsByKind = groupBy(ref -> ref.kind(), entityReferences);
Condition anyTargetMatches = refsByKind.entrySet().stream().map(entry -> LOGICAL_FLOW.TARGET_ENTITY_KIND.eq(entry.getKey().name()).and(LOGICAL_FLOW.TARGET_ENTITY_ID.in(map(entry.getValue(), ref -> ref.id())))).collect(Collectors.reducing(DSL.falseCondition(), (acc, c) -> acc.or(c)));
System.out.println(anyTargetMatches);
Field<String> SOURCE_NAME_FIELD = InlineSelectFieldFactory.mkNameField(LOGICAL_FLOW.SOURCE_ENTITY_ID, LOGICAL_FLOW.SOURCE_ENTITY_KIND, newArrayList(EntityKind.APPLICATION, EntityKind.ACTOR));
dsl.select(LOGICAL_FLOW.fields()).select(SOURCE_NAME_FIELD).from(LOGICAL_FLOW).where(anyTargetMatches.and(LogicalFlowDao.LOGICAL_NOT_REMOVED)).forEach(System.out::println);
dsl.select().from(LOGICAL_FLOW_DECORATOR).innerJoin(LOGICAL_FLOW).on(LOGICAL_FLOW.ID.eq(LOGICAL_FLOW_DECORATOR.LOGICAL_FLOW_ID)).where(anyTargetMatches).forEach(System.out::println);
}
use of org.finos.waltz.model.EntityReference 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);
});
}
Aggregations