Search in sources :

Example 1 with Application

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);
    }
}
Also used : DataType(org.finos.waltz.model.datatype.DataType) Application(org.finos.waltz.model.application.Application)

Example 2 with Application

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);
    }
}
Also used : DataType(org.finos.waltz.model.datatype.DataType) Application(org.finos.waltz.model.application.Application)

Example 3 with Application

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);
}
Also used : Application(org.finos.waltz.model.application.Application)

Example 4 with Application

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!"
        }
        */
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) LogicalFlowService(org.finos.waltz.service.logical_flow.LogicalFlowService) FlowDiagramEntityService(org.finos.waltz.service.flow_diagram.FlowDiagramEntityService) FlowDiagramService(org.finos.waltz.service.flow_diagram.FlowDiagramService) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) Application(org.finos.waltz.model.application.Application) ApplicationService(org.finos.waltz.service.application.ApplicationService) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions)

Example 5 with Application

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());
}
Also used : OrganisationalUnitDao(org.finos.waltz.data.orgunit.OrganisationalUnitDao) java.util(java.util) LogicalFlowDao(org.finos.waltz.data.logical_flow.LogicalFlowDao) DSL(org.jooq.impl.DSL) Tables(org.finos.waltz.schema.Tables) EntityKind(org.finos.waltz.model.EntityKind) DIConfiguration(org.finos.waltz.service.DIConfiguration) ListUtilities.newArrayList(org.finos.waltz.common.ListUtilities.newArrayList) CsvPreference(org.supercsv.prefs.CsvPreference) Function(java.util.function.Function) Condition(org.jooq.Condition) EntityReference.mkRef(org.finos.waltz.model.EntityReference.mkRef) DataType(org.finos.waltz.model.datatype.DataType) LOGICAL_FLOW(org.finos.waltz.schema.tables.LogicalFlow.LOGICAL_FLOW) LOGICAL_NOT_REMOVED(org.finos.waltz.data.logical_flow.LogicalFlowDao.LOGICAL_NOT_REMOVED) Record1(org.jooq.Record1) CsvListWriter(org.supercsv.io.CsvListWriter) MapUtilities.groupBy(org.finos.waltz.common.MapUtilities.groupBy) Tuple7(org.jooq.lambda.tuple.Tuple7) DSLContext(org.jooq.DSLContext) OutputStreamWriter(java.io.OutputStreamWriter) ApplicationIdSelectorFactory(org.finos.waltz.data.application.ApplicationIdSelectorFactory) Select(org.jooq.Select) StringUtilities(org.finos.waltz.common.StringUtilities) EntityLifecycleStatus(org.finos.waltz.model.EntityLifecycleStatus) OrganisationalUnit(org.finos.waltz.model.orgunit.OrganisationalUnit) Unchecked(org.jooq.lambda.Unchecked) LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) Application(org.finos.waltz.model.application.Application) DataTypeDecorator(org.finos.waltz.model.datatype.DataTypeDecorator) Collections.emptyList(java.util.Collections.emptyList) IdUtilities.toIds(org.finos.waltz.model.utils.IdUtilities.toIds) FileOutputStream(java.io.FileOutputStream) IOException(java.io.IOException) Collectors(java.util.stream.Collectors) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) NameProvider(org.finos.waltz.model.NameProvider) ApplicationDao(org.finos.waltz.data.application.ApplicationDao) LogicalFlowDecoratorDao(org.finos.waltz.data.datatype_decorator.LogicalFlowDecoratorDao) ExternalIdValue(org.finos.waltz.model.external_identifier.ExternalIdValue) Tuple(org.jooq.lambda.tuple.Tuple) Tuple.tuple(org.jooq.lambda.tuple.Tuple.tuple) EntityReference(org.finos.waltz.model.EntityReference) DataTypeDao(org.finos.waltz.data.data_type.DataTypeDao) IdUtilities.indexByOptId(org.finos.waltz.model.utils.IdUtilities.indexByOptId) SetUtilities.fromCollection(org.finos.waltz.common.SetUtilities.fromCollection) EntityReference(org.finos.waltz.model.EntityReference) Select(org.jooq.Select) Record1(org.jooq.Record1)

Aggregations

Application (org.finos.waltz.model.application.Application)28 EntityKind (org.finos.waltz.model.EntityKind)12 DSLContext (org.jooq.DSLContext)12 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)12 Collectors (java.util.stream.Collectors)11 EntityReference (org.finos.waltz.model.EntityReference)10 ApplicationDao (org.finos.waltz.data.application.ApplicationDao)9 ExternalIdValue (org.finos.waltz.model.external_identifier.ExternalIdValue)9 DIConfiguration (org.finos.waltz.service.DIConfiguration)9 IOException (java.io.IOException)7 java.util (java.util)7 List (java.util.List)7 Map (java.util.Map)6 DataType (org.finos.waltz.model.datatype.DataType)6 ApplicationService (org.finos.waltz.service.application.ApplicationService)6 CsvPreference (org.supercsv.prefs.CsvPreference)6 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)5 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)5 OrganisationalUnit (org.finos.waltz.model.orgunit.OrganisationalUnit)5 LogicalFlowDao (org.finos.waltz.data.logical_flow.LogicalFlowDao)4