Skip to content

Commit 03205d6

Browse files
C4-PlantUML borderStyle now lower case (#263).
1 parent 5ae28b0 commit 03205d6

19 files changed

+80
-77
lines changed

changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## unreleased
4+
5+
- structurizr-export: https://github.com/structurizr/java/issues/263 (Fixes C4PlantUMLExporter not following C4-PlantUML best practices with c4plantuml.tags true)
6+
37
## 2.1.1 (3rd March 2024)
48

59
- structurizr-core: Fixes problem with ordering of relationship view vertices.

structurizr-export/src/main/java/com/structurizr/export/plantuml/C4PlantUMLExporter.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ protected void writeHeader(ModelView view, IndentingWriter writer) {
194194
elementStyle.getColor(),
195195
sprite,
196196
elementStyle.getProperties().getOrDefault(C4PLANTUML_SHADOW, ""),
197-
elementStyle.getBorder(),
197+
elementStyle.getBorder().toString().toLowerCase(),
198198
borderThickness
199199
));
200200
}
@@ -241,7 +241,7 @@ protected void writeHeader(ModelView view, IndentingWriter writer) {
241241
elementStyle.getStroke(),
242242
elementStyle.getStroke(),
243243
elementStyle.getProperties().getOrDefault(C4PLANTUML_SHADOW, ""),
244-
elementStyle.getBorder(),
244+
elementStyle.getBorder().toString().toLowerCase(),
245245
borderThickness
246246
));
247247
}
@@ -288,7 +288,6 @@ protected void startGroupBoundary(ModelView view, String group, IndentingWriter
288288
}
289289

290290
String color = "#cccccc";
291-
String borderStyle = "Dashed";
292291
int borderThickness = 1;
293292
// String icon = "";
294293

@@ -302,9 +301,9 @@ protected void startGroupBoundary(ModelView view, String group, IndentingWriter
302301
}
303302

304303
if (elementStyleForGroup != null && !StringUtils.isNullOrEmpty(elementStyleForGroup.getStroke())) {
305-
borderStyle = elementStyleForGroup.getStroke();
304+
color = elementStyleForGroup.getStroke();
306305
} else if (elementStyleForAllGroups != null && !StringUtils.isNullOrEmpty(elementStyleForAllGroups.getStroke())) {
307-
borderStyle = elementStyleForAllGroups.getStroke();
306+
color = elementStyleForAllGroups.getStroke();
308307
}
309308

310309
if (elementStyleForGroup != null && elementStyleForGroup.getStrokeWidth() != null) {
@@ -330,7 +329,7 @@ protected void startGroupBoundary(ModelView view, String group, IndentingWriter
330329
group,
331330
color,
332331
color,
333-
borderStyle,
332+
Border.Dashed.toString().toLowerCase(),
334333
borderThickness)
335334
);
336335

