use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class FlowLineageHarness method main.
public static void main(String[] args) throws ParseException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
LogicalFlowDao flowDao = ctx.getBean(LogicalFlowDao.class);
EntityReference ref1 = mkRef(APPLICATION, 25662);
EntityReference ref2 = mkRef(ACTOR, 10);
EntityReference ref3 = mkRef(APPLICATION, 25612);
findIncomingByRefs(dsl, SetUtilities.fromArray(ref1, ref2, ref3));
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class ChangeLogHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIBaseConfiguration.class);
ChangeLogSummariesDao dao = ctx.getBean(ChangeLogSummariesDao.class);
EntityReference ref = mkRef(EntityKind.APPLICATION, 1234L);
// FunctionUtilities.time("findUnattestedChanges", () -> dao.findUnattestedChanges(ref));
// FunctionUtilities.time("findUnattestedChanges", () -> dao.findUnattestedChanges(ref));
// FunctionUtilities.time("findUnattestedChanges", () -> dao.findUnattestedChanges(ref));
// List<ChangeLog> changes = FunctionUtilities.time("findUnattestedChanges", () -> dao.findUnattestedChanges(ref));
// System.out.println(changes);
GenericSelectorFactory factory = new GenericSelectorFactory();
IdSelectionOptions idSelectionOptions = mkOpts(mkRef(EntityKind.APP_GROUP, 11874), HierarchyQueryScope.EXACT);
FunctionUtilities.time("test", () -> dao.findCountByParentAndChildKindForDateBySelector(factory.applyForKind(EntityKind.APPLICATION, idSelectionOptions), DateTimeUtilities.toSqlDate(DateTimeUtilities.today()), Optional.of(10)));
System.out.println("done");
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class DataFlowHarness method main.
public static void main(String[] args) throws ParseException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
LogicalFlowService service = ctx.getBean(LogicalFlowService.class);
LogicalFlowDao dao = ctx.getBean(LogicalFlowDao.class);
LogicalFlowIdSelectorFactory factory = new LogicalFlowIdSelectorFactory();
IdSelectionOptions options = IdSelectionOptions.mkOpts(EntityReference.mkRef(EntityKind.ORG_UNIT, 5000), HierarchyQueryScope.CHILDREN);
Select<Record1<Long>> selector = factory.apply(options);
System.out.println(selector);
List<LogicalFlow> flows = dao.findBySelector(selector);
flows.forEach(System.out::println);
// by data type
EntityReference dataType = EntityReference.mkRef(EntityKind.DATA_TYPE, 6000);
IdSelectionOptions dataTypeOptions = IdSelectionOptions.mkOpts(dataType, HierarchyQueryScope.CHILDREN);
List<LogicalFlow> byDataTypeFlows = service.findBySelector(dataTypeOptions);
byDataTypeFlows.forEach(System.out::println);
System.out.println(byDataTypeFlows.size());
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class EntityRelationshipHarness method main.
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
DSLContext dsl = ctx.getBean(DSLContext.class);
EntityRelationshipDao dao = ctx.getBean(EntityRelationshipDao.class);
EntityReference ref = EntityReference.mkRef(EntityKind.MEASURABLE, 613);
Collection<EntityRelationship> rels = dao.findRelationshipsInvolving(ref);
rels.forEach(r -> System.out.println(r.a().name()));
System.out.println("----");
System.out.println(dao.tallyRelationshipsInvolving(ref));
}
use of org.finos.waltz.model.EntityReference in project waltz by khartec.
the class PhysicalSpecificationServiceTest method findBySelector.
@Test
public void findBySelector() {
assertThrows(IllegalArgumentException.class, () -> psSvc.findBySelector(null), "Options cannot be null");
EntityReference a = appHelper.createNewApp("a", ouIds.a);
Long specId = psHelper.createPhysicalSpec(a, "findByEntityReference");
IdSelectionOptions specOpts = mkOpts(mkRef(EntityKind.PHYSICAL_SPECIFICATION, specId));
Collection<PhysicalSpecification> specs = psSvc.findBySelector(specOpts);
assertEquals(1, specs.size(), "When selector is a spec only returns one result");
assertEquals(specId, first(specs).id().get(), "Returns spec when using spec selector");
EntityReference b = appHelper.createNewApp("b", ouIds.a1);
LogicalFlow flow = lfHelper.createLogicalFlow(a, b);
Long specId2 = psHelper.createPhysicalSpec(b, "findByEntityReference");
PhysicalFlowCreateCommandResponse physFlow = pfHelper.createPhysicalFlow(flow.entityReference().id(), specId, mkName("findBySelector"));
PhysicalFlowCreateCommandResponse physFlow2 = pfHelper.createPhysicalFlow(flow.entityReference().id(), specId2, mkName("findBySelector"));
IdSelectionOptions appOpts = mkOpts(mkRef(EntityKind.APPLICATION, b.id()));
assertThrows(UnsupportedOperationException.class, () -> psSvc.findBySelector(appOpts), "Throws exception for unsupported entity kinds");
IdSelectionOptions flowOpts = mkOpts(mkRef(EntityKind.LOGICAL_DATA_FLOW, flow.entityReference().id()));
Collection<PhysicalSpecification> specsForFlow = psSvc.findBySelector(flowOpts);
assertEquals(2, specsForFlow.size(), "Returns all specs linked to a flow");
assertEquals(asSet(specId, specId2), map(specsForFlow, d -> d.entityReference().id()), "Returns all specs linked to a flow");
pfHelper.deletePhysicalFlow(physFlow2.entityReference().id());
psHelper.removeSpec(specId2);
Collection<PhysicalSpecification> activeSpecsForFlow = psSvc.findBySelector(flowOpts);
assertEquals(1, activeSpecsForFlow.size(), "Returns all specs linked to a flow");
assertEquals(asSet(specId), map(activeSpecsForFlow, d -> d.entityReference().id()), "Returns only active specs linked to a flow");
}
Aggregations