Package com.structurizr.model
Class SoftwareSystem
java.lang.Object
com.structurizr.model.Element
com.structurizr.model.StaticStructureElement
com.structurizr.model.SoftwareSystem
public final class SoftwareSystem extends StaticStructureElement
Represents a "software system" in the C4 model.
-
Method Summary
Modifier and Type Method Description Container
addContainer(java.lang.String name, java.lang.String description, java.lang.String technology)
Adds a container with the specified name, description and technologyPerspective
addPerspective(java.lang.String name, java.lang.String description)
Adds a perspective to this model item.void
addProperty(java.lang.String name, java.lang.String value)
Adds a name-value pair property to this element.void
addTags(java.lang.String... tags)
java.lang.String
getCanonicalName()
Gets the canonical name of this software system, in the form "/Software System".java.util.Set<Container>
getContainers()
Gets the set of containers within this software system.Container
getContainerWithId(java.lang.String id)
Gets the container with the specified ID.Container
getContainerWithName(java.lang.String name)
Gets the container with the specified name.java.lang.String
getId()
Gets the ID of this item in the model.Location
getLocation()
Gets the location of this software system.java.lang.String
getOriginId()
Element
getParent()
Gets the parent of this software system.java.util.Set<Perspective>
getPerspectives()
Gets the set of perspectives associated with this model item.java.util.Map<java.lang.String,java.lang.String>
getProperties()
Gets the collection of name-value property pairs associated with this element, as a Map.protected java.util.Set<java.lang.String>
getRequiredTags()
java.lang.String
getTags()
Gets the comma separated list of tags.java.util.Set<java.lang.String>
getTagsAsSet()
boolean
hasTag(java.lang.String tag)
Determines whether this model item has the given tag.boolean
removeTag(java.lang.String tag)
Removes the given tag.void
setLocation(Location location)
Sets the location of this software system.Methods inherited from class com.structurizr.model.StaticStructureElement
delivers, delivers, delivers, uses, uses, uses, uses, uses, uses, uses, uses, uses, uses, uses
Methods inherited from class com.structurizr.model.Element
getDescription, getEfferentRelationshipsWith, getEfferentRelationshipWith, getEfferentRelationshipWith, getModel, getName, getRelationships, getUrl, hasAfferentRelationships, hasEfferentRelationshipWith, hasEfferentRelationshipWith, setDescription, setModel, setUrl, toString
-
Method Details
-
getParent
Gets the parent of this software system. -
getLocation
Gets the location of this software system.- Returns:
- a Location instance
-
setLocation
Sets the location of this software system.- Parameters:
location
- a Location instance
-
getContainers
Gets the set of containers within this software system.- Returns:
- a Set of Container objects
-
addContainer
@Nonnull public Container addContainer(@Nonnull java.lang.String name, java.lang.String description, java.lang.String technology)Adds a container with the specified name, description and technology- Parameters:
name
- the name of the container (e.g. "Web Application")description
- a short description/list of responsibilitiestechnology
- the technology choice (e.g. "Spring MVC", "Java EE", etc)- Returns:
- the newly created Container instance added to the model (or null)
- Throws:
java.lang.IllegalArgumentException
- if a container with the same name exists already
-
getContainerWithName
Gets the container with the specified name.- Parameters:
name
- the name of theContainer
- Returns:
- the Container instance with the specified name, or null if it doesn't exist
- Throws:
java.lang.IllegalArgumentException
- if the name is null or empty
-
getContainerWithId
Gets the container with the specified ID.- Parameters:
id
- theModelItem.getId()
of the container- Returns:
- the Container instance with the specified ID, or null if it doesn't exist
- Throws:
java.lang.IllegalArgumentException
- if the ID is null or empty
-
getCanonicalName
public java.lang.String getCanonicalName()Gets the canonical name of this software system, in the form "/Software System".- Specified by:
getCanonicalName
in classElement
- Returns:
- the canonical name, as a String
-
getRequiredTags
protected java.util.Set<java.lang.String> getRequiredTags() -
getId
public java.lang.String getId()Gets the ID of this item in the model.- Returns:
- the ID, as a String
-
getOriginId
public java.lang.String getOriginId() -
getTags
public java.lang.String getTags()Gets the comma separated list of tags.- Returns:
- a comma separated list of tags, or an empty string if there are no tags
-
getTagsAsSet
public java.util.Set<java.lang.String> getTagsAsSet() -
addTags
public void addTags(java.lang.String... tags) -
removeTag
public boolean removeTag(java.lang.String tag)Removes the given tag.- Parameters:
tag
- the tag to remove- Returns:
- true if the tag was removed; will return false if a non-existent tag is passed, or if an attempt is made to remove required tags, which cannot be removed.
-
hasTag
public boolean hasTag(java.lang.String tag)Determines whether this model item has the given tag.- Parameters:
tag
- the tag to check for- Returns:
- true if tag is present as a tag on this item, or if it is one of the required tags defined by the model in getRequiredTags(), false otherwise
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()Gets the collection of name-value property pairs associated with this element, as a Map.- Returns:
- a Map (String, String) (empty if there are no properties)
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)Adds a name-value pair property to this element.- Parameters:
name
- the name of the propertyvalue
- the value of the property
-
getPerspectives
Gets the set of perspectives associated with this model item.- Returns:
- a Set of Perspective objects (empty if there are none)
-
addPerspective
Adds a perspective to this model item.- Parameters:
name
- the name of the perspective (e.g. "Security", must be unique)description
- a description of the perspective- Returns:
- a Perspective object
- Throws:
java.lang.IllegalArgumentException
- if perspective details are not specified, or the named perspective exists already
-