com.structurizr.view.ContainerView Java Examples

The following examples show how to use com.structurizr.view.ContainerView. 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: StructurizrSimple.java    From tutorials with MIT License 6 votes vote down vote up
private static void addContainers(Workspace workspace) {
    Model model = workspace.getModel();

    SoftwareSystem paymentTerminal = model.getSoftwareSystemWithName(PAYMENT_TERMINAL);
    Container f5 = paymentTerminal.addContainer("Payment Load Balancer", "Payment Load Balancer", "F5");
    Container jvm1 = paymentTerminal.addContainer("JVM-1", "JVM-1", "Java Virtual Machine");
    Container jvm2 = paymentTerminal.addContainer("JVM-2", "JVM-2", "Java Virtual Machine");
    Container jvm3 = paymentTerminal.addContainer("JVM-3", "JVM-3", "Java Virtual Machine");
    Container oracle = paymentTerminal.addContainer("oracleDB", "Oracle Database", "RDBMS");

    f5.uses(jvm1, "route");
    f5.uses(jvm2, "route");
    f5.uses(jvm3, "route");

    jvm1.uses(oracle, "storage");
    jvm2.uses(oracle, "storage");
    jvm3.uses(oracle, "storage");

    ContainerView view = workspace.getViews().createContainerView(paymentTerminal, CONTAINER_VIEW, "Container View");
    view.addAllContainers();
}
 
Example #2
Source File: StylingElements.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("Styling Elements", "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.");
        Container webApplication = softwareSystem.addContainer("Web Application", "My web application.", "Java and Spring MVC");
        Container database = softwareSystem.addContainer("Database", "My database.", "Relational database schema");
        user.uses(webApplication, "Uses", "HTTPS");
        webApplication.uses(database, "Reads from and writes to", "JDBC");

        ViewSet views = workspace.getViews();
        ContainerView containerView = views.createContainerView(softwareSystem, "containers", "An example of a container diagram.");
        containerView.addAllElements();

        Styles styles = workspace.getViews().getConfiguration().getStyles();

        // example 1
//        styles.addElementStyle(Tags.ELEMENT).background("#438dd5").color("#ffffff");

        // example 2
//        styles.addElementStyle(Tags.ELEMENT).color("#ffffff");
//        styles.addElementStyle(Tags.PERSON).background("#08427b");
//        styles.addElementStyle(Tags.CONTAINER).background("#438dd5");

        // example 3
//        styles.addElementStyle(Tags.ELEMENT).color("#ffffff");
//        styles.addElementStyle(Tags.PERSON).background("#08427b").shape(Shape.Person);
//        styles.addElementStyle(Tags.CONTAINER).background("#438dd5");
//        database.addTags("Database");
//        styles.addElementStyle("Database").shape(Shape.Cylinder);

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example #3
Source File: StylingRelationships.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("Styling Relationships", "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.");
        Container webApplication = softwareSystem.addContainer("Web Application", "My web application.", "Java and Spring MVC");
        Container database = softwareSystem.addContainer("Database", "My database.", "Relational database schema");
        user.uses(webApplication, "Uses", "HTTPS");
        webApplication.uses(database, "Reads from and writes to", "JDBC");

        ViewSet views = workspace.getViews();
        ContainerView containerView = views.createContainerView(softwareSystem, "containers", "An example of a container diagram.");
        containerView.addAllElements();

        Styles styles = workspace.getViews().getConfiguration().getStyles();

        // example 1
//        styles.addRelationshipStyle(Tags.RELATIONSHIP).color("#ff0000");

        // example 2
//        model.getRelationships().stream().filter(r -> "HTTPS".equals(r.getTechnology())).forEach(r -> r.addTags("HTTPS"));
//        model.getRelationships().stream().filter(r -> "JDBC".equals(r.getTechnology())).forEach(r -> r.addTags("JDBC"));
//        styles.addRelationshipStyle("HTTPS").color("#ff0000");
//        styles.addRelationshipStyle("JDBC").color("#0000ff");

        StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET);
        structurizrClient.putWorkspace(WORKSPACE_ID, workspace);
    }
 
Example #4
Source File: WebShop.java    From structurizr-extensions with Apache License 2.0 4 votes vote down vote up
@Override
public void createViews(@Nonnull ViewSet viewSet) {
    final ContainerView containerView = viewSet.createContainerView(webShop, "webshop", "WebShop");
    containerView.addAllElements();
}