structurizr-export/src/test/java/com/structurizr/export/plantuml/C4PlantUMLDiagramExporterTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ public void borderStyling() {
717717
"!include <C4/C4>\n" +
718718
"!include <C4/C4_Context>\n" +
719719
"\n" +
720-
"AddElementTag(\"Element\", $bgColor=\"#dddddd\", $borderColor=\"#008000\", $fontColor=\"#000000\", $sprite=\"\", $shadowing=\"\", $borderStyle=\"Dashed\", $borderThickness=\"2\")\n" +
720+
"AddElementTag(\"Element\", $bgColor=\"#dddddd\", $borderColor=\"#008000\", $fontColor=\"#000000\", $sprite=\"\", $shadowing=\"\", $borderStyle=\"dashed\", $borderThickness=\"2\")\n" +
721721
"\n" +
722722
"System(Name, \"Name\", $descr=\"\", $tags=\"Element\", $link=\"\")\n" +
723723
"\n" +

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-Components.puml

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ top to bottom direction
99
!include <C4/C4_Container>
1010
!include <C4/C4_Component>
1111

12-
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
13-
AddElementTag("Component", $bgColor="#85bbf0", $borderColor="#5d82a8", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
14-
AddElementTag("Container,Mobile App", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
15-
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
16-
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
12+
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
13+
AddElementTag("Component", $bgColor="#85bbf0", $borderColor="#5d82a8", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
14+
AddElementTag("Container,Mobile App", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
15+
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
16+
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1717

1818
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
1919

20-
AddBoundaryTag("Container", $bgColor="#ffffff", $borderColor="#2e6295", $fontColor="#2e6295", $shadowing="", $borderStyle="Solid", $borderThickness="1")
20+
AddBoundaryTag("Container", $bgColor="#ffffff", $borderColor="#2e6295", $fontColor="#2e6295", $shadowing="", $borderStyle="solid", $borderThickness="1")
2121

2222
System(MainframeBankingSystem, "Mainframe Banking System", $descr="Stores all of the core banking information about customers, accounts, transactions, etc.", $tags="Software System,Existing System", $link="")
2323
System(EmailSystem, "E-mail System", $descr="The internal Microsoft Exchange e-mail system.", $tags="Software System,Existing System", $link="")

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-Containers.puml

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ top to bottom direction
88
!include <C4/C4_Context>
99
!include <C4/C4_Container>
1010

11-
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
12-
AddElementTag("Container,Mobile App", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
13-
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
14-
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
15-
AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
16-
AddElementTag("Person,Customer", $bgColor="#08427b", $borderColor="#052e56", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
11+
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
12+
AddElementTag("Container,Mobile App", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
13+
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
14+
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
15+
AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
16+
AddElementTag("Person,Customer", $bgColor="#08427b", $borderColor="#052e56", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1717

1818
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
1919

20-
AddBoundaryTag("Software System", $bgColor="#ffffff", $borderColor="#0b4884", $fontColor="#0b4884", $shadowing="", $borderStyle="Solid", $borderThickness="1")
20+
AddBoundaryTag("Software System", $bgColor="#ffffff", $borderColor="#0b4884", $fontColor="#0b4884", $shadowing="", $borderStyle="solid", $borderThickness="1")
2121

2222
Person(PersonalBankingCustomer, "Personal Banking Customer", $descr="A customer of the bank, with personal bank accounts.", $tags="Person,Customer", $link="")
2323
System(MainframeBankingSystem, "Mainframe Banking System", $descr="Stores all of the core banking information about customers, accounts, transactions, etc.", $tags="Software System,Existing System", $link="")

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-DevelopmentDeployment.puml

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ top to bottom direction
99
!include <C4/C4_Container>
1010
!include <C4/C4_Deployment>
1111

12-
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
13-
AddElementTag("Element", $bgColor="#ffffff", $borderColor="#888888", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
14-
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
15-
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
16-
AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
12+
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
13+
AddElementTag("Element", $bgColor="#ffffff", $borderColor="#888888", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
14+
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
15+
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
16+
AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1717

1818
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
1919

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-LiveDeployment.puml

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ top to bottom direction
99
!include <C4/C4_Container>
1010
!include <C4/C4_Deployment>
1111

12-
AddElementTag("Failover", $bgColor="#ffffff", $borderColor="#888888", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
13-
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
14-
AddElementTag("Element", $bgColor="#ffffff", $borderColor="#888888", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
15-
AddElementTag("Container,Mobile App", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
16-
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
17-
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
18-
AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
12+
AddElementTag("Failover", $bgColor="#ffffff", $borderColor="#888888", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
13+
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
14+
AddElementTag("Element", $bgColor="#ffffff", $borderColor="#888888", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
15+
AddElementTag("Container,Mobile App", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
16+
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
17+
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
18+
AddElementTag("Container", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1919

2020
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
2121

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-SignIn-sequence.puml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ title API Application - Dynamic
44

55
!include <C4/C4_Sequence>
66

7-
AddElementTag("Component", $bgColor="#85bbf0", $borderColor="#5d82a8", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
8-
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
9-
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
7+
AddElementTag("Component", $bgColor="#85bbf0", $borderColor="#5d82a8", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
8+
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
9+
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1010

1111
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
1212

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-SignIn.puml

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ top to bottom direction
99
!include <C4/C4_Container>
1010
!include <C4/C4_Component>
1111

12-
AddElementTag("Component", $bgColor="#85bbf0", $borderColor="#5d82a8", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
13-
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
14-
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
12+
AddElementTag("Component", $bgColor="#85bbf0", $borderColor="#5d82a8", $fontColor="#000000", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
13+
AddElementTag("Container,Database", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
14+
AddElementTag("Container,Web Browser", $bgColor="#438dd5", $borderColor="#2e6295", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1515

1616
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
1717

18-
AddBoundaryTag("Container", $bgColor="#ffffff", $borderColor="#2e6295", $fontColor="#2e6295", $shadowing="", $borderStyle="Solid", $borderThickness="1")
18+
AddBoundaryTag("Container", $bgColor="#ffffff", $borderColor="#2e6295", $fontColor="#2e6295", $shadowing="", $borderStyle="solid", $borderThickness="1")
1919

2020
Container_Boundary("InternetBankingSystem.APIApplication_boundary", "API Application", $tags="Container") {
2121
Component(InternetBankingSystem.APIApplication.SignInController, "Sign In Controller", $techn="Spring MVC Rest Controller", $descr="Allows users to sign in to the Internet Banking System.", $tags="Component", $link="")

structurizr-export/src/test/java/com/structurizr/export/plantuml/c4plantuml/36141-SystemContext.puml

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ top to bottom direction
77
!include <C4/C4>
88
!include <C4/C4_Context>
99

10-
AddElementTag("Software System", $bgColor="#1168bd", $borderColor="#0b4884", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
11-
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
12-
AddElementTag("Person,Customer", $bgColor="#08427b", $borderColor="#052e56", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="Solid", $borderThickness="1")
10+
AddElementTag("Software System", $bgColor="#1168bd", $borderColor="#0b4884", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
11+
AddElementTag("Software System,Existing System", $bgColor="#999999", $borderColor="#6b6b6b", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
12+
AddElementTag("Person,Customer", $bgColor="#08427b", $borderColor="#052e56", $fontColor="#ffffff", $sprite="", $shadowing="", $borderStyle="solid", $borderThickness="1")
1313

1414
AddRelTag("Relationship", $textColor="#707070", $lineColor="#707070", $lineStyle = "")
1515

16-
AddBoundaryTag("Big Bank plc", $borderColor="#cccccc", $fontColor="#cccccc", $borderStyle="Dashed", $borderThickness="1")
16+
AddBoundaryTag("Big Bank plc", $borderColor="#cccccc", $fontColor="#cccccc", $borderStyle="dashed", $borderThickness="1")
1717
Boundary(group_1, "Big Bank plc", $tags="Big Bank plc") {
1818
System(MainframeBankingSystem, "Mainframe Banking System", $descr="Stores all of the core banking information about customers, accounts, transactions, etc.", $tags="Software System,Existing System", $link="")
1919
System(EmailSystem, "E-mail System", $descr="The internal Microsoft Exchange e-mail system.", $tags="Software System,Existing System", $link="")

0 commit comments

Comments
 (0)