-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.puml
52 lines (43 loc) · 1.62 KB
/
system.puml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
' Begin duplicate inclusion protection header.
!if %true() != $CLASSY_C4_SYSTEM_PUML
!$CLASSY_C4_SYSTEM_PUML = %true()
' End duplicate inclusion protection header.
' Defines a class that wraps the C4 System function.
!include <C4/C4_Context>
!include <classy/types/element-renderer>
!include <classy-c4/externalizable-element>
!include <classy-c4/focusable-element>
$class(System)
$classImplements(ElementRenderer)
$classImplements(ExternalizableElement, 'externalizer')
$classImplements(FocusableElement, 'focuser')
' Constructor that first calls our parent Element Renderer constructor then
' sets and Element Renderer callback.
!function System($this)
!$parent = $getInstanceVar($this, 'parent')
ElementRenderer($parent)
!$cbElement = $new('Callback')
$call($cbElement, 'setContext', $this)
$call($cbElement, 'setMethod', 'System__renderElement')
$call($this, 'setElementRendererCallback', $cbElement)
!return $this
!endfunction
' This method is an Element Renderer callback. We determine the relevant name
' and description values to submit to the C4 system function as well as if we
' should render it standard, as a boundary, or as an external System.
!procedure System__renderElement($this, $alias)
!$name = $call($this, 'getName')
!$desc = $call($this, 'getDescription')
!if $call($this, 'isExternal')
System_Ext($alias, $name, $desc)
!else
!if $call($this, 'isFocus')
System_Boundary($alias, $name)
!else
System($alias, $name, $desc)
!endif
!endif
!endprocedure
$endclass(System)
' Terminate duplicate inclusion enclosure.
!endif