com.structurizr.Workspace

Here are the examples of the java api com.structurizr.Workspace taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

167 Examples 7

19 Source : StructurizrViewsMapper.java
with Apache License 2.0
from trilogy-group

public void loadAndSetViews(Workspace workspace) {
    try {
        ViewSet viewSet = loadStructurizrViews();
        addViewsWithReferencedObjects(workspace, viewSet);
    } catch (IOException e) {
        logger.error("Failed to load views", e);
        throw new RuntimeException("Failed to load Structurizr views", e);
    }
}

19 Source : IlographWriter.java
with Apache License 2.0
from structurizr

public void write(Workspace workspace, Writer writer) throws Exception {
    writeModel(workspace, writer);
}

19 Source : DslContext.java
with Apache License 2.0
from structurizr

void setWorkspace(Workspace workspace) {
    this.workspace = workspace;
}

19 Source : ViewCreator.java
with Apache License 2.0
from jakubnabrdalik

static Workspace setupView(Workspace workspace, Function<ViewSet, StaticView> viewGenerator) {
    return setupView(workspace, viewGenerator, PaperSize.A4_Landscape);
}

19 Source : CarShareComponents.java
with Apache License 2.0
from jakubnabrdalik

static SampleCarShareModules create(Workspace workspace, InternalContainers internalContainers, ExternalSystems externalSystems) {
    SampleCarShareModules sampleCarShareModules = new SampleCarShareModules(internalContainers.getBigMonilithicApplication());
    sampleCarShareModules.createUsages(internalContainers, externalSystems);
    setupComponentView(workspace, internalContainers.getBigMonilithicApplication());
    return sampleCarShareModules;
}

18 Source : DocumentationEnhancerTest.java
with Apache License 2.0
from trilogy-group

@Test
public void shouldLogErrorsAndContinueWhenLoadingDoreplacedentation() throws IOException {
    // Given
    Workspace workspace = new Workspace("Foo", "Bazz");
    final FilesFacade mockedFilesFacade = mock(FilesFacade.clreplaced);
    when(mockedFilesFacade.readString(any())).thenThrow(new IOException("Boom!"));
    final String file = getClreplaced().getResource(ROOT_PATH_TO_TEST_PRODUCT_DOreplacedENTATION).getFile();
    // When
    new DoreplacedentationEnhancer(new File(file), mockedFilesFacade).enhance(workspace, new ArchitectureDataStructure());
    // Then
    collector.checkThat(dummyOut.getLog(), equalTo(""));
    collector.checkThat(dummyErr.getLog(), containsString("Unable to import doreplacedentation: 1_context-diagram.md\nError thrown: java.io.IOException: Boom!"));
    collector.checkThat(dummyErr.getLog(), containsString("Unable to import doreplacedentation: 2_functional-overview.md\nError thrown: java.io.IOException: Boom!"));
    collector.checkThat(dummyErr.getLog(), containsString("Unable to import doreplacedentation: 3_Ascii-docs.txt\nError thrown: java.io.IOException: Boom!"));
    collector.checkThat(dummyErr.getLog(), containsString("Unable to import doreplacedentation: no_order.txt\nError thrown: java.io.IOException: Boom!"));
}

18 Source : FunctionalYamlTddIdGeneratorTest.java
with Apache License 2.0
from trilogy-group

private Person newPerson() {
    Workspace workspace = new Workspace("foo", "blah");
    return workspace.getModel().addPerson("abc", "def");
}

18 Source : StructurizrViewsMapper.java
with Apache License 2.0
from trilogy-group

private static void setSoftwareSystem(Workspace workspace, View view) {
    if (view.getSoftwareSystem() == null && view.getSoftwareSystemId() != null) {
        SoftwareSystem softwareSystem = workspace.getModel().getSoftwareSystemWithId(view.getSoftwareSystemId());
        setOnModel(view, softwareSystem);
    }
}

18 Source : WebSequenceDiagramsWriterTests.java
with Apache License 2.0
from structurizr

public clreplaced WebSequenceDiagramsWriterTests {

    private WebSequenceDiagramsWriter webSequenceDiagramsWriter;

    private Workspace workspace;

    private StringWriter stringWriter;

    @Before
    public void setUp() {
        webSequenceDiagramsWriter = new WebSequenceDiagramsWriter();
        workspace = new Workspace("Name", "Description");
        stringWriter = new StringWriter();
    }

    @Test
    public void test_write_DoesNotThrowAnExceptionWhenPreplacededNullParameters() throws Exception {
        webSequenceDiagramsWriter.write((Workspace) null, null);
        webSequenceDiagramsWriter.write(workspace, null);
        webSequenceDiagramsWriter.write((Workspace) null, stringWriter);
    }

    @Test
    public void test_write_createsAWebSequenceDiagram() throws Exception {
        Model model = workspace.getModel();
        Person user = model.addPerson("User", "");
        SoftwareSystem a = model.addSoftwareSystem("System A", "");
        SoftwareSystem b = model.addSoftwareSystem("System B", "");
        user.uses(a, "");
        a.uses(b, "", "", InteractionStyle.Asynchronous);
        DynamicView view = workspace.getViews().createDynamicView("Some Key", "A description of the diagram");
        view.add(user, "Does something using", a);
        view.add(a, "Does something then using", b);
        view.add(b, "Responds with X", a);
        view.add(a, "Sends X back", user);
        webSequenceDiagramsWriter.write(workspace, stringWriter);
        replacedertEquals("replacedle Dynamic - Some Key\n" + "\n" + "actor <<Person>>>\\nUser as User\n" + "participant <<Software System>>>\\nSystem A as System A\n" + "participant <<Software System>>>\\nSystem B as System B\n" + "\n" + "User->System A: Does something using\n" + "System A->>System B: Does something then using\n" + "System B-->>System A: Responds with X\n" + "System A-->User: Sends X back\n".replaceAll("\n", System.lineSeparator()), stringWriter.toString());
    }
}

18 Source : AbstractPlantUMLWriterTests.java
with Apache License 2.0
from structurizr

@Test
public void test_writeWorkspace_ThrowsAnExceptionWhenPreplacededANullWriter() throws Exception {
    BasicPlantUMLWriter plantUMLWriter = new BasicPlantUMLWriter();
    Workspace workspace = new Workspace("Name", "Description");
    try {
        plantUMLWriter.write(workspace, null);
        fail();
    } catch (Exception e) {
        replacedertEquals("A writer must be provided.", e.getMessage());
    }
}

18 Source : PlantUMLWriter.java
with Apache License 2.0
from structurizr

/**
 * Writes the views in the given workspace as PlantUML definitions, to the specified writer.
 *
 * @param workspace     the workspace containing the views to be written
 * @param writer        the Writer to write to
 */
public final void write(Workspace workspace, Writer writer) {
    if (workspace == null) {
        throw new IllegalArgumentException("A workspace must be provided.");
    }
    if (writer == null) {
        throw new IllegalArgumentException("A writer must be provided.");
    }
    workspace.getViews().getSystemLandscapeViews().forEach(v -> write(v, writer));
    workspace.getViews().getSystemContextViews().forEach(v -> write(v, writer));
    workspace.getViews().getContainerViews().forEach(v -> write(v, writer));
    workspace.getViews().getComponentViews().forEach(v -> write(v, writer));
    workspace.getViews().getDynamicViews().forEach(v -> write(v, writer));
    workspace.getViews().getDeploymentViews().forEach(v -> write(v, writer));
}

18 Source : MermaidWriter.java
with Apache License 2.0
from structurizr

/**
 * Writes the views in the given workspace as PlantUML definitions, to the specified writer.
 *
 * @param workspace     the workspace containing the views to be written
 * @param writer        the Writer to write to
 */
public void write(Workspace workspace, Writer writer) {
    if (workspace == null) {
        throw new IllegalArgumentException("A workspace must be provided.");
    }
    if (writer == null) {
        throw new IllegalArgumentException("A writer must be provided.");
    }
    workspace.getViews().getSystemLandscapeViews().forEach(v -> write(v, writer));
    workspace.getViews().getSystemContextViews().forEach(v -> write(v, writer));
    workspace.getViews().getContainerViews().forEach(v -> write(v, writer));
    workspace.getViews().getComponentViews().forEach(v -> write(v, writer));
    workspace.getViews().getDynamicViews().forEach(v -> write(v, writer));
    workspace.getViews().getDeploymentViews().forEach(v -> write(v, writer));
}

18 Source : IlographWriter.java
with Apache License 2.0
from structurizr

private void writeDeploymentNode(Workspace workspace, DeploymentNode deploymentNode, String indent, Writer writer) throws Exception {
    writeElement(writer, indent, workspace, deploymentNode);
    boolean hasChildren = !deploymentNode.getChildren().isEmpty() || !deploymentNode.getInfrastructureNodes().isEmpty() || !deploymentNode.getSoftwareSystemInstances().isEmpty() || !deploymentNode.getContainerInstances().isEmpty();
    if (hasChildren) {
        writer.append(indent + "  children:");
        writer.append(LINE_SEPARATOR);
    }
    List<DeploymentNode> deploymentNodes = new ArrayList<>(deploymentNode.getChildren());
    deploymentNodes.sort(Comparator.comparing(DeploymentNode::getId));
    for (DeploymentNode child : deploymentNodes) {
        writeDeploymentNode(workspace, child, indent + "  ", writer);
    }
    List<InfrastructureNode> infrastructureNodes = new ArrayList<>(deploymentNode.getInfrastructureNodes());
    infrastructureNodes.sort(Comparator.comparing(InfrastructureNode::getId));
    for (InfrastructureNode infrastructureNode : infrastructureNodes) {
        writeElement(writer, indent + "    ", workspace, infrastructureNode);
    }
    List<SoftwareSystemInstance> softwareSystemInstances = new ArrayList<>(deploymentNode.getSoftwareSystemInstances());
    softwareSystemInstances.sort(Comparator.comparing(SoftwareSystemInstance::getId));
    for (SoftwareSystemInstance softwareSystemInstance : softwareSystemInstances) {
        writeElement(writer, indent + "    ", workspace, softwareSystemInstance);
    }
    List<ContainerInstance> containerInstances = new ArrayList<>(deploymentNode.getContainerInstances());
    containerInstances.sort(Comparator.comparing(ContainerInstance::getId));
    for (ContainerInstance containerInstance : containerInstances) {
        writeElement(writer, indent + "    ", workspace, containerInstance);
    }
}

18 Source : SVGReaderTests.java
with Apache License 2.0
from structurizr

public static void main(String[] args) throws Exception {
    Workspace workspace = createWorkspace();
    DotFileWriter dotFileWriter = new DotFileWriter(PATH, RankDirection.TopBottom, 1.0, 1.0);
    dotFileWriter.write(workspace.getViews().getSystemContextViews().iterator().next());
}

18 Source : GraphvizAutomaticLayout.java
with Apache License 2.0
from structurizr

public void apply(Workspace workspace) throws Exception {
    for (SystemLandscapeView view : workspace.getViews().getSystemLandscapeViews()) {
        apply(view);
    }
    for (SystemContextView view : workspace.getViews().getSystemContextViews()) {
        apply(view);
    }
    for (ContainerView view : workspace.getViews().getContainerViews()) {
        apply(view);
    }
    for (ComponentView view : workspace.getViews().getComponentViews()) {
        apply(view);
    }
    for (DynamicView view : workspace.getViews().getDynamicViews()) {
        apply(view);
    }
    for (DeploymentView view : workspace.getViews().getDeploymentViews()) {
        apply(view);
    }
}

18 Source : DotWriter.java
with Apache License 2.0
from structurizr

