use of org.finos.waltz.model.application.Application in project waltz by khartec.
the class FlowClassificationRuleService method logRemoval.
private void logRemoval(long id, String username) {
FlowClassificationRule rule = getById(id);
if (rule == null) {
return;
}
String parentName = getParentEntityName(rule.parentReference());
DataType dataType = dataTypeDao.getById(rule.dataTypeId());
Application app = applicationDao.getById(rule.applicationReference().id());
if (app != null && dataType != null && parentName != null) {
String msg = format("Removed the flow classification rule where %s is a source app for type: %s for %s: %s", app.name(), dataType.name(), rule.parentReference().kind().prettyName(), parentName);
multiLog(username, id, rule.parentReference(), dataType, app, msg, Operation.REMOVE);
}
}
use of org.finos.waltz.model.application.Application in project waltz by khartec.
the class FlowClassificationRuleService method logInsert.
private void logInsert(Long ruleId, FlowClassificationRuleCreateCommand command, String username) {
String parentName = getParentEntityName(command.parentReference());
DataType dataType = dataTypeDao.getById(command.dataTypeId());
Application app = applicationDao.getById(command.applicationId());
if (app != null && dataType != null && parentName != null) {
String msg = format("Registered the flow classification rule with %s as the source app for type: %s for %s: %s", app.name(), dataType.name(), command.parentReference().kind().prettyName(), parentName);
multiLog(username, ruleId, command.parentReference(), dataType, app, msg, Operation.ADD);
}
}
use of org.finos.waltz.model.application.Application in project waltz by khartec.
the class FlowDiagramService method makeForApplication.
private Long makeForApplication(EntityReference ref, String userId, String providedTitle) {
Application app = applicationDao.getById(ref.id());
String title = isEmpty(providedTitle) ? app.name() + " flows" : providedTitle;
ArrayList<FlowDiagramEntity> entities = newArrayList(mkDiagramEntity(app));
ArrayList<FlowDiagramAnnotation> annotations = newArrayList(mkDiagramAnnotation(app.entityReference(), title));
return mkNewFlowDiagram(title, userId, entities, annotations);
}
use of org.finos.waltz.model.application.Application in project waltz by khartec.
the class DiagramToDotExport method main.
public static void main(String[] args) throws IOException {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class);
FlowDiagramService flowDiagramService = ctx.getBean(FlowDiagramService.class);
FlowDiagramEntityService flowDiagramEntityService = ctx.getBean(FlowDiagramEntityService.class);
ApplicationService applicationService = ctx.getBean(ApplicationService.class);
LogicalFlowService logicalFlowService = ctx.getBean(LogicalFlowService.class);
EntityReference diagRef = mkRef(EntityKind.FLOW_DIAGRAM, 1L);
IdSelectionOptions options = IdSelectionOptions.mkOpts(diagRef, HierarchyQueryScope.EXACT);
List<Application> apps = applicationService.findByAppIdSelector(options);
List<LogicalFlow> flows = logicalFlowService.findBySelector(options);
Map<Long, Application> appsById = indexBy(a -> a.id().get(), apps);
System.out.println("------");
String digraph = String.format("digraph G { %s %s}", renderApplications(apps), renderFlows(flows, appsById));
System.out.println(digraph);
System.out.println("-----");
/*
digraph G {
"Welcome" -> "To"
"To" -> "Web"
"To" -> "GraphViz!"
}
*/
}
use of org.finos.waltz.model.application.Application in project waltz by khartec.
the class FlowSummaryWithTypesAndPhysicalsExport method mkAppIdSelector.
private static Select<Record1<Long>> mkAppIdSelector(ApplicationIdSelectorFactory appIdSelectorFactory) {
EntityReference infraRef = mkRef(EntityKind.ORG_UNIT, 6811);
EntityReference entRiskRef = mkRef(EntityKind.ORG_UNIT, 3125);
EntityReference regCtrlRef = mkRef(EntityKind.ORG_UNIT, 2761);
Function<EntityReference, Select<Record1<Long>>> mkOrgUnitSelector = (ref) -> DSL.select(ENTITY_HIERARCHY.ID).from(ENTITY_HIERARCHY).where(ENTITY_HIERARCHY.ANCESTOR_ID.eq(ref.id())).and(ENTITY_HIERARCHY.KIND.eq(ref.kind().name()));
Select<Record1<Long>> ouSelector = DSL.selectFrom(mkOrgUnitSelector.apply(infraRef).unionAll(mkOrgUnitSelector.apply(entRiskRef)).unionAll(mkOrgUnitSelector.apply(regCtrlRef)).asTable());
return DSL.select(APPLICATION.ID).from(APPLICATION).where(APPLICATION.ORGANISATIONAL_UNIT_ID.in(ouSelector)).and(APPLICATION.LIFECYCLE_PHASE.notEqual(EntityLifecycleStatus.REMOVED.name())).and(APPLICATION.IS_REMOVED.isFalse());
}
Aggregations