Package com.structurizr.model
Class Model
java.lang.Object
com.structurizr.model.Model
Represents a software architecture model, into which all model elements are added.
-
Method Summary
Modifier and TypeMethodDescriptionaddCustomElement
(String name) Creates a custom element and adds it to the model.addCustomElement
(String name, String metadata, String description) Creates a custom element and adds it to the model.addDeploymentNode
(String name) Adds a top-level deployment node to this model.addDeploymentNode
(String name, String description, String technology) Adds a top-level deployment node to this model.addDeploymentNode
(String name, String description, String technology, int instances) Adds a top-level deployment node to this model.addDeploymentNode
(String name, String description, String technology, int instances, Map<String, String> properties) Adds a top-level deployment node to this model.addDeploymentNode
(String environment, String name, String description, String technology) Adds a top-level deployment node to this model.addDeploymentNode
(String environment, String name, String description, String technology, int instances) Adds a top-level deployment node to this model.addDeploymentNode
(String environment, String name, String description, String technology, int instances, Map<String, String> properties) Adds a top-level deployment node to this model.Creates a person and adds it to the model.Creates a person (with an unspecified location) and adds it to the model.Creates a person (with an unspecified location) and adds it to the model.addSoftwareSystem
(Location location, String name, String description) Creates a software system and adds it to the model.addSoftwareSystem
(String name) Creates a software system (with an unspecified location) and adds it to the model.addSoftwareSystem
(String name, String description) Creates a software system (with an unspecified location) and adds it to the model.boolean
Determines whether this model contains the specified element.Gets the set of all custom elements in this model.Gets the custom element with the specified name.Gets the set of all top-level deployment nodes in this model.Gets the deployment node with the specified name and default environment.getDeploymentNodeWithName
(String name, String environment) Gets the deployment node with the specified name and environment.getElement
(String id) Gets the element with the specified ID.Gets the set of all elements in this model.getElementWithCanonicalName
(String canonicalName) Gets the element with the specified canonical name.Gets the enterprise associated with this model.Gets the strategy in use for creating implied relationships.Gets the set of all people in this model.getPersonWithName
(String name) Gets the person with the specified name.Gets the relationship with the specified ID.Gets the set of all relationships in this model.Gets the set of all software systems in this model.Gets the software system with the specified ID.Gets the software system with the specified name.boolean
isEmpty()
Determines whether this model is empty.void
modifyRelationship
(Relationship relationship, String description, String technology) Provides a way for the description and technology to be modified on an existing relationship.void
setEnterprise
(Enterprise enterprise) Sets the enterprise associated with this model.void
setIdGenerator
(IdGenerator idGenerator) Sets the ID generator associated with this model.void
setImpliedRelationshipsStrategy
(ImpliedRelationshipsStrategy impliedRelationshipStrategy) Sets the strategy is use for creating implied relationships.
-
Method Details
-
getEnterprise
Gets the enterprise associated with this model.- Returns:
- an Enterprise instance, or null if one has not been set
-
setEnterprise
Sets the enterprise associated with this model.- Parameters:
enterprise
- an Enterprise instance
-
addSoftwareSystem
Creates a software system (with an unspecified location) and adds it to the model.- Parameters:
name
- the name of the software system- Returns:
- the SoftwareSystem instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a software system with the same name already exists
-
addSoftwareSystem
Creates a software system (with an unspecified location) and adds it to the model.- Parameters:
name
- the name of the software systemdescription
- a short description of the software system- Returns:
- the SoftwareSystem instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a software system with the same name already exists
-
addSoftwareSystem
@Nonnull public SoftwareSystem addSoftwareSystem(@Nullable Location location, @Nonnull String name, @Nullable String description) Creates a software system and adds it to the model.- Parameters:
location
- the location of the software system (e.g. internal, external, etc)name
- the name of the software systemdescription
- a short description of the software system- Returns:
- the SoftwareSystem instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a software system with the same name already exists
-
addPerson
Creates a person (with an unspecified location) and adds it to the model.- Parameters:
name
- the name of the person (e.g. "Admin User" or "Bob the Business User")- Returns:
- the Person instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a person with the same name already exists
-
addPerson
Creates a person (with an unspecified location) and adds it to the model.- Parameters:
name
- the name of the person (e.g. "Admin User" or "Bob the Business User")description
- a short description of the person- Returns:
- the Person instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a person with the same name already exists
-
addPerson
@Nonnull public Person addPerson(Location location, @Nonnull String name, @Nullable String description) Creates a person and adds it to the model.- Parameters:
location
- the location of the person (e.g. internal, external, etc)name
- the name of the person (e.g. "Admin User" or "Bob the Business User")description
- a short description of the person- Returns:
- the Person instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a person with the same name already exists
-
addCustomElement
Creates a custom element and adds it to the model.- Parameters:
name
- the name of the custom element- Returns:
- the CustomElement instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a custom element/person/software system with the same name already exists
-
addCustomElement
@Nonnull public CustomElement addCustomElement(@Nonnull String name, @Nullable String metadata, @Nullable String description) Creates a custom element and adds it to the model.- Parameters:
name
- the name of the custom elementdescription
- a short description of the custom elementmetadata
- the metadata of the custom element- Returns:
- the CustomElement instance created and added to the model (or null)
- Throws:
IllegalArgumentException
- if a custom element/person/software system with the same name already exists
-
getElements
Gets the set of all elements in this model.- Returns:
- a Set of Element instances
-
getElement
Gets the element with the specified ID.- Parameters:
id
- theModelItem.getId()
of the element- Returns:
- the element in this model with the specified ID (or null if it doesn't exist)
- See Also:
-
getRelationships
Gets the set of all relationships in this model.- Returns:
- a Set of Relationship objects
-
getRelationship
Gets the relationship with the specified ID.- Parameters:
id
- theModelItem.getId()
of the relationship- Returns:
- the relationship in this model with the specified ID (or null if it doesn't exist).
- See Also:
-
getCustomElements
Gets the set of all custom elements in this model.- Returns:
- a Set of CustomElement instances
-
getPeople
Gets the set of all people in this model.- Returns:
- a Set of Person instances
-
getSoftwareSystems
Gets the set of all software systems in this model.- Returns:
- a Set of SoftwareSystem instances
-
getDeploymentNodes
Gets the set of all top-level deployment nodes in this model.- Returns:
- a Set of DeploymentNode instances
-
contains
Determines whether this model contains the specified element.- Parameters:
element
- any element- Returns:
- true, if the element is contained in this model
-
getSoftwareSystemWithName
Gets the software system with the specified name.- Parameters:
name
- the name of aSoftwareSystem
- Returns:
- the SoftwareSystem instance with the specified name (or null if it doesn't exist)
- Throws:
IllegalArgumentException
- if the name is null or empty
-
getSoftwareSystemWithId
Gets the software system with the specified ID.- Parameters:
id
- theModelItem.getId()
of the software system- Returns:
- the SoftwareSystem instance with the specified ID (or null if it doesn't exist).
- Throws:
IllegalArgumentException
- if the id is null or empty- See Also:
-
getPersonWithName
Gets the person with the specified name.- Parameters:
name
- the name of the person- Returns:
- the Person instance with the specified name (or null if it doesn't exist)
- Throws:
IllegalArgumentException
- if the name is null or empty
-
getCustomElementWithName
Gets the custom element with the specified name.- Parameters:
name
- the name of the custom element- Returns:
- the CustomElement instance with the specified name (or null if it doesn't exist)
- Throws:
IllegalArgumentException
- if the name is null or empty
-
isEmpty
public boolean isEmpty()Determines whether this model is empty.- Returns:
- true if the model contains no people, software systems or deployment nodes; false otherwise
-
addDeploymentNode
Adds a top-level deployment node to this model.- Parameters:
name
- the name of the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nonnull String name, @Nullable String description, @Nullable String technology) Adds a top-level deployment node to this model.- Parameters:
name
- the name of the deployment nodedescription
- the description of the deployment nodetechnology
- the technology associated with the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nullable String environment, @Nonnull String name, @Nullable String description, @Nullable String technology) Adds a top-level deployment node to this model.- Parameters:
environment
- the name of the deployment environmentname
- the name of the deployment nodedescription
- the description of the deployment nodetechnology
- the technology associated with the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nonnull String name, @Nullable String description, @Nullable String technology, int instances) Adds a top-level deployment node to this model.- Parameters:
name
- the name of the deployment nodedescription
- the description of the deployment nodetechnology
- the technology associated with the deployment nodeinstances
- the number of instances of the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nullable String environment, @Nonnull String name, @Nullable String description, @Nullable String technology, int instances) Adds a top-level deployment node to this model.- Parameters:
environment
- the name of the deployment environmentname
- the name of the deployment nodedescription
- the description of the deployment nodetechnology
- the technology associated with the deployment nodeinstances
- the number of instances of the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nonnull String name, String description, String technology, int instances, Map<String, String> properties) Adds a top-level deployment node to this model.- Parameters:
name
- the name of the deployment nodedescription
- the description of the deployment nodetechnology
- the technology associated with the deployment nodeinstances
- the number of instances of the deployment nodeproperties
- a map of name/value properties associated with the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
addDeploymentNode
@Nonnull public DeploymentNode addDeploymentNode(@Nullable String environment, @Nonnull String name, String description, String technology, int instances, Map<String, String> properties) Adds a top-level deployment node to this model.- Parameters:
environment
- the name of the deployment environmentname
- the name of the deployment nodedescription
- the description of the deployment nodetechnology
- the technology associated with the deployment nodeinstances
- the number of instances of the deployment nodeproperties
- a map of name/value properties associated with the deployment node- Returns:
- a DeploymentNode instance
- Throws:
IllegalArgumentException
- if the name is not specified, or a top-level deployment node with the same name already exists in the model
-
getDeploymentNodeWithName
Gets the deployment node with the specified name and default environment.- Parameters:
name
- the name of the deployment node- Returns:
- the DeploymentNode instance with the specified name (or null if it doesn't exist).
-
getDeploymentNodeWithName
Gets the deployment node with the specified name and environment.- Parameters:
name
- the name of the deployment nodeenvironment
- the name of the deployment environment- Returns:
- the DeploymentNode instance with the specified name (or null if it doesn't exist).
-
getElementWithCanonicalName
Gets the element with the specified canonical name.- Parameters:
canonicalName
- the canonical name (e.g. /SoftwareSystem/Container)- Returns:
- the Element with the given canonical name, or null if one doesn't exist
- Throws:
IllegalArgumentException
- if the canonical name is null or empty
-
setIdGenerator
Sets the ID generator associated with this model.- Parameters:
idGenerator
- an IdGenerate instance- Throws:
IllegalArgumentException
- if the ID generator is null
-
modifyRelationship
Provides a way for the description and technology to be modified on an existing relationship.- Parameters:
relationship
- a Relationship instancedescription
- the new descriptiontechnology
- the new technology
-
getImpliedRelationshipsStrategy
Gets the strategy in use for creating implied relationships.- Returns:
- an ImpliedRelationshipStrategy implementation
-
setImpliedRelationshipsStrategy
public void setImpliedRelationshipsStrategy(ImpliedRelationshipsStrategy impliedRelationshipStrategy) Sets the strategy is use for creating implied relationships.- Parameters:
impliedRelationshipStrategy
- an ImpliedRelationshipStrategy implementation
-