/**
 * Writes the views in the given workspace as DOT notation, to the specified Writer.
 *
 * @param workspace     the workspace containing the views to be written
 * @param writer        the Writer to write to
 */
public void write(Workspace workspace, Writer writer) {
    workspace.getViews().getSystemContextViews().forEach(v -> write(v, null, writer));
    workspace.getViews().getContainerViews().forEach(v -> write(v, v.getSoftwareSystem(), writer));
    workspace.getViews().getComponentViews().forEach(v -> write(v, v.getContainer(), writer));
}

18 Source : AdrToolsImporterTests.java
with Apache License 2.0
from structurizr

public clreplaced AdrToolsImporterTests {

    private Workspace workspace;

    private SoftwareSystem softwareSystem;

    private Doreplacedentation doreplacedentation;

    @Before
    public void setUp() {
        workspace = new Workspace("Name", "Description");
        softwareSystem = workspace.getModel().addSoftwareSystem("Software System", "Description");
        doreplacedentation = workspace.getDoreplacedentation();
    }

    @Test
    public void test_construction_ThrowsAnException_WhenAWorkspaceIsNotSpecified() {
        try {
            new AdrToolsImporter(null, null);
            fail();
        } catch (IllegalArgumentException iae) {
            replacedertEquals("A workspace must be specified.", iae.getMessage());
        }
    }

    @Test
    public void test_construction_ThrowsAnException_WhenADirectoryIsNotSpecified() {
        try {
            new AdrToolsImporter(workspace, null);
            fail();
        } catch (IllegalArgumentException iae) {
            replacedertEquals("The path to the architecture decision records must be specified.", iae.getMessage());
        }
    }

    @Test
    public void test_construction_ThrowsAnException_WhenADirectoryIsSpecifiedBureplacedDoesNotExist() {
        try {
            new AdrToolsImporter(workspace, new File("some-random-path"));
            fail();
        } catch (IllegalArgumentException iae) {
            replacedertTrue(iae.getMessage().endsWith("structurizr-adr-tools/some-random-path does not exist."));
        }
    }

    @Test
    public void test_construction_ThrowsAnException_WhenAPathIsSpecifiedBureplacedIsNotADirectory() {
        try {
            new AdrToolsImporter(workspace, new File("build.gradle"));
            fail();
        } catch (IllegalArgumentException iae) {
            replacedertTrue(iae.getMessage().endsWith("structurizr-adr-tools/build.gradle is not a directory."));
        }
    }

    @Test
    public void test_importArchitectureDecisionRecords() throws Exception {
        AdrToolsImporter importer = new AdrToolsImporter(workspace, new File("test/unit/adrs"));
        importer.importArchitectureDecisionRecords();
        replacedertEquals(10, doreplacedentation.getDecisions().size());
        Decision decision1 = doreplacedentation.getDecisions().stream().filter(d -> d.getId().equals("1")).findFirst().get();
        replacedertEquals("1", decision1.getId());
        replacedertEquals("Record architecture decisions", decision1.getreplacedle());
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss ZZZ");
        sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
        replacedertEquals("12-Feb-2016 00:00:00 +0000", sdf.format(decision1.getDate()));
        replacedertEquals(DecisionStatus.Accepted, decision1.getStatus());
        replacedertEquals(Format.Markdown, decision1.getFormat());
        replacedertEquals("# 1. Record architecture decisions\n" + "\n" + "Date: 2016-02-12\n" + "\n" + "## Status\n" + "\n" + "Accepted\n" + "\n" + "## Context\n" + "\n" + "We need to record the architectural decisions made on this project.\n" + "\n" + "## Decision\n" + "\n" + "We will use Architecture Decision Records, as described by Michael Nygard in this article: http://thinkrelevance.com/blog/2011/11/15/doreplacedenting-architecture-decisions\n" + "\n" + "## Consequences\n" + "\n" + "See Michael Nygard's article, linked above.\n", decision1.getContent());
    }

    @Test
    public void test_importArchitectureDecisionRecords_RewritesLinksBetweenADRsWhenTheyAreNotreplacedociatedWithAnElement() throws Exception {
        AdrToolsImporter importer = new AdrToolsImporter(workspace, new File("test/unit/adrs"));
        importer.importArchitectureDecisionRecords();
        Decision decision5 = doreplacedentation.getDecisions().stream().filter(d -> d.getId().equals("5")).findFirst().get();
        replacedertTrue(decision5.getContent().contains("Amended by [9. Help scripts](#%2F:9)"));
    }

    @Test
    public void test_importArchitectureDecisionRecords_RewritesLinksBetweenADRsWhenTheyArereplacedociatedWithAnElement() throws Exception {
        AdrToolsImporter importer = new AdrToolsImporter(workspace, new File("test/unit/adrs"));
        importer.importArchitectureDecisionRecords(softwareSystem);
        Decision decision5 = doreplacedentation.getDecisions().stream().filter(d -> d.getId().equals("5")).findFirst().get();
        replacedertTrue(decision5.getContent().contains("Amended by [9. Help scripts](#%2FSoftware%20System:9)"));
    }

    @Test
    public void test_importArchitectureDecisionRecords_SupportsTheIncorrectSpellingOfSuperseded() throws Exception {
        AdrToolsImporter importer = new AdrToolsImporter(workspace, new File("test/unit/adrs"));
        importer.importArchitectureDecisionRecords();
        Decision decision4 = doreplacedentation.getDecisions().stream().filter(d -> d.getId().equals("4")).findFirst().get();
        replacedertEquals(DecisionStatus.Superseded, decision4.getStatus());
        System.out.println(decision4.getContent());
        replacedertTrue(decision4.getContent().contains("Superceded by [10. AsciiDoc format](#%2F:10)"));
    }
}

18 Source : AbstractTests.java
with Apache License 2.0
from structurizr

abstract clreplaced AbstractTests {

    protected Workspace workspace = new Workspace("Name", "Description");

    protected Model model = workspace.getModel();

    protected ViewSet views = workspace.getViews();

    protected ModelDslContext context() {
        model.setImpliedRelationshipsStrategy(new CreateImpliedRelationshipsUnlessAnyRelationshipExistsStrategy());
        ModelDslContext context = new ModelDslContext();
        context.setWorkspace(workspace);
        return context;
    }

    protected Tokens tokens(String... tokens) {
        return new Tokens(new ArrayList<>(Arrays.asList(tokens)));
    }
}

18 Source : StructurizrDslParser.java
with Apache License 2.0
from structurizr

/**
 * Main DSL parser clreplaced - forms the API for using the parser.
 */
