use of com.structurizr.io.plantuml.PlantUMLWriter in project tutorials by eugenp.
the class StructurizrSimple method exportToPlantUml.
private static void exportToPlantUml(View view) throws WorkspaceWriterException {
StringWriter stringWriter = new StringWriter();
PlantUMLWriter plantUMLWriter = new PlantUMLWriter();
plantUMLWriter.write(view, stringWriter);
System.out.println(stringWriter.toString());
}
use of com.structurizr.io.plantuml.PlantUMLWriter in project cia by Hack23.
the class AppPublicSystemDocumentation method printPlantUml.
/**
* Prints the plant uml.
*
* @param workspace
* the workspace
* @throws WorkspaceWriterException
* the workspace writer exception
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws InterruptedException
* the interrupted exception
*/
private static void printPlantUml(final Workspace workspace) throws WorkspaceWriterException, IOException, InterruptedException {
final StringWriter stringWriter = new StringWriter();
final PlantUMLWriter plantUMLWriter = new BasicPlantUMLWriter();
// plantUMLWriter.setSizeLimit(16384);
plantUMLWriter.write(workspace, stringWriter);
String allPlantUmlsString = stringWriter.toString();
final String systemUml2 = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(systemUml2, "");
writePlantUml("Citizen-Intelligence-Agency-System-System-Deployment", systemUml2);
final String componentUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(componentUml, "");
writePlantUml("Citizen-Intelligence-Agency-System-Web-Application-Components", componentUml);
final String containersUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(containersUml, "");
writePlantUml("Citizen-Intelligence-Agency-System-Containers", containersUml);
final String systemUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(systemUml, "");
writePlantUml("Citizen-Intelligence-Agency-System-System-Context", systemUml);
final String enterpriseUml = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
allPlantUmlsString = allPlantUmlsString.replace(enterpriseUml, "");
writePlantUml("Enterprise-Context-for-Hack23", enterpriseUml);
}
use of com.structurizr.io.plantuml.PlantUMLWriter in project agile-architecture-documentation-system by Riduidel.
the class GraphEmitter method writeAllViews.
private void writeAllViews(Workspace workspace) {
Layout layout = C4PlantUMLWriter.Layout.valueOf(layoutMode);
PlantUMLWriter plantUMLWriter = new C4PlantUMLWriter(layout, plantumlPencils);
// Hints to have arrows more easily visible
plantUMLWriter.addSkinParam("pathHoverColor", "GreenYellow");
plantUMLWriter.addSkinParam("ArrowThickness", "3");
plantUMLWriter.addSkinParam("svgLinkTarget", "_parent");
destination.mkdirs();
plantUMLWriter.toPlantUMLDiagrams(workspace).stream().parallel().forEach(diagram -> {
// Incredibly enough, that's not a view!
Path path = new File(destination, diagram.getKey() + ".plantuml").toPath();
try {
Files.write(path, diagram.getDefinition().getBytes(Charset.forName("UTF-8")));
logger.info(String.format("Generated diagram %s in file %s", diagram.getKey(), path));
} catch (IOException e) {
throw new CantWriteDiagram(String.format("Can't write diagram %s in file %s", diagram.getKey(), path), e);
}
});
}
use of com.structurizr.io.plantuml.PlantUMLWriter in project cia by Hack23.
the class AwsPublicSystemDocumentation method printPlantUml.
/**
* Prints the plant uml.
*
* @param workspace
* the workspace
* @throws WorkspaceWriterException
* the workspace writer exception
* @throws IOException
* Signals that an I/O exception has occurred.
* @throws InterruptedException
* the interrupted exception
*/
private static void printPlantUml(final Workspace workspace) throws WorkspaceWriterException, IOException, InterruptedException {
final StringWriter stringWriter = new StringWriter();
final PlantUMLWriter plantUMLWriter = new BasicPlantUMLWriter();
plantUMLWriter.write(workspace, stringWriter);
final String allPlantUmlsString = stringWriter.toString();
final String awsSystem = allPlantUmlsString.substring(allPlantUmlsString.lastIndexOf("@startuml"), allPlantUmlsString.lastIndexOf("@enduml") + "@enduml".length());
writePlantUml("Citizen-Intelligence-Agency-Prod-Aws-Account-Structure", awsSystem);
}
use of com.structurizr.io.plantuml.PlantUMLWriter in project moduliths by moduliths.
the class Documenter method render.
private String render(ComponentView view, Options options) {
switch(options.style) {
case C4:
C4PlantUMLExporter exporter = new C4PlantUMLExporter();
Diagram diagram = exporter.export(view);
return diagram.getDefinition();
case UML:
default:
Writer writer = new StringWriter();
PlantUMLWriter umlWriter = new BasicPlantUMLWriter();
umlWriter.addSkinParam("componentStyle", "uml1");
umlWriter.write(view, writer);
return writer.toString();
}
}
Aggregations