com.structurizr.model.Tags Java Examples

The following examples show how to use com.structurizr.model.Tags. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutomaticDocumentationTemplateExample.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Documentation - Automatic", "An empty software architecture document using the Structurizr template.");
    Model model = workspace.getModel();
    ViewSet views = workspace.getViews();

    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

    // this directory includes a mix of Markdown and AsciiDoc files
    File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/automatic");

    AutomaticDocumentationTemplate template = new AutomaticDocumentationTemplate(workspace);
    template.addSections(softwareSystem, documentationRoot);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example #2
Source File: StyleTests.java    From java with Apache License 2.0 6 votes vote down vote up
@Test
public void test_findElementStyle_ReturnsTheCorrectStyle_WhenStylesAreDefined() {
    SoftwareSystem element = model.addSoftwareSystem("Name", "Description");
    element.addTags("Some Tag");

    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000").color("#ffffff");
    styles.addElementStyle("Some Tag").color("#0000ff").stroke("#00ff00").shape(Shape.RoundedBox).width(123).height(456);

    ElementStyle style = styles.findElementStyle(element);
    assertEquals("#ff0000", style.getBackground());
    assertEquals("#0000ff", style.getColor());
    assertEquals("#00ff00", style.getStroke());
    assertEquals(Shape.RoundedBox, style.getShape());
    assertEquals(new Integer(123), style.getWidth());
    assertEquals(new Integer(456), style.getHeight());
}
 
Example #3
Source File: CorporateBranding.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Corporate Branding", "This is a model of my software system.");
    Model model = workspace.getModel();

    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

    StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
    template.addContextSection(softwareSystem, Format.Markdown, "Here is some context about the software system...\n\n![](embed:SystemContext)");

    Branding branding = views.getConfiguration().getBranding();
    branding.setLogo(ImageUtils.getImageAsDataUri(new File("./docs/images/structurizr-logo.png")));

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example #4
Source File: ClientSideEncryption.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Client-side encrypted workspace", "This is a client-side encrypted workspace. The passphrase is 'password'.");
    Model model = workspace.getModel();

    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#d34407").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#f86628").color("#ffffff").shape(Shape.Person);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.setEncryptionStrategy(new AesEncryptionStrategy("password"));
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example #5
Source File: GettingStarted.java    From java with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    // all software architecture models belong to a workspace
    Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
    Model model = workspace.getModel();

    // create a model to describe a user using a software system
    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    // create a system context diagram showing people and software systems
    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    // add some styling to the diagram elements
    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);

    // upload to structurizr.com (you'll need your own workspace ID, API key and API secret)
    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example #6
Source File: StructurizrSimple.java    From tutorials with MIT License 5 votes vote down vote up
private static void addStyles(ViewSet viewSet) {
    Styles styles = viewSet.getConfiguration().getStyles();
    styles.addElementStyle(Tags.ELEMENT).color("#000000");
    styles.addElementStyle(Tags.PERSON).background("#ffbf00").shape(Shape.Person);
    styles.addElementStyle(Tags.CONTAINER).background("#facc2E");
    styles.addRelationshipStyle(Tags.RELATIONSHIP).routing(Routing.Orthogonal);

    styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
    styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
}
 
Example #7
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_clearRelationshipStyles_RemovesAllRelationshipStyles() {
    styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000");
    assertEquals(1, styles.getRelationships().size());

    styles.clearRelationshipStyles();
    assertEquals(0, styles.getRelationships().size());
}
 
Example #8
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_clearElementStyles_RemovesAllElementStyles() {
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).color("#ff0000");
    assertEquals(1, styles.getElements().size());

    styles.clearElementStyles();
    assertEquals(0, styles.getElements().size());
}
 
Example #9
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_addRelationshipStyle_ThrowsAnException_WhenAStyleWithTheSameTagExistsAlready() {
    try {
        styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000");
        styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000");

        fail();
    } catch (IllegalArgumentException iae) {
        assertEquals("A relationship style for the tag \"Relationship\" already exists.", iae.getMessage());
    }
}
 
Example #10
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_addElementStyle_ThrowsAnException_WhenAStyleWithTheSameTagExistsAlready() {
    try {
        styles.addElementStyle(Tags.SOFTWARE_SYSTEM).color("#ff0000");
        styles.addElementStyle(Tags.SOFTWARE_SYSTEM).color("#ff0000");

        fail();
    } catch (IllegalArgumentException iae) {
        assertEquals("An element style for the tag \"Software System\" already exists.", iae.getMessage());
    }
}
 
Example #11
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_findRelationshipStyle_ReturnsTheCorrectStyle_WhenStylesAreDefined() {
    SoftwareSystem element = model.addSoftwareSystem("Name", "Description");
    Relationship relationship = element.uses(element, "Uses");
    relationship.addTags("Some Tag");

    styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000");
    styles.addRelationshipStyle("Some Tag").color("#0000ff");

    RelationshipStyle style = styles.findRelationshipStyle(relationship);
    assertEquals("#0000ff", style.getColor());
}
 
Example #12
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_findElementStyle_ReturnsTheDefaultElementSize_WhenTheShapeIsAPerson() {
    SoftwareSystem element = model.addSoftwareSystem("Name", "Description");
    element.addTags("Some Tag");

    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000").color("#ffffff");
    styles.addElementStyle("Some Tag").shape(Shape.Person);

    ElementStyle style = styles.findElementStyle(element);
    assertEquals(Shape.Person, style.getShape());
    assertEquals(new Integer(400), style.getWidth());
    assertEquals(new Integer(400), style.getHeight());
}
 
Example #13
Source File: StyleTests.java    From java with Apache License 2.0 5 votes vote down vote up
@Test
public void test_findElementStyle_ReturnsTheDefaultElementSize_WhenTheShapeIsABox() {
    SoftwareSystem element = model.addSoftwareSystem("Name", "Description");
    element.addTags("Some Tag");

    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000").color("#ffffff");
    styles.addElementStyle("Some Tag").shape(Shape.Box);

    ElementStyle style = styles.findElementStyle(element);
    assertEquals(Shape.Box, style.getShape());
    assertEquals(new Integer(450), style.getWidth());
    assertEquals(new Integer(300), style.getHeight());
}
 
Example #14
Source File: Styles.java    From java with Apache License 2.0 5 votes vote down vote up
public void addDefaultStyles() {
    addElementStyle(Tags.ELEMENT).shape(Shape.RoundedBox);
    addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    addElementStyle(Tags.CONTAINER).background("#438dd5").color("#ffffff");
    addElementStyle(Tags.COMPONENT).background("#85bbf0").color("#000000");
    addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);
    addElementStyle(Tags.INFRASTRUCTURE_NODE).background("#ffffff");
}
 
Example #15
Source File: FilteredViews.java    From java with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Filtered Views", "An example of using filtered views.");
    Model model = workspace.getModel();

    Person user = model.addPerson("User", "A description of the user.");
    SoftwareSystem softwareSystemA = model.addSoftwareSystem("Software System A", "A description of software system A.");
    SoftwareSystem softwareSystemB = model.addSoftwareSystem("Software System B", "A description of software system B.");
    softwareSystemB.addTags(FUTURE_STATE);

    user.uses(softwareSystemA, "Uses for tasks 1 and 2").addTags(CURRENT_STATE);
    user.uses(softwareSystemA, "Uses for task 1").addTags(FUTURE_STATE);
    user.uses(softwareSystemB, "Uses for task 2").addTags(FUTURE_STATE);

    ViewSet views = workspace.getViews();
    SystemLandscapeView systemLandscapeView = views.createSystemLandscapeView("SystemLandscape", "An example System Landscape diagram.");
    systemLandscapeView.addAllElements();

    views.createFilteredView(systemLandscapeView, "CurrentState", "The current system landscape.", FilterMode.Exclude, FUTURE_STATE);
    views.createFilteredView(systemLandscapeView, "FutureState", "The future state system landscape after Software System B is live.", FilterMode.Exclude, CURRENT_STATE);

    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.ELEMENT).color("#ffffff");
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#91a437").shape(Shape.RoundedBox);
    styles.addElementStyle(Tags.PERSON).background("#6a7b15").shape(Shape.Person);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example #16