public final clreplaced StructurizrDslParser extends StructurizrDslTokens {

    private static final Pattern EMPTY_LINE_PATTERN = Pattern.compile("^\\s*");

    private static final Pattern TOKENS_PATTERN = Pattern.compile("\"((\\\\.|[^\"])*)\"|(\\S+)");

    private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("\\w+");

    private static final Pattern COMMENT_PATTERN = Pattern.compile("^\\s*?(//|#).*$");

    private static final String MULTI_LINE_COMMENT_START_TOKEN = "/*";

    private static final String MULTI_LINE_COMMENT_END_TOKEN = "*/";

    private static final Pattern STRING_SUBSreplacedUTION_PATTERN = Pattern.compile("(\\$\\{[a-zA-Z0-9-_.]+?})");

    private Stack<DslContext> contextStack;

    private Map<String, Element> elements;

    private Map<String, Relationship> relationships;

    private Map<String, Constant> constants;

    private List<String> dslSourceLines = new ArrayList<>();

    private Workspace workspace;

    private boolean restricted = false;

    /**
     * Creates a new instance of the parser.
     */
    public StructurizrDslParser() {
        contextStack = new Stack<>();
        elements = new HashMap<>();
        relationships = new HashMap<>();
        constants = new HashMap<>();
        workspace = new Workspace("Name", "Description");
        workspace.getModel().setImpliedRelationshipsStrategy(new CreateImpliedRelationshipsUnlessAnyRelationshipExistsStrategy());
    }

    /**
     * Sets whether to run this parser in restricted mode (this stops !include, !docs, !adrs from working).
     *
     * @param restricted        true for restricted mode, false otherwise
     */
    public void setRestricted(boolean restricted) {
        this.restricted = restricted;
    }

    /**
     * Gets the workspace that has been created by parsing the Structurizr DSL.
     *
     * @return  a Workspace instance
     */
    public Workspace getWorkspace() {
        Dreplacedils.setDsl(workspace, getParsedDsl());
        return workspace;
    }

    private String getParsedDsl() {
        StringBuilder buf = new StringBuilder();
        for (String line : dslSourceLines) {
            buf.append(line);
            buf.append(System.lineSeparator());
        }
        return buf.toString();
    }

    /**
     * Parses the specified Structurizr DSL file(s), adding the parsed content to the workspace.
     * If "path" represents a single file, that single file will be parsed.
     * If "path" represents a directory, all files in that directory (recursively) will be parsed.
     *
     * @param path      a File object representing a file or directory
     */
    public void parse(File path) throws StructurizrDslParserException {
        if (path == null) {
            throw new RuntimeException("A file must be specified");
        }
        if (!path.exists()) {
            throw new RuntimeException("The file at " + path.getAbsolutePath() + " does not exist");
        }
        List<File> files = FileUtils.findFiles(path);
        try {
            for (File file : files) {
                parse(Files.readAllLines(file.toPath(), StandardCharsets.UTF_8), file);
            }
        } catch (IOException e) {
            throw new StructurizrDslParserException(e.getMessage());
        }
    }

    /**
     * Parses the specified Structurizr DSL fragment, adding the parsed content to the workspace.
     *
     * @param dsl       a DSL fragment
     */
    public void parse(String dsl) throws StructurizrDslParserException {
        if (StringUtils.isNullOrEmpty(dsl)) {
            throw new RuntimeException("A DSL fragment must be specified");
        }
        List<String> lines = Arrays.asList(dsl.split("\\r?\\n"));
        parse(lines, new File("."));
    }

    void parse(List<String> lines, File file) throws StructurizrDslParserException {
        int lineNumber = 1;
        for (String line : lines) {
            boolean includeInDslSourceLines = true;
            try {
                if (EMPTY_LINE_PATTERN.matcher(line).matches()) {
                // do nothing
                } else if (COMMENT_PATTERN.matcher(line).matches()) {
                // do nothing
                } else {
                    List<String> listOfTokens = new ArrayList<>();
                    Matcher m = TOKENS_PATTERN.matcher(line.trim());
                    while (m.find()) {
                        String token = null;
                        if (m.group(1) != null) {
                            // this is a token specified between double-quotes
                            token = m.group(1);
                        } else {
                            // this is a token specified without double-quotes
                            token = m.group(3);
                        }
                        if (token != null) {
                            token = subsreplaceduteStrings(token);
                            listOfTokens.add(token);
                        }
                    }
                    Tokens tokens = new Tokens(listOfTokens);
                    String identifier = null;
                    if (tokens.size() > 3 && replacedIGNMENT_OPERATOR_TOKEN.equals(tokens.get(1))) {
                        identifier = tokens.get(0).toLowerCase();
                        validateIdentifier(identifier);
                        tokens = new Tokens(listOfTokens.subList(2, listOfTokens.size()));
                    }
                    String firstToken = tokens.get(0);
                    if (line.trim().startsWith(MULTI_LINE_COMMENT_START_TOKEN) && line.trim().endsWith(MULTI_LINE_COMMENT_END_TOKEN)) {
                    // do nothing
                    } else if (firstToken.startsWith(MULTI_LINE_COMMENT_START_TOKEN)) {
                        startContext(new CommentDslContext());
                    } else if (inContext(CommentDslContext.clreplaced) && line.trim().endsWith(MULTI_LINE_COMMENT_END_TOKEN)) {
                        endContext();
                    } else if (inContext(CommentDslContext.clreplaced)) {
                    // do nothing
                    } else if (DslContext.CONTEXT_END_TOKEN.equals(tokens.get(0))) {
                        endContext();
                    } else if (tokens.size() > 2 && RELATIONSHIP_TOKEN.equals(tokens.get(1)) && (inContext(ModelDslContext.clreplaced) || inContext(EnterpriseDslContext.clreplaced) || inContext(CustomElementDslContext.clreplaced) || inContext(PersonDslContext.clreplaced) || inContext(SoftwareSystemDslContext.clreplaced) || inContext(ContainerDslContext.clreplaced) || inContext(ComponentDslContext.clreplaced) || inContext(DeploymentEnvironmentDslContext.clreplaced) || inContext(DeploymentNodeDslContext.clreplaced) || inContext(InfrastructureNodeDslContext.clreplaced) || inContext(SoftwareSystemInstanceDslContext.clreplaced) || inContext(ContainerInstanceDslContext.clreplaced))) {
                        Relationship relationship = new ExplicitRelationshipParser().parse(getContext(), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new RelationshipDslContext(relationship));
                        }
                        if (identifier != null) {
                            relationships.put(identifier, relationship);
                        }
                    } else if (tokens.size() >= 2 && RELATIONSHIP_TOKEN.equals(tokens.get(0)) && (inContext(CustomElementDslContext.clreplaced) || inContext(PersonDslContext.clreplaced) || inContext(SoftwareSystemDslContext.clreplaced) || inContext(ContainerDslContext.clreplaced) || inContext(ComponentDslContext.clreplaced) || inContext(DeploymentNodeDslContext.clreplaced) || inContext(InfrastructureNodeDslContext.clreplaced) || inContext(SoftwareSystemInstanceDslContext.clreplaced) || inContext(ContainerInstanceDslContext.clreplaced))) {
                        Relationship relationship = new ImplicitRelationshipParser().parse(getContext(ModelItemDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new RelationshipDslContext(relationship));
                        }
                        if (identifier != null) {
                            relationships.put(identifier, relationship);
                        }
                    } else if (CUSTOM_ELEMENT_TOKEN.equalsIgnoreCase(firstToken) && (inContext(ModelDslContext.clreplaced))) {
                        CustomElement customElement = new CustomElementParser().parse(getContext(GroupableDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new CustomElementDslContext(customElement));
                        }
                        if (identifier != null) {
                            elements.put(identifier, customElement);
                        }
                    } else if (PERSON_TOKEN.equalsIgnoreCase(firstToken) && (inContext(ModelDslContext.clreplaced) || inContext(EnterpriseDslContext.clreplaced))) {
                        Person person = new PersonParser().parse(getContext(GroupableDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new PersonDslContext(person));
                        }
                        if (identifier != null) {
                            elements.put(identifier, person);
                        }
                    } else if (SOFTWARE_SYSTEM_TOKEN.equalsIgnoreCase(firstToken) && (inContext(ModelDslContext.clreplaced) || inContext(EnterpriseDslContext.clreplaced))) {
                        SoftwareSystem softwareSystem = new SoftwareSystemParser().parse(getContext(GroupableDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new SoftwareSystemDslContext(softwareSystem));
                        }
                        if (identifier != null) {
                            elements.put(identifier, softwareSystem);
                        }
                    } else if (CONTAINER_TOKEN.equalsIgnoreCase(firstToken) && inContext(SoftwareSystemDslContext.clreplaced)) {
                        Container container = new ContainerParser().parse(getContext(SoftwareSystemDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new ContainerDslContext(container));
                        }
                        if (identifier != null) {
                            elements.put(identifier, container);
                        }
                    } else if (COMPONENT_TOKEN.equalsIgnoreCase(firstToken) && inContext(ContainerDslContext.clreplaced)) {
                        Component component = new ComponentParser().parse(getContext(ContainerDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new ComponentDslContext(component));
                        }
                        if (identifier != null) {
                            elements.put(identifier, component);
                        }
                    } else if (GROUP_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelDslContext.clreplaced) && !getContext(ModelDslContext.clreplaced).hasGroup()) {
                        String group = new GroupParser().parse(tokens.withoutContextStartToken());
                        startContext(new ModelDslContext(group));
                    } else if (GROUP_TOKEN.equalsIgnoreCase(firstToken) && inContext(EnterpriseDslContext.clreplaced) && !getContext(EnterpriseDslContext.clreplaced).hasGroup()) {
                        String group = new GroupParser().parse(tokens.withoutContextStartToken());
                        startContext(new EnterpriseDslContext(group));
                    } else if (GROUP_TOKEN.equalsIgnoreCase(firstToken) && inContext(SoftwareSystemDslContext.clreplaced) && !getContext(SoftwareSystemDslContext.clreplaced).hasGroup()) {
                        String group = new GroupParser().parse(tokens.withoutContextStartToken());
                        SoftwareSystem softwareSystem = getContext(SoftwareSystemDslContext.clreplaced).getSoftwareSystem();
                        startContext(new SoftwareSystemDslContext(softwareSystem, group));
                    } else if (GROUP_TOKEN.equalsIgnoreCase(firstToken) && inContext(ContainerDslContext.clreplaced) && !getContext(ContainerDslContext.clreplaced).hasGroup()) {
                        String group = new GroupParser().parse(tokens.withoutContextStartToken());
                        Container container = getContext(ContainerDslContext.clreplaced).getContainer();
                        startContext(new ContainerDslContext(container, group));
                    } else if (URL_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelItemDslContext.clreplaced)) {
                        new ModelItemParser().parseUrl(getContext(ModelItemDslContext.clreplaced), tokens);
                    } else if (PROPERTIES_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelItemDslContext.clreplaced)) {
                        startContext(new ModelItemPropertiesDslContext(getContext(ModelItemDslContext.clreplaced).getModelItem()));
                    } else if (inContext(ModelItemPropertiesDslContext.clreplaced)) {
                        new ModelItemParser().parseProperty(getContext(ModelItemPropertiesDslContext.clreplaced), tokens);
                    } else if (PERSPECTIVES_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelItemDslContext.clreplaced)) {
                        startContext(new ModelItemPerspectivesDslContext(getContext(ModelItemDslContext.clreplaced).getModelItem()));
                    } else if (inContext(ModelItemPerspectivesDslContext.clreplaced)) {
                        new ModelItemParser().parsePerspective(getContext(ModelItemPerspectivesDslContext.clreplaced), tokens);
                    } else if (WORKSPACE_TOKEN.equalsIgnoreCase(firstToken) && contextStack.empty()) {
                        new WorkspaceParser().parse(workspace, tokens.withoutContextStartToken());
                        startContext(new WorkspaceDslContext());
                    } else if (IMPLIED_RELATIONSHIPS_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelDslContext.clreplaced)) {
                        new ImpliedRelationshipsParser().parse(getContext(), tokens);
                    } else if (MODEL_TOKEN.equalsIgnoreCase(firstToken) && inContext(WorkspaceDslContext.clreplaced)) {
                        startContext(new ModelDslContext());
                    } else if (VIEWS_TOKEN.equalsIgnoreCase(firstToken) && inContext(WorkspaceDslContext.clreplaced)) {
                        startContext(new ViewsDslContext());
                    } else if (BRANDING_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        startContext(new BrandingDslContext(file));
                    } else if (BRANDING_LOGO_TOKEN.equalsIgnoreCase(firstToken) && inContext(BrandingDslContext.clreplaced)) {
                        if (!restricted) {
                            new BrandingParser().parseLogo(getContext(BrandingDslContext.clreplaced), tokens);
                        }
                    } else if (BRANDING_FONT_TOKEN.equalsIgnoreCase(firstToken) && inContext(BrandingDslContext.clreplaced)) {
                        new BrandingParser().parseFont(getContext(BrandingDslContext.clreplaced), tokens);
                    } else if (STYLES_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        startContext(new StylesDslContext());
                    } else if (ELEMENT_STYLE_TOKEN.equalsIgnoreCase(firstToken) && inContext(StylesDslContext.clreplaced)) {
                        ElementStyle elementStyle = new ElementStyleParser().parseElementStyle(getContext(), tokens.withoutContextStartToken());
                        startContext(new ElementStyleDslContext(elementStyle, file));
                    } else if (ELEMENT_STYLE_BACKGROUND_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseBackground(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if ((ELEMENT_STYLE_COLOUR_TOKEN.equalsIgnoreCase(firstToken) || ELEMENT_STYLE_COLOR_TOKEN.equalsIgnoreCase(firstToken)) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseColour(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_STROKE_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseStroke(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_SHAPE_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseShape(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_BORDER_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseBorder(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_OPACITY_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseOpacity(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_WIDTH_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseWidth(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_HEIGHT_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseHeight(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_FONT_SIZE_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseFontSize(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_METADATA_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseMetadata(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_DESCRIPTION_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        new ElementStyleParser().parseDescription(getContext(ElementStyleDslContext.clreplaced), tokens);
                    } else if (ELEMENT_STYLE_ICON_TOKEN.equalsIgnoreCase(firstToken) && inContext(ElementStyleDslContext.clreplaced)) {
                        if (!restricted) {
                            new ElementStyleParser().parseIcon(getContext(ElementStyleDslContext.clreplaced), tokens);
                        }
                    } else if (RELATIONSHIP_STYLE_TOKEN.equalsIgnoreCase(firstToken) && inContext(StylesDslContext.clreplaced)) {
                        RelationshipStyle relationshipStyle = new RelationshipStyleParser().parseRelationshipStyle(getContext(), tokens.withoutContextStartToken());
                        startContext(new RelationshipStyleDslContext(relationshipStyle));
                    } else if (RELATIONSHIP_STYLE_THICKNESS_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseThickness(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if ((RELATIONSHIP_STYLE_COLOUR_TOKEN.equalsIgnoreCase(firstToken) || RELATIONSHIP_STYLE_COLOR_TOKEN.equalsIgnoreCase(firstToken)) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseColour(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (RELATIONSHIP_STYLE_DASHED_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseDashed(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (RELATIONSHIP_STYLE_OPACITY_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseOpacity(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (RELATIONSHIP_STYLE_WIDTH_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseWidth(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (RELATIONSHIP_STYLE_FONT_SIZE_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseFontSize(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (RELATIONSHIP_STYLE_POSITION_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parsePosition(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (RELATIONSHIP_STYLE_ROUTING_TOKEN.equalsIgnoreCase(firstToken) && inContext(RelationshipStyleDslContext.clreplaced)) {
                        new RelationshipStyleParser().parseRouting(getContext(RelationshipStyleDslContext.clreplaced), tokens);
                    } else if (ENTERPRISE_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelDslContext.clreplaced)) {
                        new EnterpriseParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new EnterpriseDslContext());
                    } else if (DEPLOYMENT_ENVIRONMENT_TOKEN.equalsIgnoreCase(firstToken) && inContext(ModelDslContext.clreplaced)) {
                        String environment = new DeploymentEnvironmentParser().parse(tokens.withoutContextStartToken());
                        startContext(new DeploymentEnvironmentDslContext(environment));
                        if (identifier != null) {
                            DeploymentEnvironment deploymentEnvironment = new DeploymentEnvironment(environment);
                            elements.put(identifier, deploymentEnvironment);
                        }
                    } else if (DEPLOYMENT_NODE_TOKEN.equalsIgnoreCase(firstToken) && (inContext(DeploymentEnvironmentDslContext.clreplaced) || inContext(DeploymentNodeDslContext.clreplaced))) {
                        DeploymentNode deploymentNode = new DeploymentNodeParser().parse(getContext(), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new DeploymentNodeDslContext(deploymentNode));
                        }
                        if (identifier != null) {
                            elements.put(identifier, deploymentNode);
                        }
                    } else if (INFRASTRUCTURE_NODE_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentNodeDslContext.clreplaced)) {
                        InfrastructureNode infrastructureNode = new InfrastructureNodeParser().parse(getContext(DeploymentNodeDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new InfrastructureNodeDslContext(infrastructureNode));
                        }
                        if (identifier != null) {
                            elements.put(identifier, infrastructureNode);
                        }
                    } else if (SOFTWARE_SYSTEM_INSTANCE_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentNodeDslContext.clreplaced)) {
                        SoftwareSystemInstance softwareSystemInstance = new SoftwareSystemInstanceParser().parse(getContext(DeploymentNodeDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new SoftwareSystemInstanceDslContext(softwareSystemInstance));
                        }
                        if (identifier != null) {
                            elements.put(identifier, softwareSystemInstance);
                        }
                    } else if (CONTAINER_INSTANCE_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentNodeDslContext.clreplaced)) {
                        ContainerInstance containerInstance = new ContainerInstanceParser().parse(getContext(DeploymentNodeDslContext.clreplaced), tokens.withoutContextStartToken());
                        if (shouldStartContext(tokens)) {
                            startContext(new ContainerInstanceDslContext(containerInstance));
                        }
                        if (identifier != null) {
                            elements.put(identifier, containerInstance);
                        }
                    } else if (HEALTH_CHECK_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticStructureElementInstanceDslContext.clreplaced)) {
                        new HealthCheckParser().parse(getContext(StaticStructureElementInstanceDslContext.clreplaced), tokens.withoutContextStartToken());
                    } else if (CUSTOM_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        CustomView view = new CustomViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new CustomViewDslContext(view));
                    } else if (SYSTEM_LANDSCAPE_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        SystemLandscapeView view = new SystemLandscapeViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new SystemLandscapeViewDslContext(view));
                    } else if (SYSTEM_CONTEXT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        SystemContextView view = new SystemContextViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new SystemContextViewDslContext(view));
                    } else if (CONTAINER_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        ContainerView view = new ContainerViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new ContainerViewDslContext(view));
                    } else if (COMPONENT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        ComponentView view = new ComponentViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new ComponentViewDslContext(view));
                    } else if (DYNAMIC_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        DynamicView view = new DynamicViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new DynamicViewDslContext(view));
                    } else if (DEPLOYMENT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        DeploymentView view = new DeploymentViewParser().parse(getContext(), tokens.withoutContextStartToken());
                        startContext(new DeploymentViewDslContext(view));
                    } else if (FILTERED_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        new FilteredViewParser().parse(getContext(), tokens);
                    } else if (tokens.size() > 2 && RELATIONSHIP_TOKEN.equals(tokens.get(1)) && inContext(DynamicViewDslContext.clreplaced)) {
                        new DynamicViewContentParser().parseRelationship(getContext(DynamicViewDslContext.clreplaced), tokens);
                    } else if (INCLUDE_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(CustomViewDslContext.clreplaced)) {
                        new CustomViewContentParser().parseInclude(getContext(CustomViewDslContext.clreplaced), tokens);
                    } else if (EXCLUDE_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(CustomViewDslContext.clreplaced)) {
                        new CustomViewContentParser().parseExclude(getContext(CustomViewDslContext.clreplaced), tokens);
                    } else if (ANIMATION_STEP_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(CustomViewDslContext.clreplaced)) {
                        new CustomViewAnimationStepParser().parse(getContext(CustomViewDslContext.clreplaced), tokens);
                    } else if (ANIMATION_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(CustomViewDslContext.clreplaced)) {
                        startContext(new CustomViewAnimationDslContext(getContext(CustomViewDslContext.clreplaced).getCustomView()));
                    } else if (inContext(CustomViewAnimationDslContext.clreplaced)) {
                        new CustomViewAnimationStepParser().parse(getContext(CustomViewAnimationDslContext.clreplaced), tokens);
                    } else if (AUTOLAYOUT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(CustomViewDslContext.clreplaced)) {
                        new AutoLayoutParser().parse(getContext(CustomViewDslContext.clreplaced), tokens);
                    } else if (INCLUDE_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticViewDslContext.clreplaced)) {
                        new StaticViewContentParser().parseInclude(getContext(StaticViewDslContext.clreplaced), tokens);
                    } else if (EXCLUDE_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticViewDslContext.clreplaced)) {
                        new StaticViewContentParser().parseExclude(getContext(StaticViewDslContext.clreplaced), tokens);
                    } else if (ANIMATION_STEP_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticViewDslContext.clreplaced)) {
                        new StaticViewAnimationStepParser().parse(getContext(StaticViewDslContext.clreplaced), tokens);
                    } else if (ANIMATION_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticViewDslContext.clreplaced)) {
                        startContext(new StaticViewAnimationDslContext(getContext(StaticViewDslContext.clreplaced).getView()));
                    } else if (inContext(StaticViewAnimationDslContext.clreplaced)) {
                        new StaticViewAnimationStepParser().parse(getContext(StaticViewAnimationDslContext.clreplaced), tokens);
                    } else if (INCLUDE_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentViewDslContext.clreplaced)) {
                        new DeploymentViewContentParser().parseInclude(getContext(DeploymentViewDslContext.clreplaced), tokens);
                    } else if (EXCLUDE_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentViewDslContext.clreplaced)) {
                        new DeploymentViewContentParser().parseExclude(getContext(DeploymentViewDslContext.clreplaced), tokens);
                    } else if (ANIMATION_STEP_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentViewDslContext.clreplaced)) {
                        new DeploymentViewAnimationStepParser().parse(getContext(DeploymentViewDslContext.clreplaced), tokens);
                    } else if (ANIMATION_IN_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentViewDslContext.clreplaced)) {
                        startContext(new DeploymentViewAnimationDslContext(getContext(DeploymentViewDslContext.clreplaced).getView()));
                    } else if (inContext(DeploymentViewAnimationDslContext.clreplaced)) {
                        new DeploymentViewAnimationStepParser().parse(getContext(DeploymentViewAnimationDslContext.clreplaced), tokens);
                    } else if (AUTOLAYOUT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticViewDslContext.clreplaced)) {
                        new AutoLayoutParser().parse(getContext(StaticViewDslContext.clreplaced), tokens);
                    } else if (AUTOLAYOUT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(DynamicViewDslContext.clreplaced)) {
                        new AutoLayoutParser().parse(getContext(DynamicViewDslContext.clreplaced), tokens);
                    } else if (AUTOLAYOUT_VIEW_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentViewDslContext.clreplaced)) {
                        new AutoLayoutParser().parse(getContext(DeploymentViewDslContext.clreplaced), tokens);
                    } else if (VIEW_replacedLE_TOKEN.equalsIgnoreCase(firstToken) && inContext(StaticViewDslContext.clreplaced)) {
                        new ViewParser().parsereplacedle(getContext(StaticViewDslContext.clreplaced), tokens);
                    } else if (VIEW_replacedLE_TOKEN.equalsIgnoreCase(firstToken) && inContext(DynamicViewDslContext.clreplaced)) {
                        new ViewParser().parsereplacedle(getContext(DynamicViewDslContext.clreplaced), tokens);
                    } else if (VIEW_replacedLE_TOKEN.equalsIgnoreCase(firstToken) && inContext(DeploymentViewDslContext.clreplaced)) {
                        new ViewParser().parsereplacedle(getContext(DeploymentViewDslContext.clreplaced), tokens);
                    } else if (THEMES_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        new ThemesParser().parse(getContext(), tokens);
                    } else if (TERMINOLOGY_TOKEN.equalsIgnoreCase(firstToken) && inContext(ViewsDslContext.clreplaced)) {
                        startContext(new TerminologyDslContext());
                    } else if (ENTERPRISE_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseEnterprise(getContext(), tokens);
                    } else if (PERSON_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parsePerson(getContext(), tokens);
                    } else if (SOFTWARE_SYSTEM_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseSoftwareSystem(getContext(), tokens);
                    } else if (CONTAINER_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseContainer(getContext(), tokens);
                    } else if (COMPONENT_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseComponent(getContext(), tokens);
                    } else if (DEPLOYMENT_NODE_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseDeploymentNode(getContext(), tokens);
                    } else if (INFRASTRUCTURE_NODE_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseInfrastructureNode(getContext(), tokens);
                    } else if (TERMINOLOGY_RELATIONSHIP_TOKEN.equalsIgnoreCase(firstToken) && inContext(TerminologyDslContext.clreplaced)) {
                        new TerminologyParser().parseRelationship(getContext(), tokens);
                    } else if (CONFIGURATION_TOKEN.equalsIgnoreCase(firstToken) && inContext(WorkspaceDslContext.clreplaced)) {
                        startContext(new ConfigurationDslContext());
                    } else if (USERS_TOKEN.equalsIgnoreCase(firstToken) && inContext(ConfigurationDslContext.clreplaced)) {
                        startContext(new UsersDslContext());
                    } else if (inContext(UsersDslContext.clreplaced)) {
                        new UserRoleParser().parse(getContext(), tokens);
                    } else if (INCLUDE_FILE_TOKEN.equalsIgnoreCase(firstToken)) {
                        if (!restricted) {
                            IncludedDslContext context = new IncludedDslContext(file);
                            new IncludeParser().parse(context, tokens);
                            parse(context.getLines(), context.getFile());
                            includeInDslSourceLines = false;
                        }
                    } else if (DOCS_TOKEN.equalsIgnoreCase(firstToken) && inContext(WorkspaceDslContext.clreplaced)) {
                        if (!restricted) {
                            new DocsParser().parse(getContext(WorkspaceDslContext.clreplaced), file, tokens);
                        }
                    } else if (DOCS_TOKEN.equalsIgnoreCase(firstToken) && inContext(SoftwareSystemDslContext.clreplaced)) {
                        if (!restricted) {
                            new DocsParser().parse(getContext(SoftwareSystemDslContext.clreplaced), file, tokens);
                        }
                    } else if (ADRS_TOKEN.equalsIgnoreCase(firstToken) && inContext(WorkspaceDslContext.clreplaced)) {
                        if (!restricted) {
                            new AdrsParser().parse(getContext(WorkspaceDslContext.clreplaced), file, tokens);
                        }
                    } else if (ADRS_TOKEN.equalsIgnoreCase(firstToken) && inContext(SoftwareSystemDslContext.clreplaced)) {
                        if (!restricted) {
                            new AdrsParser().parse(getContext(SoftwareSystemDslContext.clreplaced), file, tokens);
                        }
                    } else if (CONSTANT_TOKEN.equalsIgnoreCase(firstToken)) {
                        Constant constant = new ConstantParser().parse(getContext(), tokens);
                        constants.put(constant.getName(), constant);
                    } else {
                        throw new StructurizrDslParserException("Unexpected tokens");
                    }
                }
                if (includeInDslSourceLines) {
                    dslSourceLines.add(line);
                }
                lineNumber++;
            } catch (Exception e) {
                throw new StructurizrDslParserException(e.getMessage(), lineNumber, line);
            }
        }
    }

    private String subsreplaceduteStrings(String token) {
        Matcher m = STRING_SUBSreplacedUTION_PATTERN.matcher(token);
        while (m.find()) {
            String before = m.group(0);
            String after = null;
            String name = before.substring(2, before.length() - 1);
            if (constants.containsKey(name)) {
                after = constants.get(name).getValue();
            } else {
                if (!restricted) {
                    String environmentVariable = System.getenv().get(name);
                    if (environmentVariable != null) {
                        after = environmentVariable;
                    }
                }
            }
            if (after != null) {
                token = token.replace(before, after);
            }
        }
        return token;
    }

    private boolean shouldStartContext(Tokens tokens) {
        return DslContext.CONTEXT_START_TOKEN.equalsIgnoreCase(tokens.get(tokens.size() - 1));
    }

    private void startContext(DslContext context) {
        context.setWorkspace(workspace);
        context.setElements(elements);
        context.setRelationships(relationships);
        contextStack.push(context);
    }

    private DslContext getContext() {
        if (!contextStack.empty()) {
            return contextStack.peek();
        } else {
            return null;
        }
    }

    private <T> T getContext(Clreplaced<T> clazz) {
        if (inContext(clazz)) {
            return (T) contextStack.peek();
        } else {
            throw new RuntimeException("Expected " + clazz.getName() + " but got " + contextStack.peek().getClreplaced().getName());
        }
    }

    private void endContext() {
        if (!contextStack.empty()) {
            DslContext context = contextStack.pop();
            context.end();
        } else {
            throw new RuntimeException("Unexpected end of context");
        }
    }

    private void validateIdentifier(String identifier) {
        if (elements.containsKey(identifier) || relationships.containsKey(identifier)) {
            throw new RuntimeException("The identifier \"" + identifier + "\" is already in use");
        }
        if (!IDENTIFIER_PATTERN.matcher(identifier).matches()) {
            throw new RuntimeException("Identifiers can only contain the following characters: a-zA-Z_0-9");
        }
    }

    private boolean inContext(Clreplaced clazz) {
        if (contextStack.empty()) {
            return false;
        }
        return clazz.isreplacedignableFrom(contextStack.peek().getClreplaced());
    }
}

18 Source : RelationshipStyleParser.java
with Apache License 2.0
from structurizr

RelationshipStyle parseRelationshipStyle(DslContext context, Tokens tokens) {
    if (tokens.includes(FIRST_PROPERTY_INDEX)) {
        String tag = tokens.get(1);
        if (StringUtils.isNullOrEmpty(tag)) {
            throw new RuntimeException("A tag must be specified");
        }
        Workspace workspace = context.getWorkspace();
        return workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(tag);
    } else {
        throw new RuntimeException("Expected: relationship <tag> {");
    }
}

18 Source : EnterpriseParser.java
with Apache License 2.0
from structurizr

void parse(DslContext context, Tokens tokens) {
    Workspace workspace = context.getWorkspace();
    if (tokens.includes(NAME_INDEX)) {
        workspace.getModel().setEnterprise(new Enterprise(tokens.get(1)));
    } else {
        throw new RuntimeException("Expected: enterprise <name>");
    }
}

18 Source : ElementStyleParser.java
with Apache License 2.0
from structurizr

ElementStyle parseElementStyle(DslContext context, Tokens tokens) {
    if (tokens.includes(FIRST_PROPERTY_INDEX)) {
        String tag = tokens.get(1);
        if (StringUtils.isNullOrEmpty(tag)) {
            throw new RuntimeException("A tag must be specified");
        }
        Workspace workspace = context.getWorkspace();
        return workspace.getViews().getConfiguration().getStyles().addElementStyle(tag);
    } else {
        throw new RuntimeException("Expected: element <tag> {");
    }
}

18 Source : DslUtils.java
with Apache License 2.0
from structurizr

public static String getDsl(Workspace workspace) {
    String base64 = workspace.getProperties().get(STRUCTURIZR_DSL_PROPERTY_NAME);
    String dsl = "";
    if (!StringUtils.isNullOrEmpty(base64)) {
        dsl = new String(Base64.getDecoder().decode(base64));
    }
    return dsl;
}

18 Source : DslUtils.java
with Apache License 2.0
from structurizr

static void setDsl(Workspace workspace, String dsl) {
    String base64 = "";
    if (!StringUtils.isNullOrEmpty(dsl)) {
        base64 = Base64.getEncoder().encodeToString(dsl.getBytes(StandardCharsets.UTF_8));
    }
    workspace.addProperty(STRUCTURIZR_DSL_PROPERTY_NAME, base64);
}

18 Source : DslContext.java
with Apache License 2.0
from structurizr

abstract clreplaced DslContext {

    static final String CONTEXT_START_TOKEN = "{";

    static final String CONTEXT_END_TOKEN = "}";

    private Workspace workspace;

    private Map<String, Element> elements = new HashMap<>();

    private Map<String, Relationship> relationships = new HashMap<>();

    Workspace getWorkspace() {
        return workspace;
    }

    void setWorkspace(Workspace workspace) {
        this.workspace = workspace;
    }

    Element getElement(String identifier) {
        return elements.get(identifier.toLowerCase());
    }

    void setElements(Map<String, Element> elements) {
        this.elements = elements;
    }

    Relationship getRelationship(String identifier) {
        return relationships.get(identifier.toLowerCase());
    }

    void setRelationships(Map<String, Relationship> relationships) {
        this.relationships = relationships;
    }

    void end() {
    }
}

18 Source : ViewCreator.java
with Apache License 2.0
from jakubnabrdalik

static Workspace setupView(Workspace workspace, Function<ViewSet, StaticView> viewGenerator, PaperSize paperSize) {
    ViewSet views = workspace.getViews();
    StaticView contextView = viewGenerator.apply(views);
    contextView.setPaperSize(paperSize);
    contextView.addAllElements();
    setupStyles(views);
    return workspace;
}

18 Source : CarShareContextDiagram.java
with Apache License 2.0
from jakubnabrdalik

static ExternalSystems create(Workspace workspace, Model model, SoftwareSystem carShare) {
    ExternalSystems externalSystems = new ExternalSystems(model);
    externalSystems.createUsages(carShare);
    setupContextView(workspace, carShare);
    return externalSystems;
}

18 Source : CarShareContainersDiagram.java
with Apache License 2.0
from jakubnabrdalik

static InternalContainers create(Workspace workspace, SoftwareSystem carShareSystem, ExternalSystems externalSystems) {
    InternalContainers internalContainers = new InternalContainers(carShareSystem);
    internalContainers.createUsages(externalSystems);
    setupContainerView(workspace, carShareSystem);
    return internalContainers;
}

17 Source : C4PathTest.java
with Apache License 2.0
from trilogy-group

