Skip to content

Commit 837fe69

Browse files
structurizr-export: StructurizrPlantUMLExporter - adds technology to sequence diagrams. Closes #425.
1 parent c8ba7f9 commit 837fe69

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- structurizr-export: Removes support for deprecated enterprise and location concepts.
2424
- structurizr-export: PlantUML exporters - replaces skinparams with styles.
2525
- structurizr-export: PlantUML exporters - adds support for dark mode exports.
26+
- structurizr-export: StructurizrPlantUMLExporter - adds technology to sequence diagrams (https://github.com/structurizr/java/issues/425)
2627
- structurizr-import: Adds support for `plantuml.inline`, `mermaid.inline`, `kroki.inline`, and `image.inline` properties to inline the resulting PNG/SVG file into the workspace.
2728
- structurizr-inspection: Adds a way to disable inspections via a workspace property named `structurizr.inspection` (`false` to disable).
2829
- structurizr-inspection: Default inspector adds a summary of error/warning/info/ignore counts as workspace properties.

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ protected void writeRelationship(ModelView view, RelationshipView relationshipVi
428428
);
429429
plantUMLStyles.add(plantUMLRelationshipStyle);
430430

431+
int metadataFontSize = calculateMetadataFontSize(style.getFontSize());
431432
String description = "";
432433
String technology = relationship.getTechnology();
433434

@@ -451,13 +452,14 @@ protected void writeRelationship(ModelView view, RelationshipView relationshipVi
451452
}
452453

453454
writer.writeLine(
454-
String.format("%s %s%s %s <<%s>> : %s",
455+
String.format("%s %s%s %s <<%s>> : %s%s",
455456
idOf(relationship.getSource()),
456457
arrowStart,
457458
arrowEnd,
458459
idOf(relationship.getDestination()),
459460
plantUMLRelationshipStyle.getClassSelector(),
460-
description));
461+
description,
462+
(StringUtils.isNullOrEmpty(technology) ? "" : "\\n<size:" + metadataFontSize + ">[" + technology + "]</size>")));
461463
} else {
462464
String arrow;
463465

@@ -467,12 +469,6 @@ protected void writeRelationship(ModelView view, RelationshipView relationshipVi
467469
arrow = "-->";
468470
}
469471

470-
// if (!isVisible(view, relationshipView)) {
471-
// relationshipStyle = "hidden";
472-
// }
473-
474-
int metadataFontSize = calculateMetadataFontSize(style.getFontSize());
475-
476472
// 1 --> 2 : "...\n<size:..>...</size>
477473
writer.writeLine(format("%s %s %s <<%s>> : \"%s%s\"",
478474
idOf(relationship.getSource()),

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ public void dynamicView_SequenceStyle_NoStyling_Light() {
647647
SoftwareSystem a = workspace.getModel().addSoftwareSystem("A");
648648
SoftwareSystem b = workspace.getModel().addSoftwareSystem("B");
649649

650-
a.uses(b, "Uses");
650+
a.uses(b, "Uses", "JSON/HTTPS");
651651

652652
DynamicView view = workspace.getViews().createDynamicView("key", "Description");
653653
view.add(a, b);
@@ -692,8 +692,8 @@ public void dynamicView_SequenceStyle_NoStyling_Light() {
692692
693693
participant "A\\n<size:16>[Software System]</size>" as A <<Element-RWxlbWVudA==>> #ffffff
694694
participant "B\\n<size:16>[Software System]</size>" as B <<Element-RWxlbWVudA==>> #ffffff
695-
696-
A -> B <<Relationship-UmVsYXRpb25zaGlw>> : Uses
695+
696+
A -> B <<Relationship-UmVsYXRpb25zaGlw>> : 1. Uses\\n<size:16>[JSON/HTTPS]</size>
697697
698698
@enduml""", diagram.getDefinition());
699699

0 commit comments

Comments
 (0)