Source File: Structurizr.java    From java-quickstart with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    // a Structurizr workspace is the wrapper for a software architecture model, views and documentation
    Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
    Model model = workspace.getModel();

    // add some elements to your software architecture model
    Person user = model.addPerson("User", "A user of my software system.");
    SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
    user.uses(softwareSystem, "Uses");

    // define some views (the diagrams you would like to see)
    ViewSet views = workspace.getViews();
    SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
    contextView.setPaperSize(PaperSize.A5_Landscape);
    contextView.addAllSoftwareSystems();
    contextView.addAllPeople();

    // add some documentation
    StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);
    template.addContextSection(softwareSystem, Format.Markdown,
            "Here is some context about the software system...\n" +
                    "\n" +
                    "![](embed:SystemContext)");

    // add some styling
    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);

    uploadWorkspaceToStructurizr(workspace);
}
 
Example #17
Source File: Personas.java    From structurizr-extensions with Apache License 2.0 5 votes vote down vote up
@Autowired
public Personas(Model model) {
    admin = model.addPerson(Location.Internal, "Admin", "the administrator of our system");
    admin.addTags(Tags.PERSON);
    customer = model.addPerson(Location.External, "Customer", "a customer who wants to buy items in our shop");
    customer.addTags(Tags.PERSON);
}
 
Example #18
Source File: StyleProvider.java    From structurizr-extensions with Apache License 2.0 5 votes vote down vote up
public StyleProvider(Workspace workspace) {
    Styles styles = workspace.getViews().getConfiguration().getStyles();
    styles.addElementStyle(Tags.ELEMENT).width(500).height(350).color("#ffffff").fontSize(30).shape(Shape.RoundedBox);
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#2A4E6E");
    styles.addElementStyle(Tags.CONTAINER).background("#007F0E");
    styles.addElementStyle(Tags.COMPONENT).background("#3059BA");
    styles.addElementStyle(Tags.PERSON).width(475).background("#728da5").shape(Shape.Person);
    styles.addRelationshipStyle(Tags.RELATIONSHIP).dashed(true).thickness(5).fontSize(40).width(400);
    styles.addRelationshipStyle(Tags.SYNCHRONOUS).dashed(false);
    styles.addRelationshipStyle(Tags.ASYNCHRONOUS).dashed(true);
}
 
Example #19
Source File: StructurizrDocumentationExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Documentation - Structurizr", "An empty software architecture document using the Structurizr template.");
        Model model = workspace.getModel();
        ViewSet views = workspace.getViews();

        Person user = model.addPerson("User", "A user of my software system.");
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
        user.uses(softwareSystem, "Uses");

        SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
        contextView.addAllSoftwareSystems();
        contextView.addAllPeople();

        Styles styles = views.getConfiguration().getStyles();
        styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

        StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);

        // this is the Markdown version
        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/structurizr/markdown");
        template.addContextSection(softwareSystem, new File(documentationRoot, "01-context.md"));
        template.addFunctionalOverviewSection(softwareSystem, new File(documentationRoot, "02-functional-overview.md"));
        template.addQualityAttributesSection(softwareSystem, new File(documentationRoot, "03-quality-attributes.md"));
        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "04-constraints.md"));
        template.addPrinciplesSection(softwareSystem, new File(documentationRoot, "05-principles.md"));
        template.addSoftwareArchitectureSection(softwareSystem, new File(documentationRoot, "06-software-architecture.md"));
        template.addDataSection(softwareSystem, new File(documentationRoot, "07-data.md"));
        template.addInfrastructureArchitectureSection(softwareSystem, new File(documentationRoot, "08-infrastructure-architecture.md"));
        template.addDeploymentSection(softwareSystem, new File(documentationRoot, "09-deployment.md"));
        template.addDevelopmentEnvironmentSection(softwareSystem, new File(documentationRoot, "10-development-environment.md"));
        template.addOperationAndSupportSection(softwareSystem, new File(documentationRoot, "11-operation-and-support.md"));
        template.addDecisionLogSection(softwareSystem, new File(documentationRoot, "12-decision-log.md"));

        // this is the AsciiDoc version