public clreplaced C4PathTest {

    @Rule
    public final ErrorCollector collector = new ErrorCollector();

    private Workspace workspace;

    @Before
    public void setUp() {
        workspace = new Workspace("foo", "blah");
    }

    @Test
    public void shouldBuildPathForSystem() {
        final var element = buildSoftwareSystem("system");
        final var path = buildPath(element);
        collector.checkThat(path.type(), equalTo(C4Type.SYSTEM));
        collector.checkThat(path.name(), equalTo("system"));
        collector.checkThat(path.getPath(), equalTo("c4://system"));
    }

    @Test
    public void shouldBuildPathForPerson() {
        final var element = buildPerson("person");
        final var path = buildPath(element);
        collector.checkThat(path.type(), equalTo(C4Type.PERSON));
        collector.checkThat(path.name(), equalTo("person"));
        collector.checkThat(path.getPath(), equalTo("@person"));
    }

    @Test
    public void shouldBuildPathForContainer() {
        final var container = buildContainer("container");
        final var path = buildPath(container);
        collector.checkThat(path.type(), equalTo(C4Type.CONTAINER));
        collector.checkThat(path.name(), equalTo("container"));
        collector.checkThat(path.getPath(), equalTo("c4://system/container"));
    }

    @Test
    public void shouldBuildPathForComponent() {
        final var component = buildComponent("component");
        final var path = buildPath(component);
        collector.checkThat(path.type(), equalTo(C4Type.COMPONENT));
        collector.checkThat(path.name(), equalTo("component"));
        collector.checkThat(path.getPath(), equalTo("c4://system/container/component"));
    }

    @Test
    public void shouldBuildPathForEnreplacediesWithSlash() {
        final var personPath = buildPath(buildPerson("person/1"));
        final var system = buildSoftwareSystem("system/1");
        final var systemPath = buildPath(system);
        final var container = buildContainer("container/2/system/1", system);
        final var containerPath = buildPath(container);
        final var componentPath = buildPath(buildComponent("component/3/container/2/system/1", container));
        collector.checkThat(personPath.type(), equalTo(C4Type.PERSON));
        collector.checkThat(personPath.name(), equalTo("person/1"));
        collector.checkThat(personPath.getPath(), equalTo("@person\\/1"));
        collector.checkThat(systemPath.type(), equalTo(C4Type.SYSTEM));
        collector.checkThat(systemPath.name(), equalTo("system/1"));
        collector.checkThat(systemPath.getPath(), equalTo("c4://system\\/1"));
        collector.checkThat(containerPath.type(), equalTo(C4Type.CONTAINER));
        collector.checkThat(containerPath.name(), equalTo("container/2/system/1"));
        collector.checkThat(containerPath.getPath(), equalTo("c4://system\\/1/container\\/2\\/system\\/1"));
        collector.checkThat(componentPath.type(), equalTo(C4Type.COMPONENT));
        collector.checkThat(componentPath.name(), equalTo("component/3/container/2/system/1"));
        collector.checkThat(componentPath.getPath(), equalTo("c4://system\\/1/container\\/2\\/system\\/1/component\\/3\\/container\\/2\\/system\\/1"));
    }

    @Test
    public void shouldBuildPathForEnreplacediesWithDot() {
        final var personPath = buildPath(buildPerson("person.1"));
        final var systemPath = buildPath(buildSoftwareSystem("system.1"));
        final var containerPath = buildPath(buildContainer("container.1"));
        final var componentPath = buildPath(buildComponent("component.1"));
        collector.checkThat(personPath.type(), equalTo(C4Type.PERSON));
        collector.checkThat(personPath.name(), equalTo("person.1"));
        collector.checkThat(personPath.getPath(), equalTo("@person.1"));
        collector.checkThat(systemPath.type(), equalTo(C4Type.SYSTEM));
        collector.checkThat(systemPath.name(), equalTo("system.1"));
        collector.checkThat(systemPath.getPath(), equalTo("c4://system.1"));
        collector.checkThat(containerPath.type(), equalTo(C4Type.CONTAINER));
        collector.checkThat(containerPath.name(), equalTo("container.1"));
        collector.checkThat(containerPath.getPath(), equalTo("c4://system/container.1"));
        collector.checkThat(componentPath.type(), equalTo(C4Type.COMPONENT));
        collector.checkThat(componentPath.name(), equalTo("component.1"));
        collector.checkThat(componentPath.getPath(), equalTo("c4://system/container/component.1"));
    }

    @Test
    public void shouldBuildPathForEnreplacediesWithSpaces() {
        final var personPath = buildPath(buildPerson("person 1"));
        final var systemPath = buildPath(buildSoftwareSystem("system 1"));
        final var containerPath = buildPath(buildContainer("container 1"));
        final var componentPath = buildPath(buildComponent("component 1"));
        collector.checkThat(personPath.type(), equalTo(C4Type.PERSON));
        collector.checkThat(personPath.name(), equalTo("person 1"));
        collector.checkThat(personPath.getPath(), equalTo("@person 1"));
        collector.checkThat(systemPath.type(), equalTo(C4Type.SYSTEM));
        collector.checkThat(systemPath.name(), equalTo("system 1"));
        collector.checkThat(systemPath.getPath(), equalTo("c4://system 1"));
        collector.checkThat(containerPath.type(), equalTo(C4Type.CONTAINER));
        collector.checkThat(containerPath.name(), equalTo("container 1"));
        collector.checkThat(containerPath.getPath(), equalTo("c4://system/container 1"));
        collector.checkThat(componentPath.type(), equalTo(C4Type.COMPONENT));
        collector.checkThat(componentPath.name(), equalTo("component 1"));
        collector.checkThat(componentPath.getPath(), equalTo("c4://system/container/component 1"));
    }

    @Test
    public void shouldParsePathForPerson() {
        final var path = path("@person");
        collector.checkThat(path.name(), equalTo("person"));
        collector.checkThat(path.personName(), equalTo("person"));
        collector.checkThat(path.type(), equalTo(C4Type.PERSON));
        collector.checkThat(path.getPath(), equalTo("@person"));
    }

    @Test
    public void shouldParsePathForSystem() {
        final var path = path("c4://System");
        collector.checkThat(path.name(), equalTo("System"));
        collector.checkThat(path.systemName(), equalTo("System"));
        collector.checkThat(path.type(), equalTo(C4Type.SYSTEM));
        collector.checkThat(path.getPath(), equalTo("c4://System"));
    }

    @Test
    public void shouldParsePathForContainer() {
        final var path = path("c4://DevSpaces/DevSpaces API");
        collector.checkThat(path.name(), equalTo("DevSpaces API"));
        collector.checkThat(path.systemName(), equalTo("DevSpaces"));
        collector.checkThat(path.containerName(), equalTo(Optional.of("DevSpaces API")));
        collector.checkThat(path.type(), equalTo(C4Type.CONTAINER));
        collector.checkThat(path.getPath(), equalTo("c4://DevSpaces/DevSpaces API"));
    }

    @Test
    public void shouldParsePathForComponent() {
        final var path = path("c4://DevSpaces/DevSpaces API/Sign-In Component");
        collector.checkThat(path.name(), equalTo("Sign-In Component"));
        collector.checkThat(path.systemName(), equalTo("DevSpaces"));
        collector.checkThat(path.containerName(), equalTo(Optional.of("DevSpaces API")));
        collector.checkThat(path.componentName(), equalTo(Optional.of("Sign-In Component")));
        collector.checkThat(path.type(), equalTo(C4Type.COMPONENT));
        collector.checkThat(path.getPath(), equalTo("c4://DevSpaces/DevSpaces API/Sign-In Component"));
    }

    @Test
    public void shouldParseEnreplacediesWithSlashInPath() {
        final var personPath = path("@person\\/1");
        final var systemPath = path("c4://system\\/1");
        final var containerPath = path("c4://system\\/1/container\\/2\\/system\\/1");
        final var componentPath = path("c4://system\\/1/container\\/2\\/system\\/1/component\\/3\\/container\\/2\\/system\\/1");
        collector.checkThat(personPath.name(), equalTo("person/1"));
        collector.checkThat(personPath.type(), equalTo(C4Type.PERSON));
        collector.checkThat(personPath.personName(), equalTo("person/1"));
        collector.checkThat(systemPath.name(), equalTo("system/1"));
        collector.checkThat(systemPath.type(), equalTo(C4Type.SYSTEM));
        collector.checkThat(systemPath.systemName(), equalTo("system/1"));
        collector.checkThat(containerPath.name(), equalTo("container/2/system/1"));
        collector.checkThat(containerPath.type(), equalTo(C4Type.CONTAINER));
        collector.checkThat(containerPath.containerName(), equalTo(Optional.of("container/2/system/1")));
        collector.checkThat(componentPath.name(), equalTo("component/3/container/2/system/1"));
        collector.checkThat(componentPath.type(), equalTo(C4Type.COMPONENT));
        collector.checkThat(componentPath.componentName(), equalTo(Optional.of("component/3/container/2/system/1")));
    }

    @Test
    public void shouldBeAbleToExtractSubPathsInSystemPath() {
        final var path = path("c4://sys1");
        collector.checkThat(path.systemPath(), equalTo(path));
    }

    @Test
    public void shouldBeAbleToExtractSubPathsInPersonPath() {
        final var path = path("@person");
        collector.checkThat(path.personPath(), equalTo(path));
    }

    @Test
    public void shouldBeAbleToExtractSubPathsInContainerPath() {
        final var path = path("c4://system\\/1/container\\/2\\/system\\/1");
        collector.checkThat(path.systemPath(), equalTo(path("c4://system\\/1")));
        collector.checkThat(path.containerPath(), equalTo(path));
    }

    @Test
    public void shouldBeAbleToExtractSubPathsInComponentPath() {
        final var path = path("c4://system\\/1/container\\/2\\/system\\/1/component\\/3\\/container\\/2\\/system\\/1");
        collector.checkThat(path.systemPath(), equalTo(path("c4://system\\/1")));
        collector.checkThat(path.containerPath(), equalTo(path("c4://system\\/1/container\\/2\\/system\\/1")));
        collector.checkThat(path.componentPath(), equalTo(path));
    }

    @Test
    public void shouldBuildPathFromValidPaths() {
        collector.checkThat(path("@Person"), notNullValue());
        collector.checkThat(path("c4://system1"), notNullValue());
        collector.checkThat(path("c4://system1/container1"), notNullValue());
        collector.checkThat(path("c4://system1/container1/component1"), notNullValue());
    }

    @Test(expected = IllegalArgumentException.clreplaced)
    public void shouldFailToBuildPathIfPrefixIsInvalid() {
        collector.checkThat(path("{@Person"), notNullValue());
    }

    @Test(expected = IllegalArgumentException.clreplaced)
    public void missingPersonThrowsException() {
        path("@");
    }

    @Test(expected = IllegalArgumentException.clreplaced)
    public void buildingPersonPathWithOnlySlashThrowsException() {
        path("@\\/");
    }

    @Test(expected = IllegalArgumentException.clreplaced)
    public void buildingSystemPathWithOnlySlashThrowsException() {
        path("c4://\\/");
    }

    @Test(expected = IllegalArgumentException.clreplaced)
    public void missingSystemThrowsException() {
        path("c4://");
    }

    @Test(expected = IllegalStateException.clreplaced)
    public void accessingSystemPathOnNonSystemThrowsException() {
        final var path = path("@person");
        path.systemPath();
    }

    @Test(expected = IllegalStateException.clreplaced)
    public void accessingContainerPathOnNonContainerThrowsException() {
        final var path = path("@person");
        path.containerPath();
    }

    @Test(expected = IllegalStateException.clreplaced)
    public void accessingComponentPathOnNonComponentThrowsException() {
        final var path = path("@person");
        path.componentPath();
    }

    @Test(expected = IllegalStateException.clreplaced)
    public void accessingPersonPathOnNonPersonThrowsException() {
        final var path = path("c4://sys1");
        path.personPath();
    }

    @Test(expected = IllegalStateException.clreplaced)
    public void accessingComponentPathOnPathWithNoComponentThrowsException() {
        final var path = path("c4://sys1/container1");
        path.componentPath();
    }

    private Component buildComponent(String componentName) {
        return buildComponent(componentName, null);
    }

    private Component buildComponent(String componentName, Container container) {
        if (container == null)
            container = buildContainer("container");
        return container.addComponent(componentName, "bar");
    }

    private Container buildContainer(String containerName) {
        return buildContainer(containerName, null);
    }

    private Container buildContainer(String containerName, SoftwareSystem softwareSystem) {
        if (softwareSystem == null) {
            softwareSystem = workspace.getModel().getSoftwareSystemWithName("system");
            if (softwareSystem == null) {
                softwareSystem = buildSoftwareSystem("system");
            }
        }
        return softwareSystem.addContainer(containerName, "bar", "baz");
    }

    private SoftwareSystem buildSoftwareSystem(String systemName) {
        return workspace.getModel().addSoftwareSystem(systemName, "bar");
    }

    private Person buildPerson(String personName) {
        return workspace.getModel().addPerson(personName, "bar");
    }
}

17 Source : StructurizrViewsMapperTest.java
with Apache License 2.0
from trilogy-group

@Test
public void shouldFailToLoadViewsWhenViewFileIsMalformed() {
    File folderWithMalformed = new File(getClreplaced().getResource("/views/malformed").getPath());
    Workspace workspace = new Workspace("some name", "some description");
    StructurizrViewsMapper viewsMapper = new StructurizrViewsMapper(folderWithMalformed);
    replacedertThrows("Failed to load Structurizr views", RuntimeException.clreplaced, () -> viewsMapper.loadAndSetViews(workspace));
}

17 Source : StructurizrViewsMapperTest.java
with Apache License 2.0
from trilogy-group

@Test
public void shouldFailToLoadViewsWhenViewFileIsNotFound() {
    File folderWithNoViews = new File(getClreplaced().getResource("/images").getPath());
    Workspace workspace = new Workspace("some name", "some description");
    StructurizrViewsMapper viewsMapper = new StructurizrViewsMapper(folderWithNoViews);
    replacedertThrows("Failed to load Structurizr views", RuntimeException.clreplaced, () -> viewsMapper.loadAndSetViews(workspace));
}

17 Source : StructurizrAdapterTest.java
with Apache License 2.0
from trilogy-group

@Test
public void shouldReturnFalseIfPublishFailed() throws Exception {
    // Given
    Workspace workspace = new Workspace("name", "desc");
    StructurizrClient client = mock(StructurizrClient.clreplaced);
    doThrow(new RuntimeException("Boom!")).when(client).putWorkspace(anyLong(), any(Workspace.clreplaced));
    StructurizrAdapter structurizrAdapter = new StructurizrAdapter(client);
    // When
    Boolean result = structurizrAdapter.publish(workspace);
    // Then
    replacedertThat(result, equalTo(false));
}

17 Source : StructurizrAdapterTest.java
with Apache License 2.0
from trilogy-group

@Test
public void shouldReturnTrueIfPublishSucceeded() {
    // Given
    Workspace workspace = new Workspace("name", "desc");
    StructurizrClient client = mock(StructurizrClient.clreplaced);
    StructurizrAdapter structurizrAdapter = new StructurizrAdapter(client);
    // When
    Boolean result = structurizrAdapter.publish(workspace);
    // Then
    replacedertThat(result, equalTo(true));
}

17 Source : StructurizrAdapterTest.java
with Apache License 2.0
from trilogy-group

@Test
public void shouldPublishWithClient() throws Exception {
    // Given
    Workspace workspace = new Workspace("name", "desc");
    StructurizrClient client = mock(StructurizrClient.clreplaced);
    StructurizrAdapter structurizrAdapter = new StructurizrAdapter(client);
    // When
    structurizrAdapter.publish(workspace);
    // Then
    verify(client).putWorkspace(anyLong(), any(Workspace.clreplaced));
}

17 Source : WebSequenceDiagramsWriter.java
with Apache License 2.0
from structurizr

/**
 * Writes the dynamic views in the given workspace as WebSequenceDiagrams definitions, to the specified writer.
 *
 * @param workspace     the workspace containing the views to be written
 * @param writer        the Writer to write to
 */
public void write(Workspace workspace, Writer writer) {
    if (workspace != null && writer != null) {
        for (DynamicView view : workspace.getViews().getDynamicViews()) {
            write(view, writer);
        }
    }
}

17 Source : WebSequenceDiagramsWriter.java
with Apache License 2.0
from structurizr

/**
 * Writes the dynamic views in the given workspace as WebSequenceDiagrams definitions, to stdout.
 *
 * @param workspace     the workspace containing the views to be written
 */
public void write(Workspace workspace) {
    StringWriter stringWriter = new StringWriter();
    write(workspace, stringWriter);
    System.out.println(stringWriter.toString());
}

