styles.addElementStyle(Tags.ELEMENT).color("#ffffff").background("#438dd5").fontSize(34).width(650).height(400); 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(Tags.PERSON).shape(Shape.Person);
styles.addElementStyle(Tags.PERSON).shape(Shape.Person);
styles.addElementStyle(Tags.ELEMENT).color("#ffffff"); styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#1168bd"); styles.addElementStyle(Tags.CONTAINER).background("#438dd5"); styles.addElementStyle(Tags.COMPONENT).background("#85bbf0").color("#000000"); styles.addElementStyle(Tags.PERSON).background("#08427b").shape(Shape.Person); styles.addElementStyle(DATABASE_TAG).shape(Shape.Cylinder);
styles.addElementStyle(Tags.PERSON).shape(Shape.Person);
public static void main(String[] args) throws Exception { Workspace workspace = new Workspace("Getting Started", "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.SOFTWARE_SYSTEM).background("#1168bd").color("#ffffff"); styles.addElementStyle(Tags.PERSON).background("#08427b").color("#ffffff").shape(Shape.Person); PlantUMLWriter plantUMLWriter = new PlantUMLWriter(); // if you're using dark background colours, you might need to explicitly set the foreground colour using skin params // e.g. rectangleFontColor, rectangleFontColor<<Software System>>, etc plantUMLWriter.addSkinParam("rectangleFontColor", "#ffffff"); plantUMLWriter.addSkinParam("rectangleStereotypeFontColor", "#ffffff"); // write to a specific writer StringWriter stringWriter = new StringWriter(); plantUMLWriter.write(workspace, stringWriter); System.out.println(stringWriter.toString()); // or just output directly to stdout // plantUMLWriter.toStdOut(workspace); }
styles.addElementStyle(Tags.ELEMENT).shape(Shape.RoundedBox).color("#ffffff"); styles.addElementStyle(Tags.SOFTWARE_SYSTEM).background("#18ADAD").color("#ffffff"); styles.addElementStyle(Tags.PERSON).shape(Shape.Person).background("#008282").color("#ffffff"); styles.addElementStyle(Tags.CONTAINER).background("#6DBFBF"); styles.addElementStyle(FILE_SYSTEM_TAG).shape(Shape.Folder);
template.addContextSection(fulfilmentSystem, Format.Markdown, "This is the context section for the Fulfilment System... ![](embed:FulfilmentSystemContext)"); styles.addElementStyle(Tags.SOFTWARE_SYSTEM).shape(Shape.RoundedBox); styles.addElementStyle(Tags.PERSON).shape(Shape.Person); styles.addElementStyle(Tags.ELEMENT).color("#ffffff"); styles.addElementStyle(EXTERNAL_TAG).background("#EC5381").border(Border.Dashed); styles.addElementStyle(INTERNAL_TAG).background("#B60037");
@Test public void test_writeView_IncludesStyling_WhenStylesAreAdded() throws Exception { workspace = new Workspace("", ""); SoftwareSystem softwareSystem = workspace.getModel().addSoftwareSystem("My software system", ""); Person user = workspace.getModel().addPerson("A user", ""); user.uses(softwareSystem, "Uses"); workspace.getViews().createSystemContextView(softwareSystem, "key", "").addAllElements(); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000"); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.PERSON).background("#00ff00"); workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(Tags.RELATIONSHIP).color("#0000ff"); plantUMLWriter.write(workspace, stringWriter); assertEquals("@startuml(id=key)" + System.lineSeparator() + "scale max 1999x1999" + System.lineSeparator() + "title My software system - System Context" + System.lineSeparator() + "" + System.lineSeparator() + "skinparam {" + System.lineSeparator() + " shadowing false" + System.lineSeparator() + " arrowColor #707070" + System.lineSeparator() + " actorBorderColor #707070" + System.lineSeparator() + " componentBorderColor #707070" + System.lineSeparator() + " rectangleBorderColor #707070" + System.lineSeparator() + " noteBackgroundColor #ffffff" + System.lineSeparator() + " noteBorderColor #707070" + System.lineSeparator() + "}" + System.lineSeparator() + "rectangle \"A user\" <<Person>> as 2 #00ff00" + System.lineSeparator() + "rectangle \"My software system\" <<Software System>> as 1 #ff0000" + System.lineSeparator() + "2 .[#0000ff].> 1 : Uses" + System.lineSeparator() + "@enduml" + System.lineSeparator(), stringWriter.toString()); }
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); }
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); }
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); }
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); }
user.uses(softwareSystem, "Uses"); workspace.getViews().createSystemContextView(softwareSystem, "thekey", "").addAllElements(); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.SOFTWARE_SYSTEM).background("#ff0000"); workspace.getViews().getConfiguration().getStyles().addElementStyle(Tags.PERSON).background("#00ff00"); workspace.getViews().getConfiguration().getStyles().addRelationshipStyle(Tags.RELATIONSHIP).color("#0000ff");
@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").shape(Shape.RoundedBox); ElementStyle style = styles.findElementStyle(element); assertEquals("#ff0000", style.getBackground()); assertEquals("#0000ff", style.getColor()); assertEquals(Shape.RoundedBox, style.getShape()); }
financialRiskSystem.addTags("Risk System"); styles.addElementStyle(Tags.ELEMENT).color("#ffffff").fontSize(34); styles.addElementStyle("Risk System").background("#550000").color("#ffffff"); styles.addElementStyle(Tags.SOFTWARE_SYSTEM).width(650).height(400).background("#801515").shape(Shape.RoundedBox); styles.addElementStyle(Tags.PERSON).width(550).background("#d46a6a").shape(Shape.Person); styles.addRelationshipStyle(TAG_ALERT).color("#ff0000"); styles.addElementStyle("Future State").opacity(30).border(Border.Dashed); styles.addRelationshipStyle("Future State").opacity(30).dashed(true);
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); }
public static void main(String[] args) throws Exception { Workspace workspace = new Workspace("HTTP-based health checks example", "An example of how to use the HTTP-based health checks feature"); Model model = workspace.getModel(); ViewSet views = workspace.getViews(); SoftwareSystem structurizr = model.addSoftwareSystem("Structurizr", "A publishing platform for software architecture diagrams and documentation based upon the C4 model."); Container webApplication = structurizr.addContainer("structurizr.com", "Provides all of the server-side functionality of Structurizr, serving static and dynamic content to users.", "Java and Spring MVC"); Container database = structurizr.addContainer("Database", "Stores information about users, workspaces, etc.", "Relational Database Schema"); database.addTags(DATABASE_TAG); webApplication.uses(database, "Reads from and writes to", "JDBC"); DeploymentNode amazonWebServices = model.addDeploymentNode("Amazon Web Services", "", "us-east-1"); DeploymentNode pivotalWebServices = amazonWebServices.addDeploymentNode("Pivotal Web Services", "Platform as a Service provider.", "Cloud Foundry"); ContainerInstance liveWebApplication = pivotalWebServices.addDeploymentNode("www.structurizr.com", "An open source Java EE web server.", "Apache Tomcat") .add(webApplication); ContainerInstance liveDatabaseInstance = amazonWebServices.addDeploymentNode("Amazon RDS", "Database as a Service provider.", "MySQL") .add(database); // add health checks to the container instances, which return a simple HTTP 200 to say everything is okay liveWebApplication.addHealthCheck("Web Application is running", "https://www.structurizr.com/health"); liveDatabaseInstance.addHealthCheck("Database is accessible from Web Application", "https://www.structurizr.com/health/database"); // the pass/fail status from the health checks is used to supplement any deployment views that include the container instances that have health checks defined DeploymentView deploymentView = views.createDeploymentView(structurizr, "Deployment", "A deployment diagram showing the live environment."); deploymentView.setEnvironment("Live"); deploymentView.addAllDeploymentNodes(); views.getConfiguration().getStyles().addElementStyle(Tags.ELEMENT).color("#ffffff"); views.getConfiguration().getStyles().addElementStyle(DATABASE_TAG).shape(Shape.Cylinder); StructurizrClient structurizrClient = new StructurizrClient(API_KEY, API_SECRET); structurizrClient.putWorkspace(WORKSPACE_ID, workspace); }
styles.addElementStyle(Tags.ELEMENT).color("#000000"); styles.addElementStyle(Tags.PERSON).background("#ffbf00").shape(Shape.Person); styles.addElementStyle(Tags.CONTAINER).background("#facc2E"); styles.addElementStyle(MESSAGE_BUS_TAG).width(1600).shape(Shape.Pipe); styles.addElementStyle(MICROSERVICE_TAG).shape(Shape.Hexagon); styles.addElementStyle(DATASTORE_TAG).background("#f5da81").shape(Shape.Cylinder); styles.addRelationshipStyle(Tags.RELATIONSHIP).routing(Routing.Orthogonal);
styles.addElementStyle(DATA_STORE_TAG).shape(Shape.Cylinder);