//        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/structurizr/asciidoc");
//        template.addContextSection(softwareSystem, new File(documentationRoot, "01-context.adoc"));
//        template.addFunctionalOverviewSection(softwareSystem, new File(documentationRoot, "02-functional-overview.adoc"));
//        template.addQualityAttributesSection(softwareSystem, new File(documentationRoot, "03-quality-attributes.adoc"));
//        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "04-constraints.adoc"));
//        template.addPrinciplesSection(softwareSystem, new File(documentationRoot, "05-principles.adoc"));
//        template.addSoftwareArchitectureSection(softwareSystem, new File(documentationRoot, "06-software-architecture.adoc"));
//        template.addDataSection(softwareSystem, new File(documentationRoot, "07-data.adoc"));
//        template.addInfrastructureArchitectureSection(softwareSystem, new File(documentationRoot, "08-infrastructure-architecture.adoc"));
//        template.addDeploymentSection(softwareSystem, new File(documentationRoot, "09-deployment.adoc"));
//        template.addDevelopmentEnvironmentSection(softwareSystem, new File(documentationRoot, "10-development-environment.adoc"));
//        template.addOperationAndSupportSection(softwareSystem, new File(documentationRoot, "11-operation-and-support.adoc"));
//        template.addDecisionLogSection(softwareSystem, new File(documentationRoot, "12-decision-log.adoc"));

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example #20
Source File: Arc42DocumentationExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Documentation - arc42", "An empty software architecture document using the arc42 template.");
        Model model = workspace.getModel();
        ViewSet views = workspace.getViews();

        Person user = model.addPerson("User", "A user of my software system.");
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
        user.uses(softwareSystem, "Uses");

        SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
        contextView.addAllSoftwareSystems();
        contextView.addAllPeople();

        Styles styles = views.getConfiguration().getStyles();
        styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

        Arc42DocumentationTemplate template = new Arc42DocumentationTemplate(workspace);

        // this is the Markdown version
        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/arc42/markdown");
        template.addIntroductionAndGoalsSection(softwareSystem, new File(documentationRoot, "01-introduction-and-goals.md"));
        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "02-architecture-constraints.md"));
        template.addContextAndScopeSection(softwareSystem, new File(documentationRoot, "03-system-scope-and-context.md"));
        template.addSolutionStrategySection(softwareSystem, new File(documentationRoot, "04-solution-strategy.md"));
        template.addBuildingBlockViewSection(softwareSystem, new File(documentationRoot, "05-building-block-view.md"));
        template.addRuntimeViewSection(softwareSystem, new File(documentationRoot, "06-runtime-view.md"));
        template.addDeploymentViewSection(softwareSystem, new File(documentationRoot, "07-deployment-view.md"));
        template.addCrosscuttingConceptsSection(softwareSystem, new File(documentationRoot, "08-crosscutting-concepts.md"));
        template.addArchitecturalDecisionsSection(softwareSystem, new File(documentationRoot, "09-architecture-decisions.md"));
        template.addRisksAndTechnicalDebtSection(softwareSystem, new File(documentationRoot, "10-quality-requirements.md"));
        template.addQualityRequirementsSection(softwareSystem, new File(documentationRoot, "11-risks-and-technical-debt.md"));
        template.addGlossarySection(softwareSystem, new File(documentationRoot, "12-glossary.md"));

        // this is the AsciiDoc version
