Created
June 19, 2015 11:52
-
-
Save simonbrowndotje/45c1c69f7e2f8a5e7ea7 to your computer and use it in GitHub Desktop.
Furniture example, with colour coding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.structurizr.example.core; | |
import com.structurizr.Workspace; | |
import com.structurizr.api.StructurizrClient; | |
import com.structurizr.model.Model; | |
import com.structurizr.model.Person; | |
import com.structurizr.model.SoftwareSystem; | |
import com.structurizr.model.Tags; | |
import com.structurizr.view.*; | |
public class FurnitureCompany { | |
private static final String TO_BE_MODIFIED = "To be modified"; | |
private static final String TO_BE_REMOVED = "To be removed"; | |
public static void main(String[] args) throws Exception { | |
Workspace workspace = new Workspace("Furniture Company", "A simple model for a company selling furniture."); | |
Model model = workspace.getModel(); | |
Person salesStaff = model.addPerson("Sales Staff", ""); | |
Person designer = model.addPerson("Designer", ""); | |
Person warehouseStaff = model.addPerson("Warehouse Staff", ""); | |
SoftwareSystem salesOrderbook = model.addSoftwareSystem("Sales Orderbook", ""); | |
SoftwareSystem productCatalogue = model.addSoftwareSystem("Product Catalogue", ""); | |
SoftwareSystem warehouseManagement = model.addSoftwareSystem("Warehouse Management", ""); | |
SoftwareSystem manufacturer = model.addSoftwareSystem("Manufacturer", ""); | |
salesStaff.uses(salesOrderbook, "Maintains orders for customers"); | |
designer.uses(salesOrderbook, "Examines orders").addTags(TO_BE_REMOVED); | |
designer.uses(productCatalogue, "Modifies products").addTags(TO_BE_MODIFIED); | |
productCatalogue.uses(salesOrderbook, "Product updates").addTags(TO_BE_MODIFIED); | |
salesOrderbook.uses(warehouseManagement, "Orders and products").addTags(TO_BE_MODIFIED); | |
warehouseManagement.uses(manufacturer, "Product to be manufactured"); | |
warehouseManagement.delivers(warehouseStaff, "Delivery orders"); | |
ViewSet viewSet = workspace.getViews(); | |
SystemContextView systemContextView = viewSet.createContextView(salesOrderbook); | |
systemContextView.addAllElements(); | |
viewSet.getConfiguration().getStyles().add(new ElementStyle(Tags.PERSON, 400, null, null, null, null, Shape.Person)); | |
viewSet.getConfiguration().getStyles().add(new ElementStyle(Tags.SOFTWARE_SYSTEM, null, null, null, null, null, Shape.Box)); | |
viewSet.getConfiguration().getStyles().add(new RelationshipStyle(TO_BE_MODIFIED, null, "#0000ff", null, null, null)); | |
viewSet.getConfiguration().getStyles().add(new RelationshipStyle(TO_BE_REMOVED, null, "#ff0000", null, null, null)); | |
StructurizrClient structurizrClient = new StructurizrClient("https://api.structurizr.com", "key", "secret"); | |
structurizrClient.mergeWorkspace(1234, workspace); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment