From 8aabf323b415c7f045ed635f969938d30b4d5f3c Mon Sep 17 00:00:00 2001 From: Sese-collab Date: Wed, 9 Nov 2022 19:06:36 +0100 Subject: [PATCH 1/6] add components and containers depending on properties in ViewUpdater --- .../src/architecture/resources/workspace.dsl | 8 ++++++++ .../src/main/java/org/ndx/aadarchi/ViewUpdater.java | 7 +++++-- .../org/ndx/aadarchi/base/enhancers/ModelElementKeys.java | 5 +++++ pom.xml | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/architecture-documentation/src/architecture/resources/workspace.dsl b/architecture-documentation/src/architecture/resources/workspace.dsl index df545208..8f7f3334 100644 --- a/architecture-documentation/src/architecture/resources/workspace.dsl +++ b/architecture-documentation/src/architecture/resources/workspace.dsl @@ -49,9 +49,17 @@ workspace "aadarchi-documentation-system" { } container "aadarchi" "system_containers" "Agile architecture containers" { include * + autoLayout + properties { + "aadarchi.auto.update" "true" + } } component "aadarchi_base" "base_components" "Agile architecture base components view" { include * + autoLayout + properties { + "aadarchi.auto.update" "true" + } } } } \ No newline at end of file diff --git a/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java b/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java index 040c4ced..95f86134 100644 --- a/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java +++ b/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java @@ -6,12 +6,15 @@ import org.ndx.aadarchi.base.OutputBuilder; +import org.ndx.aadarchi.base.enhancers.ModelElementKeys; import org.ndx.aadarchi.base.enhancers.ViewEnhancerAdapter; import com.structurizr.view.ComponentView; import com.structurizr.view.ContainerView; public class ViewUpdater extends ViewEnhancerAdapter { + public static final String NAME = ModelElementKeys.ConfigProperties.AutoUpdateViews.NAME; + @Inject Logger logger; @Override public boolean isParallel() { @@ -36,14 +39,14 @@ protected boolean startVisit(ComponentView c) { @Override protected void endVisit(ComponentView c, OutputBuilder builder) { - if(c.getKey().equals("base_components")) { + if(c.getProperties().equals(NAME)) { c.addAllComponents(); } super.endVisit(c, builder); } @Override protected void endVisit(ContainerView c, OutputBuilder builder) { - if(c.getKey().equals("system_containers")) { + if (c.getProperties().equals(NAME)) { c.addAllContainersAndInfluencers(); } super.endVisit(c, builder); diff --git a/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java b/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java index 73901c36..b13bd81b 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java +++ b/base/src/main/java/org/ndx/aadarchi/base/enhancers/ModelElementKeys.java @@ -72,6 +72,11 @@ interface DisabledFontIcons { String NAME = ModelElementKeys.PREFIX+"fonticon.disabled"; String VALUE = "false"; } + + interface AutoUpdateViews { + String NAME = ModelElementKeys.PREFIX+"auto.update"; + String VALUE = "false"; + } } interface Scm { diff --git a/pom.xml b/pom.xml index bceb71bc..1e5085c7 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ UTF-8 UTF-8 - 1.15.2 + 1.16.1 1.7.0 1.3.5 From 4a6b440dc4591d8bd543b54eaa6877eef694f253 Mon Sep 17 00:00:00 2001 From: Sese-collab Date: Thu, 10 Nov 2022 08:55:52 +0100 Subject: [PATCH 2/6] remove autoLayout in workspace.dsl --- .../src/architecture/resources/workspace.dsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/architecture-documentation/src/architecture/resources/workspace.dsl b/architecture-documentation/src/architecture/resources/workspace.dsl index 8f7f3334..46a6c353 100644 --- a/architecture-documentation/src/architecture/resources/workspace.dsl +++ b/architecture-documentation/src/architecture/resources/workspace.dsl @@ -49,14 +49,14 @@ workspace "aadarchi-documentation-system" { } container "aadarchi" "system_containers" "Agile architecture containers" { include * - autoLayout + properties { "aadarchi.auto.update" "true" } } component "aadarchi_base" "base_components" "Agile architecture base components view" { include * - autoLayout + properties { "aadarchi.auto.update" "true" } From 8f8bea1dec5a6c594ae80caf57e420b6f615da59 Mon Sep 17 00:00:00 2001 From: Sese-collab Date: Thu, 10 Nov 2022 09:23:42 +0100 Subject: [PATCH 3/6] move ViewUpdater in base module --- .../java/org/ndx/aadarchi/ViewUpdater.java | 54 ------------------- 1 file changed, 54 deletions(-) delete mode 100644 architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java diff --git a/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java b/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java deleted file mode 100644 index 95f86134..00000000 --- a/architecture-documentation/src/main/java/org/ndx/aadarchi/ViewUpdater.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.ndx.aadarchi; - -import java.util.logging.Logger; - -import javax.inject.Inject; - -import org.ndx.aadarchi.base.OutputBuilder; - -import org.ndx.aadarchi.base.enhancers.ModelElementKeys; -import org.ndx.aadarchi.base.enhancers.ViewEnhancerAdapter; - -import com.structurizr.view.ComponentView; -import com.structurizr.view.ContainerView; - -public class ViewUpdater extends ViewEnhancerAdapter { - public static final String NAME = ModelElementKeys.ConfigProperties.AutoUpdateViews.NAME; - - @Inject Logger logger; - @Override - public boolean isParallel() { - // TODO Auto-generated method stub - return false; - } - - @Override - public int priority() { - return TOP_PRIORITY_FOR_INTERNAL_ENHANCERS+1; - } - - @Override - protected boolean startVisit(ContainerView c) { - return true; - } - - @Override - protected boolean startVisit(ComponentView c) { - return true; - } - - @Override - protected void endVisit(ComponentView c, OutputBuilder builder) { - if(c.getProperties().equals(NAME)) { - c.addAllComponents(); - } - super.endVisit(c, builder); - } - @Override - protected void endVisit(ContainerView c, OutputBuilder builder) { - if (c.getProperties().equals(NAME)) { - c.addAllContainersAndInfluencers(); - } - super.endVisit(c, builder); - } -} From ba84dbc109f478bdb8b04e30dd54d85e8b5add3a Mon Sep 17 00:00:00 2001 From: Sese-collab Date: Thu, 10 Nov 2022 09:30:02 +0100 Subject: [PATCH 4/6] move ViewUpdater in base/enhancers.graph module --- .../base/enhancers/graph/ViewUpdater.java | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java diff --git a/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java b/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java new file mode 100644 index 00000000..0c878400 --- /dev/null +++ b/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java @@ -0,0 +1,51 @@ +package org.ndx.aadarchi.base.enhancers.graph; + +import com.structurizr.view.ComponentView; +import com.structurizr.view.ContainerView; +import org.ndx.aadarchi.base.OutputBuilder; +import org.ndx.aadarchi.base.enhancers.ModelElementKeys; +import org.ndx.aadarchi.base.enhancers.ViewEnhancerAdapter; + +import javax.inject.Inject; +import java.util.logging.Logger; + +public class ViewUpdater extends ViewEnhancerAdapter { + public static final String NAME = ModelElementKeys.ConfigProperties.AutoUpdateViews.NAME; + + @Inject Logger logger; + @Override + public boolean isParallel() { + // TODO Auto-generated method stub + return false; + } + + @Override + public int priority() { + return TOP_PRIORITY_FOR_INTERNAL_ENHANCERS+1; + } + + @Override + protected boolean startVisit(ContainerView c) { + return true; + } + + @Override + protected boolean startVisit(ComponentView c) { + return true; + } + + @Override + protected void endVisit(ComponentView c, OutputBuilder builder) { + if(c.getProperties().equals(NAME)) { + c.addAllComponents(); + } + super.endVisit(c, builder); + } + @Override + protected void endVisit(ContainerView c, OutputBuilder builder) { + if (c.getProperties().equals(NAME)) { + c.addAllContainersAndInfluencers(); + } + super.endVisit(c, builder); + } +} From c9297ac28eccfbb0ec50fbcd5c319a15a34912ea Mon Sep 17 00:00:00 2001 From: Sese-collab Date: Mon, 14 Nov 2022 10:32:30 +0100 Subject: [PATCH 5/6] replace equals by containsKey method in ViewUpdater --- .../org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java b/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java index 0c878400..0321f662 100644 --- a/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java +++ b/base/src/main/java/org/ndx/aadarchi/base/enhancers/graph/ViewUpdater.java @@ -36,14 +36,14 @@ protected boolean startVisit(ComponentView c) { @Override protected void endVisit(ComponentView c, OutputBuilder builder) { - if(c.getProperties().equals(NAME)) { + if(c.getProperties().containsKey(NAME)) { c.addAllComponents(); } super.endVisit(c, builder); } @Override protected void endVisit(ContainerView c, OutputBuilder builder) { - if (c.getProperties().equals(NAME)) { + if (c.getProperties().containsKey(NAME)) { c.addAllContainersAndInfluencers(); } super.endVisit(c, builder); From 76b145706b299b5cdddbec839909ac251284992b Mon Sep 17 00:00:00 2001 From: Nicolas Delsaux Date: Mon, 2 Jan 2023 18:50:49 +0100 Subject: [PATCH 6/6] Seems like updating structurizr-dsl is enough. Super cool! --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 84d84dfa..23d4edb5 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ UTF-8 UTF-8 - 1.16.1 + 1.16.2 1.7.0 1.3.5 @@ -104,7 +104,7 @@ com.structurizr structurizr-dsl - 1.20.0 + 1.21.1 com.structurizr