Search in sources :

Example 1 with BasicPlantUMLWriter

use of com.structurizr.io.plantuml.BasicPlantUMLWriter 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);
}
Also used : StringWriter(java.io.StringWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) PlantUMLWriter(com.structurizr.io.plantuml.PlantUMLWriter)

Example 2 with BasicPlantUMLWriter

use of com.structurizr.io.plantuml.BasicPlantUMLWriter 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);
}
Also used : StringWriter(java.io.StringWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) PlantUMLWriter(com.structurizr.io.plantuml.PlantUMLWriter)

Example 3 with BasicPlantUMLWriter

use of com.structurizr.io.plantuml.BasicPlantUMLWriter 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();
    }
}
Also used : C4PlantUMLExporter(com.structurizr.io.plantuml.C4PlantUMLExporter) StringWriter(java.io.StringWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) PlantUMLWriter(com.structurizr.io.plantuml.PlantUMLWriter) BasicPlantUMLWriter(com.structurizr.io.plantuml.BasicPlantUMLWriter) Writer(java.io.Writer) StringWriter(java.io.StringWriter) FileWriter(java.io.FileWriter) PlantUMLWriter(com.structurizr.io.plantuml.PlantUMLWriter) Diagram(com.structurizr.io.Diagram)

Aggregations

BasicPlantUMLWriter (com.structurizr.io.plantuml.BasicPlantUMLWriter)3 PlantUMLWriter (com.structurizr.io.plantuml.PlantUMLWriter)3 StringWriter (java.io.StringWriter)3 Diagram (com.structurizr.io.Diagram)1 C4PlantUMLExporter (com.structurizr.io.plantuml.C4PlantUMLExporter)1 FileWriter (java.io.FileWriter)1 Writer (java.io.Writer)1