17 Source : WebSequenceDiagramsWriter.java
with Apache License 2.0
from structurizr

/**
 * Write the dynamic views in the given workspace as WebSequenceDiagrams definitions, to stdout.
 *
 * @param workspace     the workspace containing the views to be written
 */
public void toStdOut(Workspace workspace) {
    if (workspace == null) {
        throw new IllegalArgumentException("A workspace must be provided.");
    }
    StringWriter stringWriter = new StringWriter();
    write(workspace, stringWriter);
    System.out.println(stringWriter.toString());
}

17 Source : PlantUMLWriter.java
with Apache License 2.0
from structurizr

/**
 * Creates PlantUML diagram definitions based upon the specified workspace.
 *
 * @param workspace     the workspace containing the views to be written
 * @return  a collection of PlantUML diagram definitions, one per view
 */
public final Collection<PlantUMLDiagram> toPlantUMLDiagrams(Workspace workspace) {
    if (workspace == null) {
        throw new IllegalArgumentException("A workspace must be provided.");
    }
    Collection<PlantUMLDiagram> diagrams = new ArrayList<>();
    for (View view : workspace.getViews().getViews()) {
        StringWriter stringWriter = new StringWriter();
        write(view, stringWriter);
        diagrams.add(new PlantUMLDiagram(view.getKey(), view.getName(), stringWriter.toString()));
    }
    return diagrams;
}

17 Source : MermaidWriter.java
with Apache License 2.0
from structurizr

/**
 * Creates Mermaid diagram definitions based upon the specified workspace.
 *
 * @param workspace     the workspace containing the views to be written
 * @return  a collection of Mermaid diagram definitions, one per view
 */
public Collection<MermaidDiagram> toMermaidDiagrams(Workspace workspace) {
    if (workspace == null) {
        throw new IllegalArgumentException("A workspace must be provided.");
    }
    Collection<MermaidDiagram> diagrams = new ArrayList<>();
    for (View view : workspace.getViews().getViews()) {
        StringWriter stringWriter = new StringWriter();
        write(view, stringWriter);
        diagrams.add(new MermaidDiagram(view.getKey(), view.getName(), stringWriter.toString()));
    }
    return diagrams;
}

17 Source : IlographWriter.java
with Apache License 2.0
from structurizr

private void writeDeploymentEnvironment(Workspace workspace, String deploymentEnvironment, Writer writer) throws Exception {
    writer.append("  - name: Deployment - " + deploymentEnvironment);
    writer.append(LINE_SEPARATOR);
    writer.append("    relations:");
    writer.append(LINE_SEPARATOR);
    List<DeploymentNode> topLevelDeploymentNodes = workspace.getModel().getDeploymentNodes().stream().filter(dn -> dn.getEnvironment().equals(deploymentEnvironment)).sorted(Comparator.comparing(DeploymentNode::getId)).collect(Collectors.toList());
    List<Element> deploymentElementsInEnvironment = new ArrayList<>(topLevelDeploymentNodes);
    for (DeploymentNode deploymentNode : topLevelDeploymentNodes) {
        deploymentElementsInEnvironment.addAll(findAllChildren(deploymentNode));
    }
    Collection<Relationship> relationships = findRelationships(deploymentElementsInEnvironment);
    for (Relationship relationship : relationships) {
        writer.append(String.format("      - from: \"%s\"", relationship.getSourceId()));
        writer.append(LINE_SEPARATOR);
        writer.append(String.format("        to: \"%s\"", relationship.getDestinationId()));
        writer.append(LINE_SEPARATOR);
        if (!StringUtils.isNullOrEmpty(relationship.getDescription())) {
            writer.append(String.format("        label: \"%s\"", relationship.getDescription()));
            writer.append(LINE_SEPARATOR);
        }
        if (!StringUtils.isNullOrEmpty(relationship.getTechnology())) {
            writer.append(String.format("        description: \"%s\"", relationship.getTechnology()));
            writer.append(LINE_SEPARATOR);
        }
        writer.append(LINE_SEPARATOR);
    }
}

17 Source : IlographWriter.java
with Apache License 2.0
from structurizr

public String toString(Workspace workspace) throws Exception {
    StringWriter stringWriter = new StringWriter();
    writeModel(workspace, stringWriter);
    return stringWriter.toString();
}

17 Source : Graphviz.java
with Apache License 2.0
from structurizr

public static void main(String[] args) throws Exception {
    Workspace workspace = createWorkspace();
    // apply graphviz to set x,y coordinates
    GraphvizAutomaticLayout graphviz = new GraphvizAutomaticLayout();
    graphviz.apply(workspace);
    WorkspaceUtils.printWorkspaceAsJson(workspace);
}

17 Source : DotWriter.java
with Apache License 2.0
from structurizr

/**
 * Write the views in the given workspace as DOT notation, to stdout.
 *
 * @param workspace     the workspace containing the views to be written
 */
public void write(Workspace workspace) {
    StringWriter stringWriter = new StringWriter();
    write(workspace, stringWriter);
    System.out.println(stringWriter.toString());
}

17 Source : TypeMatcherComponentFinderStrategyTests.java
with Apache License 2.0
from structurizr

@Before
public void setUp() throws Exception {
    Workspace workspace = new Workspace("Name", "Description");
    Model model = workspace.getModel();
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Name", "Description");
    container = softwareSystem.addContainer("Name", "Description", "Technology");
    componentFinder = new ComponentFinder(container, "test.TypeMatcherComponentFinderStrategy", new TypeMatcherComponentFinderStrategy(new NameSuffixTypeMatcher("Controller", "Controller description", "Controller technology"), new NameSuffixTypeMatcher("Repository", "Repository description", "Repository technology")));
    componentFinder.findComponents();
}

17 Source : StructurizrAnnotationsComponentFinderStrategyTests.java
with Apache License 2.0
from structurizr

@Before
public void setUp() throws Exception {
    Workspace workspace = new Workspace("Name", "");
    Model model = workspace.getModel();
    external1 = model.addSoftwareSystem("External 1", "");
    external2 = model.addSoftwareSystem("External 2", "");
    anonymousUser = model.addPerson("Anonymous User", "");
    authenticatedUser = model.addPerson("Authenticated User", "");
    softwareSystem = model.addSoftwareSystem("Software System", "");
    webBrowser = softwareSystem.addContainer("Web Browser", "", "");
    apiClient = softwareSystem.addContainer("API Client", "", "");
    webApplication = softwareSystem.addContainer("Name", "", "");
    database = softwareSystem.addContainer("Database", "", "");
    // the default usage of the StructurizrAnnotationsComponentFinderStrategy
    // just has the FirstImplementationOfInterfaceSupportingTypesStrategy included
    componentFinder = new ComponentFinder(webApplication, "test.StructurizrAnnotationsComponentFinderStrategy", new StructurizrAnnotationsComponentFinderStrategy());
    componentFinder.findComponents();
}

17 Source : AdrToolsImporter.java
with Apache License 2.0
from structurizr

/**
 * Imports architecture decision records created/managed by adr-tools (https://github.com/npryce/adr-tools).
 */
