mirror of
https://github.com/plantuml-stdlib/C4-PlantUML.git
synced 2022-10-18 01:14:54 +00:00
Merge branch 'feature/110' of https://github.com/kirchsth/C4-PlantUML into master
This commit is contained in:
@@ -19,7 +19,7 @@ jobs:
|
||||
- name: Process diagrams
|
||||
uses: Timmy/plantuml-action@v1
|
||||
with:
|
||||
args: '-v percy -o _parsed'
|
||||
args: '-v percy -o _parsed -DRELATIVE_INCLUDE="."'
|
||||
- name: Upload
|
||||
run: npx percy upload percy/_parsed
|
||||
env:
|
||||
|
||||
@@ -4,8 +4,15 @@
|
||||
' ##################################
|
||||
|
||||
!global $ELEMENT_FONT_COLOR = "#FFFFFF"
|
||||
|
||||
!global $ARROW_COLOR = "#666666"
|
||||
|
||||
!global $BOUNDARY_COLOR = "#444444"
|
||||
|
||||
!global $LEGEND_FONT_COLOR = "#FFFFFF"
|
||||
!global $LEGEND_TITLE_COLOR = "#000000"
|
||||
!global $LEGEND_UNDEFINED_BK_COLOR = "#87AECA"
|
||||
!global $LEGEND_UNDEFINED_FONT_COLOR = "#B7DEFA"
|
||||
|
||||
' Styling
|
||||
' ##################################
|
||||
@@ -37,19 +44,228 @@ skinparam queue {
|
||||
}
|
||||
|
||||
skinparam Arrow {
|
||||
Color #666666
|
||||
FontColor #666666
|
||||
Color $ARROW_COLOR
|
||||
FontColor $ARROW_COLOR
|
||||
FontSize 12
|
||||
}
|
||||
|
||||
skinparam rectangle<<boundary>> {
|
||||
Shadowing false
|
||||
StereotypeFontSize 0
|
||||
FontColor #444444
|
||||
BorderColor #444444
|
||||
FontColor $BOUNDARY_COLOR
|
||||
BorderColor $BOUNDARY_COLOR
|
||||
BorderStyle dashed
|
||||
}
|
||||
|
||||
' Legend and Tags
|
||||
' ##################################
|
||||
!global $tagDefaultLegend = ""
|
||||
!global $tagCustomLegend = ""
|
||||
|
||||
!unquoted function $toStereos($elementType, $tags)
|
||||
!if (%strlen($tags) == 0)
|
||||
!$stereos = '<<' + $elementType + '>>'
|
||||
%set_variable_value("$" + $elementType + "Legend", %true())
|
||||
!return $stereos
|
||||
!endif
|
||||
!$stereos = ''
|
||||
!$brPos = %strpos($tags, "+")
|
||||
!while ($brPos >= 0)
|
||||
!$tag = %substr($tags, 0, $brPos)
|
||||
!$stereos = $stereos + '<<' + $tag + '>>'
|
||||
%set_variable_value("$" + $tag + "Legend", %true())
|
||||
!$tags = %substr($tags, $brPos+1)
|
||||
!$brPos = %strpos($tags, "+")
|
||||
!endwhile
|
||||
!if (%strlen($tags)>0)
|
||||
!$stereos = $stereos + '<<' + $tags + '>>'
|
||||
%set_variable_value("$" + $tags + "Legend", %true())
|
||||
!endif
|
||||
' has to be last, otherwise PlantUML overwrites all tag specific skinparams
|
||||
!$stereos = $stereos + '<<' + $elementType + '>>'
|
||||
%set_variable_value("$" + $elementType + "Legend", %true())
|
||||
!return $stereos
|
||||
!endfunction
|
||||
|
||||
!function $elementTagSkinparams($element, $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!$elementSkin = "skinparam " + $element +"<<" + $tagStereo + ">> {" + %newline()
|
||||
!if ($fontColor!="")
|
||||
!$elementSkin = $elementSkin + " StereotypeFontColor " + $fontColor + %newline()
|
||||
!$elementSkin = $elementSkin + " FontColor " + $fontColor + %newline()
|
||||
!endif
|
||||
!if ($bgColor!="")
|
||||
!$elementSkin = $elementSkin + " BackgroundColor " + $bgColor + %newline()
|
||||
!endif
|
||||
!if ($borderColor!="")
|
||||
!$elementSkin = $elementSkin + " BorderColor " + $borderColor+ %newline()
|
||||
!endif
|
||||
!if ($shadowing == "true")
|
||||
!$elementSkin = $elementSkin + " Shadowing<<" + $tagStereo + ">> " + "true" + %newline()
|
||||
!endif
|
||||
!if ($shadowing == "false")
|
||||
!$elementSkin = $elementSkin + " Shadowing<<" + $tagStereo + ">> " + "false" + %newline()
|
||||
!endif
|
||||
!$elementSkin = $elementSkin + "}" + %newline()
|
||||
!return $elementSkin
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure $defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!$tagSkin = $elementTagSkinparams("rectangle", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!$tagSkin = $tagSkin + $elementTagSkinparams("database", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!$tagSkin = $tagSkin + $elementTagSkinparams("queue", $tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
$tagSkin
|
||||
!endprocedure
|
||||
|
||||
!function $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!$tagEntry = "|"
|
||||
!if ($bgColor!="")
|
||||
!$bg = $bgColor
|
||||
!else
|
||||
!$bg = $LEGEND_UNDEFINED_BK_COLOR
|
||||
!endif
|
||||
' named colors have to start with # too
|
||||
!if (%substr($bg, 0, 1) != "#")
|
||||
!$bg = "#" + $bg
|
||||
!endif
|
||||
!$tagEntry = $tagEntry + "<" + $bg +">"
|
||||
' <U+25AF> ..white rectangle
|
||||
!if ($borderColor!="")
|
||||
!$tagEntry = $tagEntry + "<color:"+$borderColor+"> <U+25AF></color> "
|
||||
!else
|
||||
!$tagEntry = $tagEntry + "<color:"+$bg+"> <U+25AF></color> "
|
||||
!endif
|
||||
!if ($fontColor!="")
|
||||
!$tagEntry = $tagEntry + "<color:"+$fontColor+">"
|
||||
!else
|
||||
!$tagEntry = $tagEntry + "<color:"+$LEGEND_UNDEFINED_FONT_COLOR+">"
|
||||
!endif
|
||||
!$tagEntry = $tagEntry + " " + $tagStereo + " "
|
||||
!if ($shadowing == "true")
|
||||
!$tagEntry = $tagEntry + "(shadow) "
|
||||
!endif
|
||||
!if ($shadowing == "false")
|
||||
!$tagEntry = $tagEntry + "(no shadow) "
|
||||
!endif
|
||||
!if ($fontColor == "" && $bgColor == "")
|
||||
!$tagEntry = $tagEntry + "(no font, no back color) "
|
||||
!else
|
||||
!if ($fontColor == "")
|
||||
!$tagEntry = $tagEntry + "(no font color) "
|
||||
!endif
|
||||
!if ($bgColor == "")
|
||||
!$tagEntry = $tagEntry + "(no back color) "
|
||||
!endif
|
||||
!endif
|
||||
!$tagEntry = $tagEntry + "</color> "
|
||||
!$tagEntry = $tagEntry + "|"
|
||||
!return $tagEntry
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure $addTagToDynamicLegend($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="")
|
||||
!$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
%set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry)
|
||||
!$tagCustomLegend = $tagCustomLegend + $tagStereo + "\n"
|
||||
!endprocedure
|
||||
|
||||
!procedure $showActiveLegendEntries($allDefined)
|
||||
!$brPos = %strpos($allDefined, "\n")
|
||||
!while ($brPos >= 0)
|
||||
!$tagStereo = %substr($allDefined, 0, $brPos)
|
||||
!$allDefined = %substr($allDefined, $brPos+2)
|
||||
!$brPos = %strpos($allDefined, "\n")
|
||||
!if (%variable_exists("$" + $tagStereo + "Legend"))
|
||||
%get_variable_value("$" + $tagStereo + "LegendEntry")
|
||||
!endif
|
||||
!endwhile
|
||||
!if (%strlen($allDefined)>0)
|
||||
!$tagStereo = $allDefined
|
||||
!if (%variable_exists("$" + $tagStereo + "Legend"))
|
||||
%get_variable_value("$" + $tagStereo + "LegendEntry")
|
||||
!endif
|
||||
!endif
|
||||
!endprocedure
|
||||
|
||||
' used by new defined tags
|
||||
!unquoted procedure AddTagSupport($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="")
|
||||
$defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
$addTagToDynamicLegend($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!endprocedure
|
||||
|
||||
' used by existing elements like person, ...
|
||||
!unquoted procedure UpdateSkinparamsAndLegendEntry($tagStereo, $bgColor="", $fontColor="", $borderColor="", $shadowing="")
|
||||
$defineSkinparams($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
!$tagEntry = $tagLegendEntry($tagStereo, $bgColor, $fontColor, $borderColor, $shadowing)
|
||||
%set_variable_value("$" + $tagStereo + "LegendEntry", $tagEntry)
|
||||
!endprocedure
|
||||
|
||||
' tags/stereotypes have to be delimited with \n
|
||||
!unquoted procedure SetDefaultLegendEntries($tagStereoEntries)
|
||||
!$tagDefaultLegend = $tagStereoEntries
|
||||
!endprocedure
|
||||
|
||||
' Element properties
|
||||
' ##################################
|
||||
|
||||
' collect all defined properties as table rows
|
||||
!global $propTable = ""
|
||||
!global $propTableCaption = ""
|
||||
!global $propColCaption = "="
|
||||
|
||||
!unquoted function SetPropertyHeader($col1Name, $col2Name, $col3Name = "", $col4Name = "")
|
||||
!$propColCaption = ""
|
||||
!$propTableCaption = "|= " + $col1Name + " |= " + $col2Name + " |"
|
||||
!if ($col3Name != "")
|
||||
!$propTableCaption = $propTableCaption + "= " + $col3Name + " |"
|
||||
!endif
|
||||
!if ($col4Name != "")
|
||||
!$propTableCaption = $propTableCaption + "= " + $col4Name + " |"
|
||||
!endif
|
||||
!return ""
|
||||
!endfunction
|
||||
|
||||
!unquoted function WithoutPropertyHeader()
|
||||
!$propTableCaption = ""
|
||||
!$propColCaption = "="
|
||||
!return ""
|
||||
!endfunction
|
||||
|
||||
!unquoted function AddProperty($col1, $col2, $col3 = "", $col4 = "")
|
||||
!if ($propTable == "")
|
||||
!if ($propTableCaption != "")
|
||||
!$propTable = $propTableCaption + "\n"
|
||||
!endif
|
||||
!else
|
||||
!$propTable = $propTable + "\n"
|
||||
!endif
|
||||
!$propTable = $propTable + "| " + $col1 + " |" + $propColCaption + " " + $col2 + " |"
|
||||
!if ($col3 != "")
|
||||
!$propTable = $propTable + " " + $col3 + " |"
|
||||
!endif
|
||||
!if ($col4 != "")
|
||||
!$propTable = $propTable + " " + $col4 + " |"
|
||||
!endif
|
||||
!return ""
|
||||
!endfunction
|
||||
|
||||
!unquoted function $getProps($alignedNL = "\n")
|
||||
!if ($propTable != "")
|
||||
!$retTable = $alignedNL + $propTable
|
||||
!$propTable = ""
|
||||
!return $retTable
|
||||
!endif
|
||||
!return ""
|
||||
!endfunction
|
||||
|
||||
!unquoted function $getProps_L()
|
||||
!return $getProps("\l")
|
||||
!endfunction
|
||||
|
||||
!unquoted function $getProps_R()
|
||||
!return $getProps("\r")
|
||||
!endfunction
|
||||
|
||||
SetPropertyHeader("Property","Value")
|
||||
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
@@ -72,16 +288,34 @@ top to bottom direction
|
||||
left to right direction
|
||||
!endprocedure
|
||||
|
||||
' has to be last call in diagram
|
||||
!unquoted procedure SHOW_DYNAMIC_LEGEND($hideStereotype="true")
|
||||
!if ($hideStereotype=="true")
|
||||
hide stereotype
|
||||
!endif
|
||||
legend right
|
||||
|<color:$LEGEND_TITLE_COLOR>**Legend**</color> |
|
||||
$showActiveLegendEntries($tagDefaultLegend)
|
||||
$showActiveLegendEntries($tagCustomLegend)
|
||||
endlegend
|
||||
!endprocedure
|
||||
|
||||
' Boundaries
|
||||
' ##################################
|
||||
|
||||
!unquoted function Boundary($alias, $label)
|
||||
!return 'rectangle "=='+$label+'" <<boundary>> as '+$alias
|
||||
!endfunction
|
||||
!unquoted function Boundary($alias, $label, $type)
|
||||
!return 'rectangle "=='+$label+'\n<size:'+$TECHN_FONT_SIZE+'>['+$type+']</size>" <<boundary>> as '+$alias
|
||||
!function $getBoundary($label, $type)
|
||||
!if ($type == "")
|
||||
!return '==' + $label
|
||||
!endif
|
||||
!if (type != "")
|
||||
!return '==' + $label + '\n<size:' + $TECHN_FONT_SIZE + '>[' + $type + ']</size>'
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure Boundary($alias, $label, $type="", $tags="")
|
||||
rectangle "$getBoundary($label, $type)" $toStereos("boundary", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
' Relationship
|
||||
' ##################################
|
||||
|
||||
|
||||
+23
-56
@@ -1,6 +1,9 @@
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4_Container.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
!endif
|
||||
|
||||
' Scope: A single container.
|
||||
' Primary elements: Components within the container in scope.
|
||||
@@ -11,6 +14,7 @@
|
||||
' ##################################
|
||||
|
||||
!global $COMPONENT_FONT_COLOR = "#000000"
|
||||
|
||||
!global $COMPONENT_BG_COLOR = "#85BBF0"
|
||||
!global $COMPONENT_BORDER_COLOR = "#78A8D8"
|
||||
!global $EXTERNAL_COMPONENT_BG_COLOR = "#CCCCCC"
|
||||
@@ -19,51 +23,14 @@
|
||||
' Styling
|
||||
' ##################################
|
||||
|
||||
skinparam rectangle<<component>> {
|
||||
StereotypeFontColor $COMPONENT_FONT_COLOR
|
||||
FontColor $COMPONENT_FONT_COLOR
|
||||
BackgroundColor $COMPONENT_BG_COLOR
|
||||
BorderColor $COMPONENT_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam database<<component>> {
|
||||
StereotypeFontColor $COMPONENT_FONT_COLOR
|
||||
FontColor $COMPONENT_FONT_COLOR
|
||||
BackgroundColor $COMPONENT_BG_COLOR
|
||||
BorderColor $COMPONENT_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam queue<<component>> {
|
||||
StereotypeFontColor $COMPONENT_FONT_COLOR
|
||||
FontColor $COMPONENT_FONT_COLOR
|
||||
BackgroundColor $COMPONENT_BG_COLOR
|
||||
BorderColor $COMPONENT_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam rectangle<<external_component>> {
|
||||
StereotypeFontColor $COMPONENT_FONT_COLOR
|
||||
FontColor $COMPONENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_COMPONENT_BG_COLOR
|
||||
BorderColor $EXTERNAL_COMPONENT_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam database<<external_component>> {
|
||||
StereotypeFontColor $COMPONENT_FONT_COLOR
|
||||
FontColor $COMPONENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_COMPONENT_BG_COLOR
|
||||
BorderColor $EXTERNAL_COMPONENT_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam queue<<external_component>> {
|
||||
StereotypeFontColor $COMPONENT_FONT_COLOR
|
||||
FontColor $COMPONENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_COMPONENT_BG_COLOR
|
||||
BorderColor $EXTERNAL_COMPONENT_BORDER_COLOR
|
||||
}
|
||||
UpdateSkinparamsAndLegendEntry("component", $COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $COMPONENT_BORDER_COLOR)
|
||||
UpdateSkinparamsAndLegendEntry("external_component", $EXTERNAL_COMPONENT_BG_COLOR, $COMPONENT_FONT_COLOR, $EXTERNAL_COMPONENT_BORDER_COLOR)
|
||||
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\ncomponent\nexternal_person\nexternal_system\nexternal_container\nexternal_component")
|
||||
|
||||
!procedure LAYOUT_WITH_LEGEND()
|
||||
hide stereotype
|
||||
legend right
|
||||
@@ -97,26 +64,26 @@ endlegend
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="")
|
||||
rectangle "$getComponent($label, $techn, $descr, $sprite)" <<component>> as $alias
|
||||
!unquoted procedure Component($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ComponentDb($alias, $label, $techn, $descr="", $sprite="")
|
||||
database "$getComponent($label, $techn, $descr, $sprite)" <<component>> as $alias
|
||||
!unquoted procedure ComponentDb($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ComponentQueue($alias, $label, $techn, $descr="", $sprite="")
|
||||
queue "$getComponent($label, $techn, $descr, $sprite)" <<component>> as $alias
|
||||
!unquoted procedure ComponentQueue($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("component",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Component_Ext($alias, $label, $techn, $descr="", $sprite="")
|
||||
rectangle "$getComponent($label, $techn, $descr, $sprite)" <<external_component>> as $alias
|
||||
!unquoted procedure Component_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ComponentDb_Ext($alias, $label, $techn, $descr="", $sprite="")
|
||||
database "$getComponent($label, $techn, $descr, $sprite)" <<external_component>> as $alias
|
||||
!unquoted procedure ComponentDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
database "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="")
|
||||
queue "$getComponent($label, $techn, $descr, $sprite)" <<external_component>> as $alias
|
||||
!unquoted procedure ComponentQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
queue "$getComponent($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_component",$tags) as $alias
|
||||
!endprocedure
|
||||
+25
-60
@@ -1,6 +1,9 @@
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4_Context.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Context.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
||||
!endif
|
||||
|
||||
' Scope: A single software system.
|
||||
' Primary elements: Containers within the software system in scope.
|
||||
@@ -17,52 +20,14 @@
|
||||
|
||||
' Styling
|
||||
' ##################################
|
||||
|
||||
skinparam rectangle<<container>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $CONTAINER_BG_COLOR
|
||||
BorderColor $CONTAINER_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam database<<container>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $CONTAINER_BG_COLOR
|
||||
BorderColor $CONTAINER_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam queue<<container>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $CONTAINER_BG_COLOR
|
||||
BorderColor $CONTAINER_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam rectangle<<external_container>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_CONTAINER_BG_COLOR
|
||||
BorderColor $EXTERNAL_CONTAINER_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam database<<external_container>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_CONTAINER_BG_COLOR
|
||||
BorderColor $EXTERNAL_CONTAINER_BORDER_COLOR
|
||||
}
|
||||
|
||||
skinparam queue<<external_container>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_CONTAINER_BG_COLOR
|
||||
BorderColor $EXTERNAL_CONTAINER_BORDER_COLOR
|
||||
}
|
||||
UpdateSkinparamsAndLegendEntry("container", $CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $CONTAINER_BORDER_COLOR)
|
||||
UpdateSkinparamsAndLegendEntry("external_container", $EXTERNAL_CONTAINER_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_CONTAINER_BORDER_COLOR)
|
||||
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container")
|
||||
|
||||
!procedure LAYOUT_WITH_LEGEND()
|
||||
hide stereotype
|
||||
legend right
|
||||
@@ -94,33 +59,33 @@ endlegend
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="")
|
||||
rectangle "$getContainer($label, $techn, $descr, $sprite)" <<container>> as $alias
|
||||
!unquoted procedure Container($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ContainerDb($alias, $label, $techn, $descr="", $sprite="")
|
||||
database "$getContainer($label, $techn, $descr, $sprite)" <<container>> as $alias
|
||||
!unquoted procedure ContainerDb($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ContainerQueue($alias, $label, $techn, $descr="", $sprite="")
|
||||
queue "$getContainer($label, $techn, $descr, $sprite)" <<container>> as $alias
|
||||
!unquoted procedure ContainerQueue($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("container", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Container_Ext($alias, $label, $techn, $descr="", $sprite="")
|
||||
rectangle "$getContainer($label, $techn, $descr, $sprite)" <<external_container>> as $alias
|
||||
!unquoted procedure Container_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ContainerDb_Ext($alias, $label, $techn, $descr="", $sprite="")
|
||||
database "$getContainer($label, $techn, $descr, $sprite)" <<external_container>> as $alias
|
||||
!unquoted procedure ContainerDb_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
database "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure ContainerQueue_Ext($alias, $label, $techn, $descr="", $sprite="")
|
||||
queue "$getContainer($label, $techn, $descr, $sprite)" <<external_container>> as $alias
|
||||
!unquoted procedure ContainerQueue_Ext($alias, $label, $techn, $descr="", $sprite="", $tags="")
|
||||
queue "$getContainer($label, $techn, $descr, $sprite)$getProps()" $toStereos("external_container", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
' Boundaries
|
||||
' ##################################
|
||||
|
||||
!unquoted function Container_Boundary($alias, $label)
|
||||
!return Boundary($alias, $label, "Container")
|
||||
!endfunction
|
||||
!unquoted procedure Container_Boundary($alias, $label, $tags="")
|
||||
Boundary($alias, $label, "Container", $tags)
|
||||
!endprocedure
|
||||
|
||||
+30
-43
@@ -1,6 +1,9 @@
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include %get_variable_value("RELATIVE_INCLUDE")/C4.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4.puml
|
||||
!endif
|
||||
|
||||
' Scope: A single software system.
|
||||
' Primary elements: The software system in scope.
|
||||
@@ -11,40 +14,22 @@
|
||||
' ##################################
|
||||
|
||||
!global $PERSON_BG_COLOR = "#08427B"
|
||||
!global $PERSON_BORDER_COLOR = "#073B6F"
|
||||
!global $EXTERNAL_PERSON_BG_COLOR = "#686868"
|
||||
!global $EXTERNAL_PERSON_BORDER_COLOR = "#8A8A8A"
|
||||
!global $SYSTEM_BG_COLOR = "#1168BD"
|
||||
!global $SYSTEM_BORDER_COLOR = "#3C7FC0"
|
||||
!global $EXTERNAL_SYSTEM_BG_COLOR = "#999999"
|
||||
!global $EXTERNAL_SYSTEM_BORDER_COLOR = "#8A8A8A"
|
||||
|
||||
' Styling
|
||||
' ##################################
|
||||
|
||||
skinparam rectangle<<person>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $PERSON_BG_COLOR
|
||||
BorderColor #073B6F
|
||||
}
|
||||
UpdateSkinparamsAndLegendEntry("person", $PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $PERSON_BORDER_COLOR)
|
||||
UpdateSkinparamsAndLegendEntry("external_person", $EXTERNAL_PERSON_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_PERSON_BORDER_COLOR)
|
||||
UpdateSkinparamsAndLegendEntry("system", $SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $SYSTEM_BORDER_COLOR)
|
||||
UpdateSkinparamsAndLegendEntry("external_system", $EXTERNAL_SYSTEM_BG_COLOR, $ELEMENT_FONT_COLOR, $EXTERNAL_SYSTEM_BORDER_COLOR)
|
||||
|
||||
skinparam rectangle<<external_person>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_PERSON_BG_COLOR
|
||||
BorderColor #8A8A8A
|
||||
}
|
||||
|
||||
skinparam rectangle<<system>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $SYSTEM_BG_COLOR
|
||||
BorderColor #3C7FC0
|
||||
}
|
||||
|
||||
skinparam rectangle<<external_system>> {
|
||||
StereotypeFontColor $ELEMENT_FONT_COLOR
|
||||
FontColor $ELEMENT_FONT_COLOR
|
||||
BackgroundColor $EXTERNAL_SYSTEM_BG_COLOR
|
||||
BorderColor #8A8A8A
|
||||
}
|
||||
|
||||
sprite $person [48x48/16] {
|
||||
000000000000000000000000000000000000000000000000
|
||||
@@ -100,6 +85,8 @@ sprite $person [48x48/16] {
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
SetDefaultLegendEntries("person\nsystem\nexternal_person\nexternal_system")
|
||||
|
||||
!procedure LAYOUT_WITH_LEGEND()
|
||||
hide stereotype
|
||||
legend right
|
||||
@@ -144,28 +131,28 @@ endlegend
|
||||
!endif
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure Person($alias, $label, $descr="", $sprite="")
|
||||
rectangle "$getPerson($label, $descr, $sprite)" <<person>> as $alias
|
||||
!unquoted procedure Person($alias, $label, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("person", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="")
|
||||
rectangle "$getPerson($label, $descr, $sprite)" <<external_person>> as $alias
|
||||
!unquoted procedure Person_Ext($alias, $label, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getPerson($label, $descr, $sprite)$getProps()" $toStereos("external_person", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure System($alias, $label, $descr="", $sprite="")
|
||||
rectangle "$getSystem($label, $descr, $sprite)" <<system>> as $alias
|
||||
!unquoted procedure System($alias, $label, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("system", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure System_Ext($alias, $label, $descr="", $sprite="")
|
||||
rectangle "$getSystem($label, $descr, $sprite)" <<external_system>> as $alias
|
||||
!unquoted procedure System_Ext($alias, $label, $descr="", $sprite="", $tags="")
|
||||
rectangle "$getSystem($label, $descr, $sprite)$getProps()" $toStereos("external_system", $tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
' Boundaries
|
||||
' ##################################
|
||||
|
||||
!unquoted function Enterprise_Boundary($alias, $label)
|
||||
!return Boundary($alias, $label, "Enterprise")
|
||||
!endfunction
|
||||
!unquoted function System_Boundary($alias, $label)
|
||||
!return Boundary($alias, $label, "System")
|
||||
!endfunction
|
||||
!unquoted procedure Enterprise_Boundary($alias, $label, $tags="")
|
||||
Boundary($alias, $label, "Enterprise", $tags)
|
||||
!endprocedure
|
||||
!unquoted procedure System_Boundary($alias, $label, $tags="")
|
||||
Boundary($alias, $label, "System", $tags)
|
||||
!endprocedure
|
||||
|
||||
+167
-12
@@ -1,23 +1,178 @@
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4_Container.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Container.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
!endif
|
||||
|
||||
' Colors
|
||||
' ##################################
|
||||
|
||||
!global $NODE_FONT_COLOR = "#000000"
|
||||
!global $NODE_BG_COLOR = "#FFFFFF"
|
||||
!global $NODE_BORDER_COLOR = "#A2A2A2"
|
||||
|
||||
' Styling
|
||||
' ##################################
|
||||
|
||||
' orig was without background
|
||||
'UpdateSkinparamsAndLegendEntry("node", $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
|
||||
UpdateSkinparamsAndLegendEntry("node", $bgColor=$NODE_BG_COLOR, $fontColor=$NODE_FONT_COLOR, $borderColor=$NODE_BORDER_COLOR)
|
||||
skinparam rectangle<<node>> {
|
||||
Shadowing false
|
||||
StereotypeFontSize 0
|
||||
FontColor #000000
|
||||
BorderColor #A2A2A2
|
||||
BorderStyle solid
|
||||
FontStyle normal
|
||||
}
|
||||
|
||||
' Layout
|
||||
' ##################################
|
||||
|
||||
' comment if node should not be added to legend. No dynamic legend extension required
|
||||
SetDefaultLegendEntries("person\nsystem\ncontainer\nexternal_person\nexternal_system\nexternal_container\nnode")
|
||||
|
||||
' Special
|
||||
' ##################################
|
||||
|
||||
' PlantUML supports no automatic line breaks of "PlantUML containers" (C4 Deployment_Node is a "PlantUML container")
|
||||
' therefore Deployment_Node() implements an automatic line break based on spaces (like in all other objects).
|
||||
' If a $type contains \n then the these are used (and no automatic space based line breaks are done)
|
||||
' $NODE_TYPE_MAX_CHAR_WIDTH defines the automatic line break position
|
||||
!global $NODE_TYPE_MAX_CHAR_WIDTH = 35
|
||||
!global $NODE_DESCR_MAX_CHAR_WIDTH=32
|
||||
|
||||
' Elements
|
||||
' ##################################
|
||||
!unquoted function Deployment_Node($alias, $label)
|
||||
!return 'rectangle "=='+$label+'" <<node>> as '+$alias
|
||||
|
||||
!unquoted function $breakType($type, $widthStr)
|
||||
!$width = %intval($widthStr)
|
||||
!$multiLine = ""
|
||||
!if (%strpos($type, "\n") >= 0)
|
||||
!while (%strpos($type, "\n") >= 0)
|
||||
!$brPos = %strpos($type, "\n")
|
||||
!$multiLine = $multiLine + %substr($type, 0, $brPos) + '</size>\n<size:'+$TECHN_FONT_SIZE+'>'
|
||||
!$type = %substr($type, $brPos+2)
|
||||
!endwhile
|
||||
!else
|
||||
!while (%strlen($type)>$width)
|
||||
!$brPos = $width
|
||||
!while ($brPos>0 && %substr($type, $brPos, 1)!= ' ')
|
||||
!$brPos = $brPos - 1
|
||||
!endwhile
|
||||
|
||||
!if ($brPos < 1)
|
||||
!$brPos = %strpos($type, " ")
|
||||
!else
|
||||
!endif
|
||||
|
||||
!if ($brPos > 0)
|
||||
!$multiLine = $multiLine + %substr($type, 0, $brPos) + '</size>\n<size:'+$TECHN_FONT_SIZE+'>'
|
||||
!$type = %substr($type, $brPos + 1)
|
||||
!else
|
||||
!$multiLine = $multiLine+ $type
|
||||
!$type = ""
|
||||
!endif
|
||||
!endwhile
|
||||
!endif
|
||||
!if (%strlen($type)>0)
|
||||
!$multiLine = $multiLine + $type
|
||||
!endif
|
||||
!return $multiLine
|
||||
!endfunction
|
||||
!unquoted function Deployment_Node($alias, $label, $type)
|
||||
!return 'rectangle "=='+$label+'\n<size:'+$TECHN_FONT_SIZE+'>['+$type+']</size>" <<node>> as '+$alias
|
||||
|
||||
!unquoted function $breakDescr($descr, $widthStr)
|
||||
!$width = %intval($widthStr)
|
||||
!$multiLine = ""
|
||||
!if (%strpos($descr, "\n") >= 0)
|
||||
!else
|
||||
!while (%strlen($descr)>$width)
|
||||
!$brPos = $width
|
||||
!while ($brPos>0 && %substr($descr, $brPos, 1)!= ' ')
|
||||
!$brPos = $brPos - 1
|
||||
!endwhile
|
||||
|
||||
!if ($brPos < 1)
|
||||
!$brPos = %strpos($descr, " ")
|
||||
!else
|
||||
!endif
|
||||
|
||||
!if ($brPos > 0)
|
||||
!$multiLine = $multiLine + %substr($descr, 0, $brPos) + "\n"
|
||||
!$descr = %substr($descr, $brPos + 1)
|
||||
!else
|
||||
!$multiLine = $multiLine+ $descr
|
||||
!$descr = ""
|
||||
!endif
|
||||
!endwhile
|
||||
!endif
|
||||
!if (%strlen($descr)>0)
|
||||
!$multiLine = $multiLine + $descr
|
||||
!endif
|
||||
!return $multiLine
|
||||
!endfunction
|
||||
|
||||
!function $getNode($label, $type, $descr, $sprite)
|
||||
!$nodeText = ""
|
||||
!if ($sprite != "")
|
||||
!$nodeText = $nodeText + '<$'+$sprite+'>\n'
|
||||
!endif
|
||||
!$nodeText = $nodeText + '==' + $label
|
||||
!if ($type != "")
|
||||
!$nodeText = $nodeText + '\n<size:' + $TECHN_FONT_SIZE + '>[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
|
||||
!endif
|
||||
!if ($descr != "")
|
||||
!$nodeText = $nodeText + '\n\n' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH)
|
||||
!endif
|
||||
!return $nodeText
|
||||
!endfunction
|
||||
|
||||
!function $getNode_L($label, $type, $descr, $sprite)
|
||||
!$nodeText = ""
|
||||
!if ($sprite != "")
|
||||
!$nodeText = $nodeText + '<$'+$sprite+'>\l'
|
||||
!endif
|
||||
!$nodeText = $nodeText + '==' + $label
|
||||
!if ($type != "")
|
||||
!$nodeText = $nodeText + '\l<size:' + $TECHN_FONT_SIZE + '>[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
|
||||
!endif
|
||||
!if ($descr != "")
|
||||
!$nodeText = $nodeText + '\l\l' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH)
|
||||
!endif
|
||||
!return $nodeText
|
||||
!endfunction
|
||||
|
||||
!function $getNode_R($label, $type, $descr, $sprite)
|
||||
!$nodeText = ""
|
||||
!if ($sprite != "")
|
||||
!$nodeText = $nodeText + '<$'+$sprite+'>\r'
|
||||
!endif
|
||||
!$nodeText = $nodeText + '==' + $label
|
||||
!if ($type != "")
|
||||
!$nodeText = $nodeText + '\r<size:' + $TECHN_FONT_SIZE + '>[' + $breakType($type, $NODE_TYPE_MAX_CHAR_WIDTH) + ']</size>'
|
||||
!endif
|
||||
!if ($descr != "")
|
||||
!$nodeText = $nodeText + '\r\r' + $breakDescr($descr, $NODE_DESCR_MAX_CHAR_WIDTH)
|
||||
!endif
|
||||
!return $nodeText
|
||||
!endfunction
|
||||
|
||||
!unquoted procedure Deployment_Node($alias, $label, $type="", $descr="", $sprite="", $tags="")
|
||||
rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Deployment_Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="")
|
||||
rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Deployment_Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="")
|
||||
rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Node($alias, $label, $type="", $descr="", $sprite="", $tags="")
|
||||
rectangle "$getNode($label, $type, $descr, $sprite)$getProps()" $toStereos("node",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Node_L($alias, $label, $type="", $descr="", $sprite="", $tags="")
|
||||
rectangle "$getNode_L($label, $type, $descr, $sprite)$getProps_L()" $toStereos("node",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
!unquoted procedure Node_R($alias, $label, $type="", $descr="", $sprite="", $tags="")
|
||||
rectangle "$getNode_R($label, $type, $descr, $sprite)$getProps_R()" $toStereos("node",$tags) as $alias
|
||||
!endprocedure
|
||||
|
||||
+6
-3
@@ -1,6 +1,9 @@
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4_Component.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include %get_variable_value("RELATIVE_INCLUDE")/C4_Component.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
!endif
|
||||
|
||||
' Scope: Interactions in an enterprise, software system or container.
|
||||
' Primary and supporting elements: Depends on the diagram scope -
|
||||
|
||||
+27
-1
@@ -53,7 +53,7 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||

|
||||
|
||||
|
||||
## LAYOUT_WITH_LEGEND()
|
||||
## LAYOUT_WITH_LEGEND() or SHOW_DYNAMIC_LEGEND(?hideStereotype)
|
||||
|
||||
Colors can help to add additional information or simply to make the diagram more aesthetically pleasing.
|
||||
It can also help to save some space.
|
||||
@@ -80,6 +80,32 @@ Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||

|
||||
|
||||
Instead of a static legend (activated with `LAYOUT_WITH_LEGEND()`) a dynamic legend can be activated with `SHOW_DYNAMIC_LEGEND(?hideStereotype)`.
|
||||
|
||||
The dynamic legend has following differences:
|
||||
* only relevant elements are listed
|
||||
* custom tags/stereotypes are supported
|
||||
* stereotypes can remain visible (with `SHOW_DYNAMIC_LEGEND(false)`)
|
||||
* **`SHOW_DYNAMIC_LEGEND()` has to be last call in the diagram**
|
||||
|
||||
```csharp
|
||||
@startuml SHOW_DYNAMIC_LEGEND Sample
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
|
||||
Person(admin, "Administrator")
|
||||
System_Boundary(c1, 'Sample') {
|
||||
Container(web_app, "Web Application", "C#, ASP.NET Core 2.1 MVC", "Allows users to compare multiple Twitter timelines")
|
||||
}
|
||||
System(twitter, "Twitter")
|
||||
|
||||
Rel(admin, web_app, "Uses", "HTTPS")
|
||||
Rel(web_app, twitter, "Gets tweets from", "HTTPS")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
## LAYOUT_AS_SKETCH()
|
||||
|
||||
|
||||
@@ -18,17 +18,12 @@ C4-PlantUML includes macros, stereotypes, and other goodies (like VSCode Snippet
|
||||
|
||||
At the top of your C4 PlantUML `.puml` file, you need to include the `C4_Context.puml`, `C4_Container.puml` or `C4_Component.puml` file found in the `root` of this repo.
|
||||
|
||||
To be independent of any internet connectivity, you can also download the files found in the `root` and reference it locally with
|
||||
To be independent of any internet connectivity, you can also download the files found in the `root` and activate the local conversion with additional command line argument `-DRELATIVE_INCLUDE="."` (that the local files are included)
|
||||
|
||||
```c#
|
||||
!include path/to/C4.puml
|
||||
!include path/to/C4_Context.puml
|
||||
!include path/to/C4_Container.puml
|
||||
!include path/to/C4_Component.puml
|
||||
java -jar plantuml.jar -DRELATIVE_INCLUDE="." ...
|
||||
```
|
||||
|
||||
Just remember to change the `!include` statements at the top of the files.
|
||||
|
||||
If you want to use the always up-to-date version in this repo, use the following:
|
||||
|
||||
```c#
|
||||
@@ -102,6 +97,34 @@ Rel_R(api, db, "Reads/Writes")
|
||||
|
||||

|
||||
|
||||
Entities can be decorated with tags and explained via dynamic calculated legends, for example:
|
||||
|
||||
```cs
|
||||
@startuml
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
|
||||
AddTagSupport("v1.0", $borderColor="#d73027")
|
||||
AddTagSupport("v1.1", $fontColor="#d73027")
|
||||
|
||||
Person(user, "Customer", "People that need products")
|
||||
Person(admin, "Administrator", "People that administrates the products via the new v1.1 components", $tags="v1.1")
|
||||
Container(spa, "SPA", "angular", "The main interface that the customer interacts with via v1.0", $tags="v1.0")
|
||||
Container(spaAdmin, "Admin SPA", "angular", "The administrator interface that the customer interacts with via new v1.1", $tags="v1.1")
|
||||
Container(api, "API", "java", "Handles all business logic (incl. new v1.1 extensions)", $tags="v1.0+v1.1")
|
||||
ContainerDb(db, "Database", "Microsoft SQL", "Holds product, order and invoice information")
|
||||
|
||||
Rel(user, spa, "Uses", "https")
|
||||
Rel(spa, api, "Uses", "https")
|
||||
Rel_R(api, db, "Reads/Writes")
|
||||
Rel(admin, spaAdmin, "Uses", "https")
|
||||
Rel(spaAdmin, api, "Uses", "https")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
|
||||
## Supported Diagram Types
|
||||
|
||||
@@ -110,17 +133,17 @@ Diagram types
|
||||
* System Context & System Landscape diagrams
|
||||
* Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml`
|
||||
* Macros:
|
||||
* `Person(alias, label, ?description, ?sprite)`
|
||||
* `Person(alias, label, ?description, ?sprite, ?tags)`
|
||||
* `Person_Ext`
|
||||
* `System(alias, label, ?description, ?sprite)`
|
||||
* `System(alias, label, ?description, ?sprite, ?tags)`
|
||||
* `System_Ext`
|
||||
* `Boundary(alias, label, ?type)`
|
||||
* `Enterprise_Boundary(alias, label)`
|
||||
* `Boundary(alias, label, ?type, ?tags)`
|
||||
* `Enterprise_Boundary(alias, label, ?tags)`
|
||||
* `System_Boundary`
|
||||
* Container diagram
|
||||
* Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml`
|
||||
* Additional Macros:
|
||||
* `Container(alias, label, technology, ?description, ?sprite)`
|
||||
* `Container(alias, label, technology, ?description, ?sprite, ?tags)`
|
||||
* `ContainerDb`
|
||||
* `ContainerQueue`
|
||||
* `Container_Ext`
|
||||
@@ -130,7 +153,7 @@ Diagram types
|
||||
* Component diagram
|
||||
* Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml`
|
||||
* Additional Macros:
|
||||
* `Component(alias, label, technology, ?description, ?sprite)`
|
||||
* `Component(alias, label, technology, ?description, ?sprite, ?tags)`
|
||||
* `ComponentDb`
|
||||
* `ComponentQueue`
|
||||
* `Component_Ext`
|
||||
@@ -145,7 +168,10 @@ Diagram types
|
||||
* Deployment diagram
|
||||
* Import: `!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml`
|
||||
* Additional Macros:
|
||||
* `Deployment_Node(alias, label, ?type)`
|
||||
* `Deployment_Node(alias, label, ?type, ?description, ?sprite, ?tags)`
|
||||
* `Node(alias, label, ?type, ?description, ?sprite, ?tags)`: short name of Deployment_Node()
|
||||
* `Node_L(alias, label, ?type, ?description, ?sprite, ?tags)`: left aligned Node()
|
||||
* `Node_R(alias, label, ?type, ?description, ?sprite, ?tags)`: right aligned Node()
|
||||
|
||||
Take a look at each of the [C4 Model Diagram Samples](samples/C4CoreDiagrams.md).
|
||||
|
||||
@@ -206,10 +232,142 @@ Rel_L(x, s4, "uses")
|
||||
C4-PlantUML also comes with some layout options to make it easy and reuseable to create nice and useful diagrams:
|
||||
|
||||
* [LAYOUT_TOP_DOWN() or LAYOUT_LEFT_RIGHT()](LayoutOptions.md#layout_top_down-or-layout_left_right)
|
||||
* [LAYOUT_WITH_LEGEND()](LayoutOptions.md#layout_with_legend)
|
||||
* [LAYOUT_WITH_LEGEND() or SHOW_DYNAMIC_LEGEND(?hideStereotype)](LayoutOptions.md#layout_with_legend-or-show_dynamic_legend)
|
||||
* [LAYOUT_AS_SKETCH()](LayoutOptions.md#layout_as_sketch)
|
||||
* [HIDE_STEREOTYPE()](LayoutOptions.md#hide_stereotype)
|
||||
|
||||
## Custom tags/stereotypes support and skinparam updates
|
||||
|
||||
Additional tags/stereotypes can be added to the existing element stereotypes (component, ...) and highlight,... specific aspects:
|
||||
|
||||
* `AddTagSupport(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing)`:
|
||||
After this call the given tag can be used in the diagram, the styles of the tagged elements are updated and the tag is be displayed in the dynamic legend.
|
||||
* `UpdateSkinparamsAndLegendEntry(tagStereo, ?bgColor, ?fontColor, ?borderColor, ?shadowing)`
|
||||
This call updates the style of the default element stereotypes (component, ...) and creates no additional legend entry.
|
||||
|
||||
Each element can be extended with one or multiple custom tags/stereotypes via the keyword argument `$tags="..."`, like `Container(spaAdmin, "Admin SPA", $tags="v1.1")`.
|
||||
Multiple tags can be combined with `+`, like `Container(api, "API", $tags="v1.0+v1.1")`.
|
||||
|
||||
**Comments**
|
||||
|
||||
* `SHOW_DYNAMIC_LEGEND()` supports the customized stereotypes
|
||||
(`LAYOUT_WITH_LEGEND()` cannot be used, if the custom tags/stereotypes should be displayed in the legend).
|
||||
* `SHOW_DYNAMIC_LEGEND()` has to be last line in diagram.
|
||||
* Don't use space between `$tags` and `=` (PlantUML does not support it).
|
||||
* Don't use `,` as part of the tag names (PlantUML does not support it in combination with keyword arguments).
|
||||
* If 2 tags defines the same skinparameter, the first definition is used.
|
||||
* If specific skinparameters have to be merged (e.g. 2 tags change the font color) an additional combined tag has to be defined. Use `&` as part of combined tag names. This convention can be used in other tools.
|
||||
|
||||
```cs
|
||||
@startuml
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
|
||||
AddTagSupport("v1.0", $fontColor="#d73027", $borderColor="#d73027")
|
||||
AddTagSupport("v1.1", $fontColor="#ffffbf", $borderColor="#ffffbf")
|
||||
AddTagSupport("v1.0&v1.1", $fontColor="#fdae61", $borderColor="#fdae61")
|
||||
AddTagSupport("fallback", $bgColor="#888888")
|
||||
|
||||
Container(spa, "SPA", "angular", "The main interface that the customer interacts with via v1.0", $tags="v1.0")
|
||||
Container(spaAdmin, "Admin SPA", "angular", "The administrator interface that the customer interacts with via new v1.1", $tags="v1.1")
|
||||
Container(api, "API", "java", "Handles all business logic (incl. new v1.1 extensions)", $tags="v1.0&v1.1+v1.0+v1.1")
|
||||
Container(spa2, "SPA2", "angular", "The main interface that the customer interacts with via v1.0", $tags="v1.0+fallback")
|
||||
Container(spaAdmin2, "Admin SPA2", "angular", "The administrator interface that the customer interacts with via new v1.1", $tags="fallback+v1.1")
|
||||
|
||||
Rel(spa, api, "Uses", "https")
|
||||
Rel(spaAdmin, api, "Uses", "https")
|
||||
Rel_L(spa, spa2, "Updates", "https")
|
||||
Rel_R(spaAdmin, spaAdmin2, "Updates", "https")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND(false)
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
**Custom schema definition**
|
||||
|
||||
If the custom (color) schema is defined via `UpdateSkinparamsAndLegendEntry()` then the legend of existing elements is updated too.
|
||||
|
||||
```cs
|
||||
@startuml
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
||||
|
||||
!$COLOR_A_5 = "#7f3b08"
|
||||
!$COLOR_A_4 = "#b35806"
|
||||
!$COLOR_A_3 = "#e08214"
|
||||
!$COLOR_A_2 = "#fdb863"
|
||||
!$COLOR_A_1 = "#fee0b6b"
|
||||
!$COLOR_NEUTRAL = "#f7f7f7"
|
||||
!$COLOR_B_1 = "#d8daeb"
|
||||
!$COLOR_B_2 = "#b2abd2"
|
||||
!$COLOR_B_3 = "#8073ac"
|
||||
!$COLOR_B_4 = "#542788"
|
||||
!$COLOR_B_5 = "#2d004b"
|
||||
|
||||
UpdateSkinparamsAndLegendEntry("person", $bgColor=$COLOR_A_5, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_A_1, $shadowing="true")
|
||||
UpdateSkinparamsAndLegendEntry("external_person", $bgColor=$COLOR_B_5, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_B_1)
|
||||
UpdateSkinparamsAndLegendEntry("system", $bgColor=$COLOR_A_4, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_A_2)
|
||||
UpdateSkinparamsAndLegendEntry("external_system", $bgColor=$COLOR_B_4, $fontColor=$COLOR_NEUTRAL, $borderColor=$COLOR_B_2)
|
||||
|
||||
Person(customer, "Personal Banking Customer")
|
||||
System(banking_system, "Internet Banking System")
|
||||
|
||||
System_Ext(mail_system, "E-mail system")
|
||||
System_Ext(mainframe, "Mainframe Banking System")
|
||||
|
||||
Rel(customer, banking_system, "Uses")
|
||||
Rel_Back(customer, mail_system, "Sends e-mails to")
|
||||
Rel_Neighbor(banking_system, mail_system, "Sends e-mails")
|
||||
Rel(banking_system, mainframe, "Uses")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Element properties
|
||||
|
||||
A model can be extended with (a table of) properties that concrete deployments or more detailed concepts can be documented:
|
||||
|
||||
* `SetPropertyHeader(col1Name, col2Name, ?col3Name, ?col4Name)`:
|
||||
The properties table can have up to 4 columns. The default header uses the column names "Name", "Description".
|
||||
* `WithoutPropertyHeader()`
|
||||
If no header is used, then the second column is bold.
|
||||
* `AddProperty(col1, col2, ?col3, `?col4)`
|
||||
(All columns of) a property which will be added to the next element.
|
||||
|
||||
Following sample uses all 3 different property definitions (and the aligned deployment node).
|
||||
|
||||
```cs
|
||||
@startuml
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
|
||||
|
||||
' default header Property, Value
|
||||
AddProperty("Name", "Flash")
|
||||
AddProperty("Organization", "Zootopia")
|
||||
AddProperty("Tool", "Internet Explorer 7.0")
|
||||
Person(personAlias, "Label", "Optional Description (with default property header)")
|
||||
|
||||
SetPropertyHeader("Property","Value", "Description")
|
||||
AddProperty("Prop1", "Value1", "Details1")
|
||||
AddProperty("Prop2", "Value2", "Details2")
|
||||
Deployment_Node_L(nodeAlias, "Label", "Optional Type", "Optional Description (with custom property header)") {
|
||||
|
||||
WithoutPropertyHeader()
|
||||
AddProperty("PropC1", "ValueC1")
|
||||
AddProperty("PropC2", "ValueC2")
|
||||
Container(containerAlias, "Label", "Technology", "Optional Description (without property header)")
|
||||
}
|
||||
|
||||
System(systemAlias, "Label", "Optional Description (without properties)")
|
||||
|
||||
Rel(personAlias, containerAlias, "Label", "Optional Technology")
|
||||
@enduml
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Snippets for Visual Studio Code
|
||||
|
||||
Because the PlantUML support inside of Visual Studio Code is excellent with the [PlantUML extension](https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml), you can also find VS Code snippets for C4-PlantUML at [.vscode/C4.code-snippets](.vscode/C4.code-snippets).
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
@startuml
|
||||
!include ./../C4_Component.puml
|
||||
!include ./../C4_Container.puml
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Component.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_WITH_LEGEND()
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
@startuml
|
||||
!include ./../C4_Container.puml
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Container.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_TOP_DOWN()
|
||||
'LAYOUT_AS_SKETCH()
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
@startuml "bigbankplc"
|
||||
!include ./../C4_Container.puml
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Container.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
!endif
|
||||
|
||||
skinparam wrapWidth 200
|
||||
skinparam maxMessageSize 200
|
||||
@@ -10,7 +13,6 @@ LAYOUT_TOP_DOWN()
|
||||
'LAYOUT_AS_SKETCH()
|
||||
LAYOUT_WITH_LEGEND()
|
||||
|
||||
|
||||
Person(customer, Customer, "A customer")
|
||||
|
||||
System_Boundary(c1, "Customer Information") {
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
@startuml "techtribesjs"
|
||||
!include ./../C4_Container.puml
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Container.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_TOP_DOWN()
|
||||
'LAYOUT_AS_SKETCH()
|
||||
LAYOUT_WITH_LEGEND()
|
||||
|
||||
|
||||
Person_Ext(anonymous_user, "Anonymous User")
|
||||
Person(aggregated_user, "Aggregated User")
|
||||
Person(administration_user, "Administration User")
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
@startuml
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Context.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
||||
!endif
|
||||
|
||||
'LAYOUT_TOP_DOWN()
|
||||
'LAYOUT_AS_SKETCH()
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
@startuml
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Context.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_WITH_LEGEND()
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
@startuml "enterprise"
|
||||
!include ./../C4_Context.puml
|
||||
!include ./../C4.puml
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Context.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_TOP_DOWN()
|
||||
'LAYOUT_AS_SKETCH()
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Deployment.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
|
||||
!endif
|
||||
|
||||
AddTagSupport("fallback", $bgColor="#c0c0c0")
|
||||
WithoutPropertyHeader()
|
||||
|
||||
' dynamic legend is used (activated in last line)
|
||||
' LAYOUT_WITH_LEGEND()
|
||||
|
||||
title Deployment Diagram for Internet Banking System - Live
|
||||
|
||||
Deployment_Node(plc, "Live", "Big Bank plc", "Big Bank plc data center"){
|
||||
AddProperty("Location", "London and Reading")
|
||||
Deployment_Node_L(dn, "bigbank-api***\tx8", "Ubuntu 16.04 LTS", "A web server residing in the web server farm, accessed via F5 BIG-IP LTMs."){
|
||||
AddProperty("Java Version", "8")
|
||||
AddProperty("Xmx", "512M")
|
||||
AddProperty("Xms", "1024M")
|
||||
Deployment_Node_L(apache, "Apache Tomcat", "Apache Tomcat 8.x", "An open source Java EE web server."){
|
||||
Container(api, "API Application", "Java and Spring MVC", "Provides Internet Banking functionality via a JSON/HTTPS API.")
|
||||
}
|
||||
}
|
||||
AddProperty("Location", "London")
|
||||
Deployment_Node_L(bigbankdb01, "bigbank-db01", "Ubuntu 16.04 LTS", "The primary database server."){
|
||||
Deployment_Node_L(oracle, "Oracle - Primary", "Oracle 12c", "The primary, live database server."){
|
||||
ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
|
||||
}
|
||||
}
|
||||
AddProperty("Location", "Reading")
|
||||
Deployment_Node_R(bigbankdb02, "bigbank-db02", "Ubuntu 16.04 LTS", "The secondary database server.", $tags="fallback") {
|
||||
Deployment_Node_R(oracle2, "Oracle - Secondary", "Oracle 12c", "A secondary, standby database server, used for failover purposes only.", $tags="fallback") {
|
||||
ContainerDb(db2, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="fallback")
|
||||
}
|
||||
}
|
||||
AddProperty("Location", "London and Reading")
|
||||
Deployment_Node_R(bb2, "bigbank-web***\tx4", "Ubuntu 16.04 LTS", "A web server residing in the web server farm, accessed via F5 BIG-IP LTMs."){
|
||||
AddProperty("Java Version", "8")
|
||||
AddProperty("Xmx", "512M")
|
||||
AddProperty("Xms", "1024M")
|
||||
Deployment_Node_R(apache2, "Apache Tomcat", "Apache Tomcat 8.x", "An open source Java EE web server."){
|
||||
Container(web, "Web Application", "Java and Spring MVC", "Delivers the static content and the Internet Banking single page application.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Deployment_Node(mob, "Customer's mobile device", "Apple IOS or Android"){
|
||||
Container(mobile, "Mobile App", "Xamarin", "Provides a limited subset of the Internet Banking functionality to customers via their mobile device.")
|
||||
}
|
||||
|
||||
Deployment_Node(comp, "Customer's computer", "Mircosoft Windows of Apple macOS"){
|
||||
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox, Apple Safari or Microsoft Edge"){
|
||||
Container(spa, "Single Page Application", "JavaScript and Angular", "Provides all of the Internet Banking functionality to customers via their web browser.")
|
||||
}
|
||||
}
|
||||
|
||||
Rel(mobile, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel(spa, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel_U(web, spa, "Delivers to the customer's web browser")
|
||||
Rel(api, db, "Reads from and writes to", "JDBC")
|
||||
Rel(api, db2, "Reads from and writes to", "JDBC")
|
||||
Rel_R(db, db2, "Replicates data to")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
@@ -0,0 +1,57 @@
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Deployment.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
|
||||
!endif
|
||||
|
||||
AddTagSupport("fallback", $bgColor="#c0c0c0")
|
||||
|
||||
' dynamic legend is used (activated in last line)
|
||||
' LAYOUT_WITH_LEGEND()
|
||||
|
||||
title Deployment Diagram for Internet Banking System - Live
|
||||
|
||||
Deployment_Node(plc, "Big Bank plc", "Big Bank plc data center"){
|
||||
Deployment_Node(dn, "bigbank-api***\tx8", "Ubuntu 16.04 LTS"){
|
||||
Deployment_Node(apache, "Apache Tomcat", "Apache Tomcat 8.x"){
|
||||
Container(api, "API Application", "Java and Spring MVC", "Provides Internet Banking functionality via a JSON/HTTPS API.")
|
||||
}
|
||||
}
|
||||
Deployment_Node(bigbankdb01, "bigbank-db01", "Ubuntu 16.04 LTS"){
|
||||
Deployment_Node(oracle, "Oracle - Primary", "Oracle 12c"){
|
||||
ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
|
||||
}
|
||||
}
|
||||
Deployment_Node(bigbankdb02, "bigbank-db02", "Ubuntu 16.04 LTS", $tags="fallback") {
|
||||
Deployment_Node(oracle2, "Oracle - Secondary", "Oracle 12c", $tags="fallback") {
|
||||
ContainerDb(db2, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="fallback")
|
||||
}
|
||||
}
|
||||
Deployment_Node(bb2, "bigbank-web***\tx4", "Ubuntu 16.04 LTS"){
|
||||
Deployment_Node(apache2, "Apache Tomcat", "Apache Tomcat 8.x"){
|
||||
Container(web, "Web Application", "Java and Spring MVC", "Delivers the static content and the Internet Banking single page application.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Deployment_Node(mob, "Customer's mobile device", "Apple IOS or Android"){
|
||||
Container(mobile, "Mobile App", "Xamarin", "Provides a limited subset of the Internet Banking functionality to customers via their mobile device.")
|
||||
}
|
||||
|
||||
Deployment_Node(comp, "Customer's computer", "Mircosoft Windows of Apple macOS"){
|
||||
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox, Apple Safari or Microsoft Edge"){
|
||||
Container(spa, "Single Page Application", "JavaScript and Angular", "Provides all of the Internet Banking functionality to customers via their web browser.")
|
||||
}
|
||||
}
|
||||
|
||||
Rel(mobile, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel(spa, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel_U(web, spa, "Delivers to the customer's web browser")
|
||||
Rel(api, db, "Reads from and writes to", "JDBC")
|
||||
Rel(api, db2, "Reads from and writes to", "JDBC")
|
||||
Rel_R(db, db2, "Replicates data to")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
@@ -0,0 +1,20 @@
|
||||
@startuml
|
||||
' convert it with additional command line argument -DRELATIVE_INCLUDE="." to use locally
|
||||
!if %variable_exists("RELATIVE_INCLUDE")
|
||||
!include ./../C4_Dynamic.puml
|
||||
!else
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Dynamic.puml
|
||||
!endif
|
||||
|
||||
LAYOUT_WITH_LEGEND()
|
||||
|
||||
ContainerDb(c4, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
|
||||
Container(c1, "Single-Page Application", "JavaScript and Angular", "Provides all of the Internet banking functionality to customers via their web browser.")
|
||||
Container_Boundary(b, "API Application") {
|
||||
Component(c3, "Security Component", "Spring Bean", "Provides functionality Related to signing in, changing passwords, etc.")
|
||||
Component(c2, "Sign In Controller", "Spring MVC Rest Controller", "Allows users to sign in to the Internet Banking System.")
|
||||
}
|
||||
Rel_R(c1, c2, "Submits credentials to", "JSON/HTTPS")
|
||||
Rel(c2, c3, "Calls isAuthenticated() on")
|
||||
Rel_R(c3, c4, "select * from users where username = ?", "JDBC")
|
||||
@enduml
|
||||
@@ -44,12 +44,16 @@ Source: [C4_Dynamic Diagram Sample - bigbankplc.puml](C4_Dynamic%20Diagram%20Sam
|
||||
|
||||
Source: [C4_Deployment Diagram Sample - bigbankplc.puml](C4_Deployment%20Diagram%20Sample%20-%20bigbankplc.puml)
|
||||
|
||||

|
||||

|
||||
|
||||
**with details**
|
||||
|
||||
Source: [C4_Deployment Diagram Sample - bigbankplc-details.puml](C4_Deployment%20Diagram%20Sample%20-%20bigbankplc-details.puml)
|
||||
|
||||

|
||||
|
||||
## Icons
|
||||
|
||||
Source: [C4_Container Diagram Sample - bigbankplc-icons.puml](C4_Container%20Diagram%20Sample%20-%20bigbankplc-icons.puml)
|
||||
|
||||
|
||||

|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
@startuml
|
||||
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Deployment.puml
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4_Deployment.puml
|
||||
|
||||
AddTagSupport("fallback", $bgColor="#c0c0c0")
|
||||
WithoutPropertyHeader()
|
||||
|
||||
' dynamic legend is used (activated in last line)
|
||||
' LAYOUT_WITH_LEGEND()
|
||||
|
||||
title Deployment Diagram for Internet Banking System - Live
|
||||
|
||||
Deployment_Node(plc, "Live", "Big Bank plc", "Big Bank plc data center"){
|
||||
AddProperty("Location", "London and Reading")
|
||||
Deployment_Node_L(dn, "bigbank-api***\tx8", "Ubuntu 16.04 LTS", "A web server residing in the web server farm, accessed via F5 BIG-IP LTMs."){
|
||||
AddProperty("Java Version", "8")
|
||||
AddProperty("Xmx", "512M")
|
||||
AddProperty("Xms", "1024M")
|
||||
Deployment_Node_L(apache, "Apache Tomcat", "Apache Tomcat 8.x", "An open source Java EE web server."){
|
||||
Container(api, "API Application", "Java and Spring MVC", "Provides Internet Banking functionality via a JSON/HTTPS API.")
|
||||
}
|
||||
}
|
||||
AddProperty("Location", "London")
|
||||
Deployment_Node_L(bigbankdb01, "bigbank-db01", "Ubuntu 16.04 LTS", "The primary database server."){
|
||||
Deployment_Node_L(oracle, "Oracle - Primary", "Oracle 12c", "The primary, live database server."){
|
||||
ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
|
||||
}
|
||||
}
|
||||
AddProperty("Location", "Reading")
|
||||
Deployment_Node_R(bigbankdb02, "bigbank-db02", "Ubuntu 16.04 LTS", "The secondary database server.", $tags="fallback") {
|
||||
Deployment_Node_R(oracle2, "Oracle - Secondary", "Oracle 12c", "A secondary, standby database server, used for failover purposes only.", $tags="fallback") {
|
||||
ContainerDb(db2, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="fallback")
|
||||
}
|
||||
}
|
||||
AddProperty("Location", "London and Reading")
|
||||
Deployment_Node_R(bb2, "bigbank-web***\tx4", "Ubuntu 16.04 LTS", "A web server residing in the web server farm, accessed via F5 BIG-IP LTMs."){
|
||||
AddProperty("Java Version", "8")
|
||||
AddProperty("Xmx", "512M")
|
||||
AddProperty("Xms", "1024M")
|
||||
Deployment_Node_R(apache2, "Apache Tomcat", "Apache Tomcat 8.x", "An open source Java EE web server."){
|
||||
Container(web, "Web Application", "Java and Spring MVC", "Delivers the static content and the Internet Banking single page application.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Deployment_Node(mob, "Customer's mobile device", "Apple IOS or Android"){
|
||||
Container(mobile, "Mobile App", "Xamarin", "Provides a limited subset of the Internet Banking functionality to customers via their mobile device.")
|
||||
}
|
||||
|
||||
Deployment_Node(comp, "Customer's computer", "Mircosoft Windows of Apple macOS"){
|
||||
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox, Apple Safari or Microsoft Edge"){
|
||||
Container(spa, "Single Page Application", "JavaScript and Angular", "Provides all of the Internet Banking functionality to customers via their web browser.")
|
||||
}
|
||||
}
|
||||
|
||||
Rel(mobile, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel(spa, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel_U(web, spa, "Delivers to the customer's web browser")
|
||||
Rel(api, db, "Reads from and writes to", "JDBC")
|
||||
Rel(api, db2, "Reads from and writes to", "JDBC")
|
||||
Rel_R(db, db2, "Replicates data to")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
@@ -3,8 +3,10 @@
|
||||
' uncomment the following line and comment the first to use locally
|
||||
' !include C4_Deployment.puml
|
||||
|
||||
'LAYOUT_AS_SKETCH
|
||||
LAYOUT_WITH_LEGEND()
|
||||
AddTagSupport("fallback", $bgColor="#c0c0c0")
|
||||
|
||||
' dynamic legend is used (activated in last line)
|
||||
' LAYOUT_WITH_LEGEND()
|
||||
|
||||
title Deployment Diagram for Internet Banking System - Live
|
||||
|
||||
@@ -19,9 +21,9 @@ Deployment_Node(plc, "Big Bank plc", "Big Bank plc data center"){
|
||||
ContainerDb(db, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
|
||||
}
|
||||
}
|
||||
Deployment_Node(bigbankdb02, "bigbank-db02", "Ubuntu 16.04 LTS"){
|
||||
Deployment_Node(oracle2, "Oracle - Secondary", "Oracle 12c"){
|
||||
ContainerDb(db2, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.")
|
||||
Deployment_Node(bigbankdb02, "bigbank-db02", "Ubuntu 16.04 LTS", $tags="fallback") {
|
||||
Deployment_Node(oracle2, "Oracle - Secondary", "Oracle 12c", $tags="fallback") {
|
||||
ContainerDb(db2, "Database", "Relational Database Schema", "Stores user registration information, hashed authentication credentials, access logs, etc.", $tags="fallback")
|
||||
}
|
||||
}
|
||||
Deployment_Node(bb2, "bigbank-web***\tx4", "Ubuntu 16.04 LTS"){
|
||||
@@ -36,16 +38,17 @@ Deployment_Node(mob, "Customer's mobile device", "Apple IOS or Android"){
|
||||
}
|
||||
|
||||
Deployment_Node(comp, "Customer's computer", "Mircosoft Windows of Apple macOS"){
|
||||
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox"){
|
||||
Deployment_Node(browser, "Web Browser", "Google Chrome, Mozilla Firefox, Apple Safari or Microsoft Edge"){
|
||||
Container(spa, "Single Page Application", "JavaScript and Angular", "Provides all of the Internet Banking functionality to customers via their web browser.")
|
||||
}
|
||||
}
|
||||
|
||||
Rel(mobile, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel(spa, api, "Makes API calls to", "json/HTTPS")
|
||||
Rel(web, spa, "Delivers to the customer's web browser")
|
||||
Rel_U(web, spa, "Delivers to the customer's web browser")
|
||||
Rel(api, db, "Reads from and writes to", "JDBC")
|
||||
Rel(api, db2, "Reads from and writes to", "JDBC")
|
||||
Rel(db, db2, "Replicates data to")
|
||||
Rel_R(db, db2, "Replicates data to")
|
||||
|
||||
SHOW_DYNAMIC_LEGEND()
|
||||
@enduml
|
||||
Reference in New Issue
Block a user