//        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/arc42/asciidoc");
//        template.addIntroductionAndGoalsSection(softwareSystem, new File(documentationRoot, "01-introduction-and-goals.adoc"));
//        template.addConstraintsSection(softwareSystem, new File(documentationRoot, "02-architecture-constraints.adoc"));
//        template.addContextAndScopeSection(softwareSystem, new File(documentationRoot, "03-system-scope-and-context.adoc"));
//        template.addSolutionStrategySection(softwareSystem, new File(documentationRoot, "04-solution-strategy.adoc"));
//        template.addBuildingBlockViewSection(softwareSystem, new File(documentationRoot, "05-building-block-view.adoc"));
//        template.addRuntimeViewSection(softwareSystem, new File(documentationRoot, "06-runtime-view.adoc"));
//        template.addDeploymentViewSection(softwareSystem, new File(documentationRoot, "07-deployment-view.adoc"));
//        template.addCrosscuttingConceptsSection(softwareSystem, new File(documentationRoot, "08-crosscutting-concepts.adoc"));
//        template.addArchitecturalDecisionsSection(softwareSystem, new File(documentationRoot, "09-architecture-decisions.adoc"));
//        template.addRisksAndTechnicalDebtSection(softwareSystem, new File(documentationRoot, "10-quality-requirements.adoc"));
//        template.addQualityRequirementsSection(softwareSystem, new File(documentationRoot, "11-risks-and-technical-debt.adoc"));
//        template.addGlossarySection(softwareSystem, new File(documentationRoot, "12-glossary.adoc"));

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example #21
Source File: ViewpointsAndPerspectivesDocumentationExample.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
        Workspace workspace = new Workspace("Documentation - Viewpoints and Perspectives", "An empty software architecture document using the Viewpoints and Perspectives template.");
        Model model = workspace.getModel();
        ViewSet views = workspace.getViews();

        Person user = model.addPerson("User", "A user of my software system.");
        SoftwareSystem softwareSystem = model.addSoftwareSystem("Software System", "My software system.");
        user.uses(softwareSystem, "Uses");

        SystemContextView contextView = views.createSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");
        contextView.addAllSoftwareSystems();
        contextView.addAllPeople();

        Styles styles = views.getConfiguration().getStyles();
        styles.addElementStyle(Tags.PERSON).shape(Shape.Person);

        ViewpointsAndPerspectivesDocumentationTemplate template = new ViewpointsAndPerspectivesDocumentationTemplate(workspace);

        // this is the Markdown version
        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/viewpointsandperspectives/markdown");
        template.addIntroductionSection(softwareSystem, new File(documentationRoot, "01-introduction.md"));
        template.addGlossarySection(softwareSystem, new File(documentationRoot, "02-glossary.md"));
        template.addSystemStakeholdersAndRequirementsSection(softwareSystem, new File(documentationRoot, "03-system-stakeholders-and-requirements.md"));
        template.addArchitecturalForcesSection(softwareSystem, new File(documentationRoot, "04-architectural-forces.md"));
        template.addArchitecturalViewsSection(softwareSystem, new File(documentationRoot, "05-architectural-views"));
        template.addSystemQualitiesSection(softwareSystem, new File(documentationRoot, "06-system-qualities.md"));
        template.addAppendicesSection(softwareSystem, new File(documentationRoot, "07-appendices.md"));

        // this is the AsciiDoc version