public clreplaced AdrToolsImporter {

    private static final Pattern replacedleRegex = Pattern.compile("^# \\d*\\. (.*)$", Pattern.MULTILINE);

    private static final Pattern dateRegex = Pattern.compile("^Date: (\\d\\d\\d\\d-\\d\\d-\\d\\d)$", Pattern.MULTILINE);

    private static final Pattern statusRegex = Pattern.compile("## Status\\n\\n(\\w*)");

    private static final String SUPERCEDED_ALTERNATIVE_SPELLING = "Superceded";

    private Workspace workspace;

    private File path;

    private TimeZone timeZone = TimeZone.getTimeZone("UTC");

    public AdrToolsImporter(Workspace workspace, File path) {
        if (workspace == null) {
            throw new IllegalArgumentException("A workspace must be specified.");
        }
        if (path == null) {
            throw new IllegalArgumentException("The path to the architecture decision records must be specified.");
        }
        if (!path.exists()) {
            throw new IllegalArgumentException(path.getAbsolutePath() + " does not exist.");
        }
        if (!path.isDirectory()) {
            throw new IllegalArgumentException(path.getAbsolutePath() + " is not a directory.");
        }
        this.workspace = workspace;
        this.path = path;
    }

    public void setTimeZone(String timeZone) {
        this.timeZone = TimeZone.getTimeZone(timeZone);
    }

    public void setTimeZone(TimeZone timeZone) {
        this.timeZone = timeZone;
    }

    public Set<Decision> importArchitectureDecisionRecords() throws Exception {
        return importArchitectureDecisionRecords(null);
    }

    public Set<Decision> importArchitectureDecisionRecords(SoftwareSystem softwareSystem) throws Exception {
        Set<Decision> decisions = new HashSet<>();
        File[] markdownFiles = path.listFiles(new FilenameFilter() {

            @Override
            public boolean accept(File dir, String name) {
                return name.endsWith(".md");
            }
        });
        if (markdownFiles != null) {
            // first create an index of filename -> ID
            Map<String, String> index = new HashMap<>();
            for (File file : markdownFiles) {
                index.put(file.getName(), extractIntegerIdFromFileName(file));
            }
            for (File file : markdownFiles) {
                String id = extractIntegerIdFromFileName(file);
                Date date = new Date();
                String replacedle = "";
                DecisionStatus status = DecisionStatus.Proposed;
                String content = new String(Files.readAllBytes(file.toPath()), "UTF-8");
                content = content.replace("\r", "");
                Format format = Format.Markdown;
                replacedle = extractreplacedle(content);
                date = extractDate(content);
                status = extractStatus(content);
                for (String filename : index.keySet()) {
                    content = content.replace(filename, calculateUrl(softwareSystem, index.get(filename)));
                }
                Decision decision = workspace.getDoreplacedentation().addDecision(softwareSystem, id, date, replacedle, status, format, content);
                decisions.add(decision);
            }
        }
        return decisions;
    }

    private String calculateUrl(SoftwareSystem softwareSystem, String id) throws Exception {
        if (softwareSystem == null) {
            return "#" + urlEncode("/") + ":" + urlEncode(id);
        } else {
            String name = softwareSystem.getCanonicalName();
            name = name.substring("/SoftwareSystem".length() + 1);
            return "#" + urlEncode(name) + ":" + urlEncode(id);
        }
    }

    private String urlEncode(String value) throws Exception {
        return URLEncoder.encode(value, StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20");
    }

    private String extractIntegerIdFromFileName(File file) {
        return "" + Integer.parseInt(file.getName().substring(0, 4));
    }

    private String extractreplacedle(String content) {
        Matcher matcher = replacedleRegex.matcher(content);
        if (matcher.find()) {
            return matcher.group(1);
        } else {
            return "Unreplacedled";
        }
    }

    private Date extractDate(String content) throws Exception {
        Matcher matcher = dateRegex.matcher(content);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        sdf.setTimeZone(timeZone);
        if (matcher.find()) {
            return sdf.parse(matcher.group(1));
        } else {
            return new Date();
        }
    }

    private DecisionStatus extractStatus(String content) {
        Matcher matcher = statusRegex.matcher(content);
        if (matcher.find()) {
            String status = matcher.group(1);
            if (status.equals(SUPERCEDED_ALTERNATIVE_SPELLING)) {
                return DecisionStatus.Superseded;
            } else {
                return DecisionStatus.valueOf(status);
            }
        } else {
            return DecisionStatus.Proposed;
        }
    }
}

17 Source : StructurizrDslFormatterTests.java
with Apache License 2.0
from structurizr

@Test
void test_gettingstarted() throws Exception {
    StructurizrDslParser parser = new StructurizrDslParser();
    parser.parse(new File("examples/getting-started.dsl"));
    Workspace workspace = parser.getWorkspace();
    StructurizrDslFormatter formatter = new StructurizrDslFormatter();
    replacedertEquals("workspace \"Getting Started\" \"This is a model of my software system.\" {\n" + "\n" + "    model {\n" + "        impliedRelationships \"false\" \n" + "\n" + "        User = person \"User\" \"A user of my software system.\" \"\" \n" + "        SoftwareSystem = softwareSystem \"Software System\" \"My software system.\" \"\" \n" + "        User -> SoftwareSystem \"Uses\" \"\" \"\" \n" + "    }\n" + "\n" + "    views {\n" + "        systemContext SoftwareSystem \"SystemContext\" \"An example of a System Context diagram.\" {\n" + "            include User \n" + "            include SoftwareSystem \n" + "            autolayout tb 300 300 \n" + "        }\n" + "\n" + "        styles {\n" + "            element \"Person\" {\n" + "                shape \"Person\" \n" + "                background \"#08427b\" \n" + "                color \"#ffffff\" \n" + "            }\n" + "            element \"Software System\" {\n" + "                background \"#1168bd\" \n" + "                color \"#ffffff\" \n" + "            }\n" + "        }\n" + "\n" + "    }\n" + "\n" + "}\n", formatter.format(WorkspaceUtils.toJson(workspace, false)));
}

17 Source : StructurizrDslFormatterTests.java
with Apache License 2.0
from structurizr

@Test
void test_aws() throws Exception {
    StructurizrDslParser parser = new StructurizrDslParser();
    parser.parse(new File("examples/amazon-web-services.dsl"));
    Workspace workspace = parser.getWorkspace();
    StructurizrDslFormatter formatter = new StructurizrDslFormatter();
    replacedertEquals("workspace \"Amazon Web Services Example\" \"An example AWS deployment architecture.\" {\n" + "\n" + "    model {\n" + "        impliedRelationships \"false\" \n" + "\n" + "        SpringPetClinic = softwareSystem \"Spring PetClinic\" \"Allows employees to view and manage information regarding the veterinarians, the clients, and their pets.\" \"Spring Boot Application\" {\n" + "            SpringPetClinic_WebApplication = container \"Web Application\" \"Allows employees to view and manage information regarding the veterinarians, the clients, and their pets.\" \"Java and Spring Boot\" \"\" \n" + "            SpringPetClinic_Database = container \"Database\" \"Stores information regarding the veterinarians, the clients, and their pets.\" \"Relational database schema\" \"Database\" \n" + "        }\n" + "        SpringPetClinic_WebApplication -> SpringPetClinic_Database \"Reads from and writes to\" \"JDBC/SSL\" \"\" \n" + "\n" + "        deploymentEnvironment \"Live\" {\n" + "            Live_AmazonWebServices = deploymentNode \"Amazon Web Services\" \"\" \"\" \"Amazon Web Services - Cloud\" {\n" + "                Live_AmazonWebServices_USEast1 = deploymentNode \"US-East-1\" \"\" \"\" \"Amazon Web Services - Region\" {\n" + "                    Live_AmazonWebServices_USEast1_Route53 = infrastructureNode \"Route 53\" \"\" \"\" \"Amazon Web Services - Route 53\" \n" + "                    Live_AmazonWebServices_USEast1_ElasticLoadBalancer = infrastructureNode \"Elastic Load Balancer\" \"\" \"\" \"Amazon Web Services - Elastic Load Balancing\" \n" + "                    Live_AmazonWebServices_USEast1_AmazonRDS = deploymentNode \"Amazon RDS\" \"\" \"\" \"Amazon Web Services - RDS\" {\n" + "                        Live_AmazonWebServices_USEast1_AmazonRDS_MySQL = deploymentNode \"MySQL\" \"\" \"\" \"Amazon Web Services - RDS_MySQL_instance\" {\n" + "                            Live_AmazonWebServices_USEast1_AmazonRDS_MySQL_Database_1 = containerInstance SpringPetClinic_Database \"\" \n" + "                        }\n" + "                    }\n" + "                    Live_AmazonWebServices_USEast1_Autoscalinggroup = deploymentNode \"Autoscaling group\" \"\" \"\" \"Amazon Web Services - Auto Scaling\" {\n" + "                        Live_AmazonWebServices_USEast1_Autoscalinggroup_AmazonEC2 = deploymentNode \"Amazon EC2\" \"\" \"\" \"Amazon Web Services - EC2\" {\n" + "                            Live_AmazonWebServices_USEast1_Autoscalinggroup_AmazonEC2_WebApplication_1 = containerInstance SpringPetClinic_WebApplication \"\" \n" + "                        }\n" + "                    }\n" + "                }\n" + "            }\n" + "        }\n" + "\n" + "        Live_AmazonWebServices_USEast1_Route53 -> Live_AmazonWebServices_USEast1_ElasticLoadBalancer \"Forwards requests to\" \"HTTPS\" \"\" \n" + "        Live_AmazonWebServices_USEast1_ElasticLoadBalancer -> Live_AmazonWebServices_USEast1_Autoscalinggroup_AmazonEC2_WebApplication_1 \"Forwards requests to\" \"HTTPS\" \"\" \n" + "    }\n" + "\n" + "    views {\n" + "        deployment SpringPetClinic \"Live\" \"AmazonWebServicesDeployment\" \"\" {\n" + "            include Live_AmazonWebServices_USEast1_Autoscalinggroup_AmazonEC2 \n" + "            include Live_AmazonWebServices_USEast1_AmazonRDS_MySQL \n" + "            include Live_AmazonWebServices_USEast1 \n" + "            autolayout lr 300 300 \n" + "        }\n" + "\n" + "        styles {\n" + "            element \"Database\" {\n" + "                shape \"Cylinder\" \n" + "            }\n" + "            element \"Element\" {\n" + "                shape \"RoundedBox\" \n" + "                background \"#ffffff\" \n" + "            }\n" + "            element \"Infrastructure Node\" {\n" + "                shape \"RoundedBox\" \n" + "            }\n" + "        }\n" + "        themes \"https://static.structurizr.com/themes/amazon-web-services-2020.04.30/theme.json\" \n" + "\n" + "    }\n" + "\n" + "}\n", formatter.format(WorkspaceUtils.toJson(workspace, false)));
}

17 Source : StructurizrDslFormatterTests.java
with Apache License 2.0
from structurizr

@Test
void test_emptyWorkspace() throws Exception {
    Workspace workspace = new Workspace("Name", "Description");
    StructurizrDslFormatter formatter = new StructurizrDslFormatter();
    replacedertEquals("workspace \"Name\" \"Description\" {\n" + "\n" + "    model {\n" + "        impliedRelationships \"false\" \n" + "\n" + "    }\n" + "\n" + "}\n", formatter.format(WorkspaceUtils.toJson(workspace, false)));
}

17 Source : StructurizrDslFormatterTests.java
with Apache License 2.0
from structurizr

@Test
void test_frs() throws Exception {
    StructurizrDslParser parser = new StructurizrDslParser();
    parser.parse(new File("examples/financial-risk-system.dsl"));
    Workspace workspace = parser.getWorkspace();
    StructurizrDslFormatter formatter = new StructurizrDslFormatter();
    replacedertEquals("workspace \"Financial Risk System\" \"This is a simple (incomplete) example C4 model based upon the financial risk system architecture kata, which can be found at http://bit.ly/sa4d-risksystem\" {\n" + "\n" + "    model {\n" + "        impliedRelationships \"false\" \n" + "\n" + "        BusinessUser = person \"Business User\" \"A regular business user.\" \"\" \n" + "        ConfigurationUser = person \"Configuration User\" \"A regular business user who can also configure the parameters used in the risk calculations.\" \"\" \n" + "        FinancialRiskSystem = softwareSystem \"Financial Risk System\" \"Calculates the bank's exposure to risk for product X.\" \"Financial Risk System\" \n" + "        TradeDataSystem = softwareSystem \"Trade Data System\" \"The system of record for trades of type X.\" \"\" \n" + "        ReferenceDataSystem = softwareSystem \"Reference Data System\" \"Manages reference data for all counterparties the bank interacts with.\" \"\" \n" + "        ReferenceDataSystemv20 = softwareSystem \"Reference Data System v2.0\" \"Manages reference data for all counterparties the bank interacts with.\" \"Future State\" \n" + "        Emailsystem = softwareSystem \"E-mail system\" \"The bank's Microsoft Exchange system.\" \"\" \n" + "        CentralMonitoringService = softwareSystem \"Central Monitoring Service\" \"The bank's central monitoring and alerting dashboard.\" \"\" \n" + "        ActiveDirectory = softwareSystem \"Active Directory\" \"The bank's authentication and authorisation system.\" \"\" \n" + "        BusinessUser -> FinancialRiskSystem \"Views reports using\" \"\" \"\" \n" + "        FinancialRiskSystem -> TradeDataSystem \"Gets trade data from\" \"\" \"\" \n" + "        FinancialRiskSystem -> ReferenceDataSystem \"Gets counterparty data from\" \"\" \"\" \n" + "        FinancialRiskSystem -> ReferenceDataSystemv20 \"Gets counterparty data from\" \"\" \"Future State\" \n" + "        ConfigurationUser -> FinancialRiskSystem \"Configures parameters using\" \"\" \"\" \n" + "        FinancialRiskSystem -> Emailsystem \"Sends a notification that a report is ready to\" \"\" \"\" \n" + "        Emailsystem -> BusinessUser \"Sends a notification that a report is ready to\" \"E-mail message\" \"\" \n" + "        FinancialRiskSystem -> CentralMonitoringService \"Sends critical failure alerts to\" \"SNMP\" \"Asynchronous,Alert\" \n" + "        FinancialRiskSystem -> ActiveDirectory \"Uses for user authentication and authorisation\" \"\" \"\" \n" + "    }\n" + "\n" + "    views {\n" + "        systemContext FinancialRiskSystem \"Context\" \"An example System Context diagram for the Financial Risk System architecture kata.\" {\n" + "            include BusinessUser \n" + "            include ConfigurationUser \n" + "            include FinancialRiskSystem \n" + "            include TradeDataSystem \n" + "            include ReferenceDataSystem \n" + "            include ReferenceDataSystemv20 \n" + "            include Emailsystem \n" + "            include CentralMonitoringService \n" + "            include ActiveDirectory \n" + "            autolayout tb 300 300 \n" + "        }\n" + "\n" + "        styles {\n" + "            element \"Element\" {\n" + "                color \"#ffffff\" \n" + "            }\n" + "            element \"Financial Risk System\" {\n" + "                background \"#550000\" \n" + "                color \"#ffffff\" \n" + "            }\n" + "            element \"Future State\" {\n" + "                opacity \"30\" \n" + "            }\n" + "            element \"Person\" {\n" + "                shape \"Person\" \n" + "                background \"#d46a6a\" \n" + "            }\n" + "            element \"Software System\" {\n" + "                shape \"RoundedBox\" \n" + "                background \"#801515\" \n" + "            }\n" + "            relationship \"Alert\" {\n" + "                color \"#ff0000\" \n" + "            }\n" + "            relationship \"Asynchronous\" {\n" + "                dashed \"true\" \n" + "            }\n" + "            relationship \"Future State\" {\n" + "                opacity \"30\" \n" + "            }\n" + "            relationship \"Relationship\" {\n" + "                dashed \"false\" \n" + "            }\n" + "        }\n" + "\n" + "    }\n" + "\n" + "}\n", formatter.format(WorkspaceUtils.toJson(workspace, false)));
}

See More Examples