Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ subprojects { proj ->

publishing {
repositories {
maven {
name = "ossrh"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
// maven {
// name = "ossrh"
// url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
// credentials {
// username = findProperty('ossrhUsername')
// password = findProperty('ossrhPassword')
// }
// }
mavenLocal()
}

publications {
Expand Down Expand Up @@ -98,8 +99,8 @@ subprojects { proj ->
}
}

signing {
sign publishing.publications.mavenJava
}
// signing {
// sign publishing.publications.mavenJava
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public final Collection<Diagram> export(Workspace workspace) {
throw new IllegalArgumentException("A workspace must be provided.");
}

Collection<Diagram> diagrams = new ArrayList<>();
Collection<Diagram> diagrams = new ArrayList<>() ;

for (CustomView view : workspace.getViews().getCustomViews()) {
Diagram diagram = export(view);
Expand Down Expand Up @@ -295,7 +295,7 @@ public Diagram export(ComponentView view, Integer animationStep) {
writer.writeLine();
}

boolean includeSoftwareSystemBoundaries = "true".equals(view.getProperties().getOrDefault("structurizr.softwareSystemBoundaries", "false"));
boolean includeSoftwareSystemBoundaries = "true".equalsIgnoreCase(getViewOrViewSetProperty(view, "structurizr.softwareSystemBoundaries", "false"));

List<Container> containers = getBoundaryContainers(view);
Set<SoftwareSystem> softwareSystems = containers.stream().map(Container::getSoftwareSystem).collect(Collectors.toCollection(LinkedHashSet::new));
Expand Down Expand Up @@ -394,8 +394,8 @@ public Diagram export(DynamicView view, String order) {
}
} else if (element instanceof Container) {
// dynamic view with container scope
boolean includeSoftwareSystemBoundaries = "true".equals(view.getProperties().getOrDefault("structurizr.softwareSystemBoundaries", "false"));

boolean includeSoftwareSystemBoundaries = "true".equalsIgnoreCase(getViewOrViewSetProperty(view, "structurizr.softwareSystemBoundaries", "false"));
List<Container> containers = getBoundaryContainers(view);
Set<SoftwareSystem> softwareSystems = containers.stream().map(Container::getSoftwareSystem).collect(Collectors.toCollection(LinkedHashSet::new));
for (SoftwareSystem softwareSystem : softwareSystems) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public abstract class AbstractPlantUMLExporter extends AbstractDiagramExporter {
public static final String PLANTUML_INCLUDES_PROPERTY = "plantuml.includes";
public static final String PLANTUML_ANIMATION_PROPERTY = "plantuml.animation";
public static final String PLANTUML_SEQUENCE_DIAGRAM_PROPERTY = "plantuml.sequenceDiagram";
public static final String PLANTUML_TEOZ_PROPERTY= "plantuml.teoz";

public static final String DIAGRAM_TITLE_TAG = "Diagram:Title";
public static final String DIAGRAM_DESCRIPTION_TAG = "Diagram:Description";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public StructurizrPlantUMLExporter(ColorScheme colorScheme) {
protected void writeHeader(ModelView view, IndentingWriter writer) {
plantUMLStyles = new HashSet<>();
super.writeHeader(view, writer);
if (renderAsTeozDiagram(view)) {
writer.writeLine("!pragma teoz true");
}

if (renderAsSequenceDiagram(view)) {
// do nothing
Expand Down Expand Up @@ -114,7 +117,7 @@ protected void startGroupBoundary(ModelView view, String group, IndentingWriter
if (!StringUtils.isNullOrEmpty(groupSeparator)) {
groupName = group.substring(group.lastIndexOf(groupSeparator) + groupSeparator.length());
}

ElementStyle elementStyle = findGroupStyle(view, group);
PlantUMLGroupStyle plantUMLBoundaryStyle = new PlantUMLGroupStyle(
group,
Expand Down Expand Up @@ -146,7 +149,13 @@ protected void startGroupBoundary(ModelView view, String group, IndentingWriter
Base64.getEncoder().encodeToString(group.getBytes()))
);
writer.indent();
} else {
writer.writeLine(String.format("box \"%s\" <<%s>>", groupName, classSelectorForGroup(group)));
writer.indent();
writer.writeLine("box");
writer.indent();
}
writer.writeLine();
}

@Override
Expand All @@ -155,25 +164,32 @@ protected void endGroupBoundary(ModelView view, IndentingWriter writer) {
writer.outdent();
writer.writeLine("}");
writer.writeLine();
} else {
writer.outdent();
writer.writeLine("end box");
writer.outdent();
writer.writeLine("end box");
writer.writeLine();


}
}

@Override
protected void startSoftwareSystemBoundary(ModelView view, SoftwareSystem softwareSystem, IndentingWriter writer) {
ElementStyle elementStyle = findBoundaryStyle(view, softwareSystem);
PlantUMLBoundaryStyle plantUMLBoundaryStyle = new PlantUMLBoundaryStyle(
softwareSystem.getName(),
elementStyle.getBackground(),
elementStyle.getColor(),
elementStyle.getStroke(),
elementStyle.getStrokeWidth() != null ? elementStyle.getStrokeWidth() : DEFAULT_STROKE_WIDTH,
elementStyle.getBorder(),
elementStyle.getFontSize(),
"true".equalsIgnoreCase(elementStyle.getProperties().getOrDefault(PLANTUML_SHADOW, "false"))
);
plantUMLStyles.add(plantUMLBoundaryStyle);
if (!renderAsSequenceDiagram(view)) {
ElementStyle elementStyle = findBoundaryStyle(view, softwareSystem);
PlantUMLBoundaryStyle plantUMLBoundaryStyle = new PlantUMLBoundaryStyle(
softwareSystem.getName(),
elementStyle.getBackground(),
elementStyle.getColor(),
elementStyle.getStroke(),
elementStyle.getStrokeWidth() != null ? elementStyle.getStrokeWidth() : DEFAULT_STROKE_WIDTH,
elementStyle.getBorder(),
elementStyle.getFontSize(),
"true".equalsIgnoreCase(elementStyle.getProperties().getOrDefault(PLANTUML_SHADOW, "false"))
);
plantUMLStyles.add(plantUMLBoundaryStyle);

writer.writeLine(
String.format(
"rectangle \"%s\\n<size:%s>%s</size>\" <<%s>> {",
Expand All @@ -182,7 +198,18 @@ protected void startSoftwareSystemBoundary(ModelView view, SoftwareSystem softwa
typeOf(view, softwareSystem, true),
plantUMLBoundaryStyle.getClassSelector()
)
);
);
writer.indent();
} else {
writer.writeLine(
String.format("box \"%s\n%s\" <<%s>>",
softwareSystem.getName(),
typeOf(view, softwareSystem, true),
plantUMLBoundaryStyle.getClassSelector()
)
);
writer.indent();
writer.writeLine("box");
writer.indent();
}
}
Expand All @@ -193,32 +220,48 @@ protected void endSoftwareSystemBoundary(ModelView view, IndentingWriter writer)
writer.outdent();
writer.writeLine("}");
writer.writeLine();
} else {
writer.outdent();
writer.writeLine("end box");
writer.outdent();
writer.writeLine("end box");
writer.writeLine();
}
}

@Override
protected void startContainerBoundary(ModelView view, Container container, IndentingWriter writer) {
ElementStyle elementStyle = findBoundaryStyle(view, container);
PlantUMLBoundaryStyle plantUMLBoundaryStyle = new PlantUMLBoundaryStyle(
container.getName(),
elementStyle.getBackground(),
elementStyle.getColor(),
elementStyle.getStroke(),
elementStyle.getStrokeWidth() != null ? elementStyle.getStrokeWidth() : DEFAULT_STROKE_WIDTH,
elementStyle.getBorder(),
elementStyle.getFontSize(),
"true".equalsIgnoreCase(elementStyle.getProperties().getOrDefault(PLANTUML_SHADOW, "false"))
);
plantUMLStyles.add(plantUMLBoundaryStyle);
if (!renderAsSequenceDiagram(view)) {
ElementStyle elementStyle = findBoundaryStyle(view, container);
PlantUMLBoundaryStyle plantUMLBoundaryStyle = new PlantUMLBoundaryStyle(
container.getName(),
elementStyle.getBackground(),
elementStyle.getColor(),
elementStyle.getStroke(),
elementStyle.getStrokeWidth() != null ? elementStyle.getStrokeWidth() : DEFAULT_STROKE_WIDTH,
elementStyle.getBorder(),
elementStyle.getFontSize(),
"true".equalsIgnoreCase(elementStyle.getProperties().getOrDefault(PLANTUML_SHADOW, "false"))
);
plantUMLStyles.add(plantUMLBoundaryStyle);

writer.writeLine(
String.format(
"rectangle \"%s\\n<size:%s>%s</size>\" <<%s>> {",
container.getName(),
calculateMetadataFontSize(findBoundaryStyle(view, container).getFontSize()), typeOf(view, container, true),
plantUMLBoundaryStyle.getClassSelector()));
writer.indent();
} else {
writer.writeLine(
String.format("box \"%s\n%s\" <<%s>>",
container.getName(),
typeOf(view, container, true),
plantUMLBoundaryStyle.getClassSelector()
)
);
writer.indent();
writer.writeLine("box");
writer.indent();
}
}

Expand All @@ -228,6 +271,12 @@ protected void endContainerBoundary(ModelView view, IndentingWriter writer) {
writer.outdent();
writer.writeLine("}");
writer.writeLine();
} else {
writer.outdent();
writer.writeLine("end box");
writer.outdent();
writer.writeLine("end box");
writer.writeLine();
}
}

Expand Down Expand Up @@ -291,34 +340,11 @@ protected void endDeploymentNodeBoundary(ModelView view, IndentingWriter writer)

@Override
public Diagram export(DynamicView view) {
if (renderAsSequenceDiagram(view)) {
IndentingWriter writer = new IndentingWriter();
writeHeader(view, writer);

Set<Element> elements = new LinkedHashSet<>();
for (RelationshipView relationshipView : view.getRelationships()) {
elements.add(relationshipView.getRelationship().getSource());
elements.add(relationshipView.getRelationship().getDestination());
}

for (Element element : elements) {
writeElement(view, element, writer);
}

if (!elements.isEmpty()) {
writer.writeLine();
Diagram diagram = super.export(view);
if (renderAsSequenceDiagram(view)) {
diagram.setLegend(createLegend(view));
}

writeRelationships(view, writer);
writeFooter(view, writer);

Diagram diagram = createDiagram(view, writer.toString());
diagram.setLegend(createLegend(view));

return diagram;
} else {
return super.export(view);
}
}

@Override
Expand Down Expand Up @@ -446,7 +472,6 @@ protected void writeRelationship(ModelView view, RelationshipView relationshipVi
arrowStart = "<-";
arrowEnd = "-";
}

writer.writeLine(
String.format("%s %s%s %s <<%s>> : %s%s",
idOf(relationship.getSource()),
Expand Down Expand Up @@ -546,7 +571,11 @@ protected Legend createLegend(ModelView view) {
protected boolean renderAsSequenceDiagram(ModelView view) {
return view instanceof DynamicView && "true".equalsIgnoreCase(getViewOrViewSetProperty(view, PLANTUML_SEQUENCE_DIAGRAM_PROPERTY, "false"));
}


protected boolean renderAsTeozDiagram(ModelView view) {
return view instanceof DynamicView && "true".equalsIgnoreCase(getViewOrViewSetProperty(view, PLANTUML_TEOZ_PROPERTY, "false"));
}

private String classSelectorFor(ElementStyle elementStyle) {
return "Element-" + Base64.getEncoder().encodeToString(elementStyle.getTag().getBytes());
}
Expand Down Expand Up @@ -644,4 +673,5 @@ private String toLineStyle(ElementStyle elementStyle) {
}
}

}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file added structurizr-export/src/test/.structurizr/index/_2.si
Binary file not shown.
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public void test_GroupsExample() throws Exception {

DOTExporter exporter = new DOTExporter();
Collection<Diagram> diagrams = exporter.export(workspace);
assertEquals(3, diagrams.size());
assertEquals(4, diagrams.size());

Diagram diagram = diagrams.stream().filter(md -> md.getKey().equals("SystemLandscape")).findFirst().get();
assertEquals("""
Expand Down Expand Up @@ -703,6 +703,7 @@ public void test_GroupsExample() throws Exception {

3 -> 7 [id=13, label=<>, style="dashed", color="#444444", fontcolor="#444444"]
3 -> 8 [id=15, label=<>, style="dashed", color="#444444", fontcolor="#444444"]
7 -> 8 [id=16, label=<>, style="dashed", color="#444444", fontcolor="#444444"]

}""", diagram.getDefinition());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
digraph {
compound=true
graph [fontname="Arial", rankdir=TB, ranksep=1.0, nodesep=1.0]
node [fontname="Arial", shape=box, margin="0.4,0.3"]
edge [fontname="Arial"]
label=<<br /><font point-size="34">D - F - Components</font>>

3 [id=3,shape=rect, label=<<font point-size="34">C</font><br /><font point-size="19">[Software System]</font>>, style=filled, color="#9a9a9a", fillcolor="#dddddd", fontcolor="#000000"]

subgraph cluster_6 {
margin=25
label=<<font point-size="24"><br />F</font><br /><font point-size="19">[Container]</font>>
labelloc=b
color="#444444"
fontcolor="#444444"
fillcolor="#444444"

subgraph "cluster_group_Group 5" {
margin=25
label=<<font point-size="24"><br />Group 5</font>>
labelloc=b
color="#cccccc"
fontcolor="#cccccc"
fillcolor="#ffffff"
style="dashed"

8 [id=8,shape=rect, label=<<font point-size="34">H</font><br /><font point-size="19">[Component]</font>>, style=filled, color="#9a9a9a", fillcolor="#dddddd", fontcolor="#000000"]
}

7 [id=7,shape=rect, label=<<font point-size="34">G</font><br /><font point-size="19">[Component]</font>>, style=filled, color="#9a9a9a", fillcolor="#dddddd", fontcolor="#000000"]
}

3 -> 7 [id=13, label=<>, style="dashed", color="#707070", fontcolor="#707070"]
3 -> 8 [id=15, label=<>, style="dashed", color="#707070", fontcolor="#707070"]
7 -> 8 [id=16, label=<>, style="dashed", color="#707070", fontcolor="#707070"]
}
Loading