//        File documentationRoot = new File("./structurizr-examples/src/com/structurizr/example/documentation/viewpointsandperspectives/asciidoc");
//        template.addIntroductionSection(softwareSystem, new File(documentationRoot, "01-introduction.adoc"));
//        template.addGlossarySection(softwareSystem, new File(documentationRoot, "02-glossary.adoc"));
//        template.addSystemStakeholdersAndRequirementsSection(softwareSystem, new File(documentationRoot, "03-system-stakeholders-and-requirements.adoc"));
//        template.addArchitecturalForcesSection(softwareSystem, new File(documentationRoot, "04-architectural-forces.adoc"));
//        template.addArchitecturalViewsSection(softwareSystem, new File(documentationRoot, "05-architectural-views"));
//        template.addSystemQualitiesSection(softwareSystem, new File(documentationRoot, "06-system-qualities.adoc"));
//        template.addAppendicesSection(softwareSystem, new File(documentationRoot, "07-appendices.adoc"));

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example #22
Source File: Shapes.java    From java with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws Exception {
    Workspace workspace = new Workspace("Shapes", "An example of all shapes available in Structurizr.");
    Model model = workspace.getModel();

    model.addSoftwareSystem("Box", "Description").addTags("Box");
    model.addSoftwareSystem("RoundedBox", "Description").addTags("RoundedBox");
    model.addSoftwareSystem("Ellipse", "Description").addTags("Ellipse");
    model.addSoftwareSystem("Circle", "Description").addTags("Circle");
    model.addSoftwareSystem("Hexagon", "Description").addTags("Hexagon");
    model.addSoftwareSystem("Cylinder", "Description").addTags("Cylinder");
    model.addSoftwareSystem("WebBrowser", "Description").addTags("Web Browser");
    model.addSoftwareSystem("Mobile Device Portrait", "Description").addTags("Mobile Device Portrait");
    model.addSoftwareSystem("Mobile Device Landscape", "Description").addTags("Mobile Device Landscape");
    model.addSoftwareSystem("Pipe", "Description").addTags("Pipe");
    model.addSoftwareSystem("Folder", "Description").addTags("Folder");
    model.addSoftwareSystem("Robot", "Description").addTags("Robot");
    model.addPerson("Person", "Description").addTags("Person");
    model.addSoftwareSystem("Component", "Description").addTags("Component");

    ViewSet views = workspace.getViews();
    SystemLandscapeView view = views.createSystemLandscapeView("shapes", "An example of all shapes available in Structurizr.");
    view.addAllElements();
    view.setPaperSize(PaperSize.A5_Landscape);

    Styles styles = views.getConfiguration().getStyles();

    styles.addElementStyle(Tags.ELEMENT).color("#ffffff").background("#438dd5").fontSize(34).width(650).height(400).description(false).metadata(false);
    styles.addElementStyle("Box").shape(Shape.Box);
    styles.addElementStyle("RoundedBox").shape(Shape.RoundedBox);
    styles.addElementStyle("Ellipse").shape(Shape.Ellipse);
    styles.addElementStyle("Circle").shape(Shape.Circle);
    styles.addElementStyle("Cylinder").shape(Shape.Cylinder);
    styles.addElementStyle("Web Browser").shape(Shape.WebBrowser);
    styles.addElementStyle("Mobile Device Portrait").shape(Shape.MobileDevicePortrait).width(400).height(650);
    styles.addElementStyle("Mobile Device Landscape").shape(Shape.MobileDeviceLandscape);
    styles.addElementStyle("Pipe").shape(Shape.Pipe);
    styles.addElementStyle("Folder").shape(Shape.Folder);
    styles.addElementStyle("Hexagon").shape(Shape.Hexagon);
    styles.addElementStyle("Robot").shape(Shape.Robot).width(550);
    styles.addElementStyle("Person").shape(Shape.Person).width(550);
    styles.addElementStyle("Component").shape(Shape.Component);

    StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
    structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
}
 
Example #23
Source File: AwsPublicSystemDocumentation.java    From cia with Apache License 2.0 4 votes vote down vote up
/**
 * The main method.
 *
 * @param args
 *            the arguments
 * @throws Exception
 *             the exception
 */
