Skip to content

Commit

Permalink
GH-476 - Move off legacy Structurizr PlantUML generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
odrotbohm committed Jan 21, 2024
1 parent c06a2c9 commit 232cb3c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 24 deletions.
6 changes: 0 additions & 6 deletions spring-modulith-docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
<version>1.29.0</version>
</dependency>

<dependency>
<groupId>com.structurizr</groupId>
<artifactId>structurizr-plantuml</artifactId>
<version>1.6.3</version>
</dependency>

<dependency>
<groupId>com.structurizr</groupId>
<artifactId>structurizr-export</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.lang.annotation.Annotation;
import java.nio.file.Files;
Expand Down Expand Up @@ -50,10 +49,9 @@
import org.springframework.util.MultiValueMap;

import com.structurizr.Workspace;
import com.structurizr.export.Diagram;
import com.structurizr.export.IndentingWriter;
import com.structurizr.export.plantuml.C4PlantUMLExporter;
import com.structurizr.io.plantuml.BasicPlantUMLWriter;
import com.structurizr.io.plantuml.PlantUMLWriter;
import com.structurizr.export.plantuml.StructurizrPlantUMLExporter;
import com.structurizr.model.Component;
import com.structurizr.model.Container;
import com.structurizr.model.Element;
Expand Down Expand Up @@ -487,26 +485,18 @@ private String render(ComponentView view, DiagramOptions options) {

case C4:

C4PlantUMLExporter exporter = new C4PlantUMLExporter();
Diagram diagram = exporter.export(view);
var c4PlantUmlExporter = new C4PlantUMLExporter();
var diagram = c4PlantUmlExporter.export(view);

return diagram.getDefinition();

case UML:
default:

Writer writer = new StringWriter();
PlantUMLWriter umlWriter = new BasicPlantUMLWriter() {

@Override
protected void writeContainerForContainer(ComponentView view, Writer writer,
BiConsumer<ComponentView, Writer> packageContentWriter) throws IOException {
packageContentWriter.accept(view, writer);
}
};
umlWriter.addSkinParam("componentStyle", "uml1");
umlWriter.write(view, writer);
var plantUmlExporter = new CustomizedPlantUmlExporter();
plantUmlExporter.addSkinParam("componentStyle", "uml1");

return writer.toString();
return plantUmlExporter.export(view).getDefinition();
}
}

Expand Down Expand Up @@ -1173,4 +1163,18 @@ boolean hasOnlyFallbackGroup() {
}
}
}

private static class CustomizedPlantUmlExporter extends StructurizrPlantUMLExporter {

@Override
protected boolean includeTitle(ModelView view) {
return false;
};

@Override
protected void startContainerBoundary(ModelView view, Container container, IndentingWriter writer) {}

@Override
protected void endContainerBoundary(ModelView view, IndentingWriter writer) {};
};
}

0 comments on commit 232cb3c

Please sign in to comment.