From 588ce9c6635bc928b5abb8dd44b105542e5dac62 Mon Sep 17 00:00:00 2001 From: "amit.pandey" Date: Sun, 28 Jun 2020 19:20:41 +0530 Subject: [PATCH] updated pom repository tag to change the name & id and structurizr version update --- .../spring-cloud-circuit-breaker/pom.xml | 8 +++--- structurizr/pom.xml | 2 +- .../structurizr/StructurizrSimple.java | 26 ++++++++++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/spring-cloud/spring-cloud-circuit-breaker/pom.xml b/spring-cloud/spring-cloud-circuit-breaker/pom.xml index 7db3841bc7..ae44fa8199 100644 --- a/spring-cloud/spring-cloud-circuit-breaker/pom.xml +++ b/spring-cloud/spring-cloud-circuit-breaker/pom.xml @@ -16,14 +16,14 @@ - spring-snapshots - Spring Snapshots + spring-release + Spring Release https://repo.spring.io/release - true + false - false + true diff --git a/structurizr/pom.xml b/structurizr/pom.xml index f1b4355dcf..b8efba0937 100644 --- a/structurizr/pom.xml +++ b/structurizr/pom.xml @@ -42,7 +42,7 @@ 1.8 1.8 - 1.0.0-RC5 + 1.0.0 \ No newline at end of file diff --git a/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java b/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java index b33a1d9a77..3f52ea657f 100644 --- a/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java +++ b/structurizr/src/main/java/com/baeldung/structurizr/StructurizrSimple.java @@ -2,6 +2,8 @@ package com.baeldung.structurizr; import java.io.File; import java.io.StringWriter; +import java.util.HashSet; +import java.util.Set; import com.structurizr.Workspace; import com.structurizr.analysis.ComponentFinder; @@ -40,15 +42,31 @@ public class StructurizrSimple { addContainers(workspace); addComponents(workspace); addSpringComponents(workspace); - exportToPlantUml(workspace.getViews().getViewWithKey(SOFTWARE_SYSTEM_VIEW)); - exportToPlantUml(workspace.getViews().getViewWithKey(CONTAINER_VIEW)); - exportToPlantUml(workspace.getViews().getViewWithKey(COMPONENT_VIEW)); + exportToPlantUml(findViewWithKey(workspace.getViews(), SOFTWARE_SYSTEM_VIEW)); + exportToPlantUml(findViewWithKey(workspace.getViews(), CONTAINER_VIEW)); + exportToPlantUml(findViewWithKey(workspace.getViews(), COMPONENT_VIEW)); - exportToPlantUml(workspace.getViews().getViewWithKey(JVM2_COMPONENT_VIEW)); + exportToPlantUml(findViewWithKey(workspace.getViews(), JVM2_COMPONENT_VIEW)); addStyles(workspace.getViews()); //uploadToExternal(workspace); } + + private static View findViewWithKey(ViewSet viewSet, String key) { + if (key == null) { + throw new IllegalArgumentException("A key must be specified."); + } + + Set views = new HashSet<>(); + views.addAll(viewSet.getSystemLandscapeViews()); + views.addAll(viewSet.getSystemContextViews()); + views.addAll(viewSet.getContainerViews()); + views.addAll(viewSet.getComponentViews()); + views.addAll(viewSet.getDynamicViews()); + views.addAll(viewSet.getDeploymentViews()); + + return views.stream().filter(v -> key.equals(v.getKey())).findFirst().orElse(null); + } private static void addSpringComponents(Workspace workspace) throws Exception { Container jvm2 = workspace.getModel().getSoftwareSystemWithName(PAYMENT_TERMINAL).getContainerWithName("JVM-2");