public static void main(final String[] args) throws Exception {
	final Workspace workspace = new Workspace("Citizen Intelligence Agency", "Public Aws System Documentation");
	final Model model = workspace.getModel();
	final ViewSet viewSet = workspace.getViews();

	final SoftwareSystem ciaSystem = model.addSoftwareSystem("Citizen Intelligence Agency",
			"Tracking politicians like bugs!");

	final DeploymentNode masterAccountNode = model.addDeploymentNode("Master Account", "AWS", "Aws Account");
	final Container awsAccountContainer = ciaSystem.addContainer("Master Account", "AWS", "Aws Account");

	final DeploymentNode iamAccountNode = model.addDeploymentNode("IAM Account", "AWS", "Aws Account");
	final Container iamAccountContainer = ciaSystem.addContainer("IAM Account", "AWS", "Aws Account");
	
	final DeploymentNode devAccountNode = model.addDeploymentNode("Development Account", "AWS", "Aws Account");
	final Container devAccountContainer = ciaSystem.addContainer("Development Account", "AWS", "Aws Account");

	final DeploymentNode opCenterAccountNode = model.addDeploymentNode("Operation Center Account", "AWS", "Aws Account");
	final Container opCenterAccountContainer = ciaSystem.addContainer("Operation Center Account", "AWS", "Aws Account");

	final DeploymentNode auditAccountNode = model.addDeploymentNode("Audit Account", "AWS", "Aws Account");
	final Container auditAccountContainer = ciaSystem.addContainer("Audit Account", "AWS", "Aws Account");
	
	final DeploymentNode appAccountNode = model.addDeploymentNode("Application Account", "AWS", "Aws Account");
	final Container appAccountContainer = ciaSystem.addContainer("Application Account", "AWS", "Aws Account");
	
	awsAccountContainer.uses(iamAccountContainer, "create/restrict");
	awsAccountContainer.uses(devAccountContainer, "create/restrict");
	awsAccountContainer.uses(opCenterAccountContainer, "create/restrict");
	awsAccountContainer.uses(auditAccountContainer, "create/restrict");
	awsAccountContainer.uses(appAccountContainer, "create/restrict");
	
	awsAccountContainer.uses(auditAccountContainer, "publish event/audit");
	iamAccountContainer.uses(auditAccountContainer, "publish event/audit");
	devAccountContainer.uses(auditAccountContainer, "publish event/audit");
	opCenterAccountContainer.uses(auditAccountContainer, "publish event/audit");
	appAccountContainer.uses(auditAccountContainer, "publish event/audit");
	
	opCenterAccountContainer.uses(auditAccountContainer, "Monitor event/audit");
	
	iamAccountContainer.uses(devAccountContainer, "manage access");
	iamAccountContainer.uses(appAccountContainer, "manage access");
	iamAccountContainer.uses(opCenterAccountContainer, "manage access");

	opCenterAccountNode.add(opCenterAccountContainer);
	devAccountNode.add(devAccountContainer);
	auditAccountNode.add(auditAccountContainer);
	appAccountNode.add(appAccountContainer);
	iamAccountNode.add(iamAccountContainer);
	masterAccountNode.add(awsAccountContainer);
	
	final DeploymentView developmentDeploymentView = viewSet.createDeploymentView(ciaSystem, "\"Production Aws Account structure\"",
			"\"Production Aws Account structure\"");

	developmentDeploymentView.add(masterAccountNode);
	developmentDeploymentView.add(iamAccountNode);
	developmentDeploymentView.add(devAccountNode);
	developmentDeploymentView.add(opCenterAccountNode);
	developmentDeploymentView.add(auditAccountNode);
	developmentDeploymentView.add(appAccountNode);		
	

	final Styles styles = viewSet.getConfiguration().getStyles();
	styles.addElementStyle(Tags.COMPONENT).background("#1168bd").color("#ffffff");
	styles.addElementStyle(Tags.CONTAINER).background("#1168bd").color("#ffffff");
	styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
	styles.addElementStyle(Tags.PERSON).background("#519823").color("#ffffff").shape(Shape.Person);
	styles.addElementStyle("Database").shape(Shape.Cylinder);

	printPlantUml(workspace);
	System.setProperty("PLANTUML_LIMIT_SIZE", "8192");
	Run.main(new String[] { Paths.get(".").toAbsolutePath().normalize().toString() + File.separator + "target"
			+ File.separator + "site" + File.separator + "architecture" + File.separator });
}
 
Example #24
Source File: ViewCreator.java    From architecture-guild with Apache License 2.0 4 votes vote down vote up
private static void setupStyles(ViewSet views) {
    Styles styles = views.getConfiguration().getStyles();
    styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff");
    styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person);
}