-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpumla_internal.puml
330 lines (292 loc) · 10.6 KB
/
pumla_internal.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
!unquoted procedure PUMLAErrorCheck($suc, $elemalias, $errortxt, $reasontxt, $hinttxt)
!if ($PUMVarShowPUMLAErrorNotes)
!if %not($suc=="1")
!$notename = "pum_error_note_nr" + %string($pum_global_error_cnt)
note as $notename #red
**<i>PUMLA Error:**
'Running Nr.$pum_global_error_cnt
$errortxt: $elemalias
**Reason:**
$reasontxt
**Hint:**
$hinttxt
end note
!$tempval = $pum_global_error_cnt
%set_variable_value("$pum_global_error_cnt", $tempval + 1)
!endif
!endif
!end procedure
!unquoted procedure PUMLAPutElementErrorCheck($suc, $elemalias)
PUMLAErrorCheck($suc, $elemalias, "Could not put element with alias", "Element was not found in model repo.", "- try to update the model repo, or %newline()- check the alias for misspellings.")
!end procedure
!unquoted procedure PUMLACreateInstanceError($elemalias)
PUMLAErrorCheck("0", $elemalias, "Could not create instance of element with alias", "The element that should be instantiated %newline()was not found in the model repo.", "- try to update the model repo, or %newline()- check the alias for misspellings.")
!end procedure
' --------------------------------------------
' put an element referenced by path and filename
' by including its file
'
!unquoted function _PUMElement($folderpath,$filename)
!$retval = "!include " + $allelems.modelrepopath + "/" + %substr($folderpath,2) + $filename
!return $retval
!endfunction
' --------------------------------------------
' put an element referenced by path and filename
' by including its file
'
!unquoted procedure _PUMPutElement($folderpath,$filename)
!include $allelems.modelrepopath/%substr($folderpath,2)/$filename
!endprocedure
' --------------------------------------------
' put an element referenced by path and filename
' by including its file using Filters
'
!unquoted procedure _PUMPutElementFiltered($folderpath,$filename)
!if ((_PUMLACheckFilterOutShowElement($el)) && (_PUMLACheckFilterInShowElement($el)))
!include $allelems.modelrepopath/%substr($folderpath,2)/$filename
!endif
!endprocedure
' ############################################
' ---------------------------------------------
' check filter type conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterOutElementTypeShow($elem)
!local $internal_retval = %false()
!if ($pum_global_element_filter_out_type != "")
!if ($elem.type == $pum_global_element_filter_out_type)
!$internal_retval = %true()
!endif
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter stereotype conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterOutElementStereotypeShow($elem)
!local $internal_retval = %false()
!if ($pum_global_element_filter_out_stereotype != "")
!foreach $st in $elem.stereotypes
!if ($st == $pum_global_element_filter_out_stereotype)
!$internal_retval = %true()
!endif
!endfor
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter tag/value conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterOutElementTagValueShow($elem)
!local $internal_retval = %false()
!if ($pum_global_element_filter_out_tv_tag != "")
!foreach $tagvalue in $elem.taggedvalues
!if ($tagvalue.tag == $pum_global_element_filter_out_tv_tag)
!if ($pum_global_element_filter_out_tv_value == "")
!$internal_retval = %true()
!else
!foreach $tvv in $tagvalue.values
!if ($tvv == $pum_global_element_filter_out_tv_value)
!$internal_retval = %true()
!endif
!endfor
!endif
!endif
!endfor
!endif
!return $internal_retval
!endfunction
' ---------------------------------------------
' check filter tag/value conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterOutPortTagValueShow($elemalias, $portalias)
!local $internal_retval = %false()
!if ($pum_global_element_filter_out_tv_tag != "")
!foreach $el in $allelems.elements
!if ($el.alias == $elemalias)
!foreach $p in $el.ports
!if ($p.alias == $portalias)
!foreach $tagvalue in $p.taggedvalues
!if ($tagvalue.tag == $pum_global_element_filter_out_tv_tag)
!if ($pum_global_element_filter_out_tv_value == "")
!$internal_retval = %true()
!else
!foreach $tvv in $tagvalue.values
!if ($tvv == $pum_global_element_filter_out_tv_value)
!$internal_retval = %true()
!endif
!endfor
!endif
!endif
!endfor
!endif
!endfor
!endif
!endfor
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter conditions for the given element.
' return false if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterOutShowElement($elem)
!local $internal_retval = %true()
!if ((_PUMLACheckFilterOutElementTypeShow($elem)) || (_PUMLACheckFilterOutElementStereotypeShow($elem)) || (_PUMLACheckFilterOutElementTagValueShow($elem)))
!$internal_retval = %false()
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter type conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterInElementTypeShow($elem)
!local $internal_retval = %false()
!if ($pum_global_element_filter_in_type != "")
!if ($elem.type != $pum_global_element_filter_in_type)
!$internal_retval = %true()
!endif
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter stereotype conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterInElementStereotypeShow($elem)
!local $internal_retval = %true()
!if ($pum_global_element_filter_in_stereotype != "")
!foreach $st in $elem.stereotypes
!if ($st == $pum_global_element_filter_in_stereotype)
!$internal_retval = %false()
!endif
!endfor
!else
!$internal_retval = %false()
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter tag/value conditions for the given element.
' return true if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterInElementTagValueShow($elem)
!local $internal_retval = %true()
!if ($pum_global_element_filter_in_tv_tag != "")
!foreach $tagvalue in $elem.taggedvalues
!if ($tagvalue.tag == $pum_global_element_filter_in_tv_tag)
!if ($pum_global_element_filter_in_tv_value == "")
!$internal_retval = %false()
!else
!foreach $tvv in $tagvalue.values
!if ($tvv == $pum_global_element_filter_in_tv_value)
!$internal_retval = %false()
!endif
!endfor
!endif
!endif
!endfor
!else
!$internal_retval = %false()
!endif
!return $internal_retval
!endfunction
' ############################################
' ---------------------------------------------
' check filter conditions for the given element.
' return false if the element shall not be
' shown but filtered out.
'
!unquoted function _PUMLACheckFilterInShowElement($elem)
!local $internal_retval = %true()
!if ((_PUMLACheckFilterInElementTypeShow($elem)) || (_PUMLACheckFilterInElementStereotypeShow($elem)) || (_PUMLACheckFilterInElementTagValueShow($elem)))
!$internal_retval = %false()
!endif
'!if ($pum_global_element_filter_in_type != "")
' !if ($elem.type != $pum_global_element_filter_in_type)
' !$internal_retval = %false()
' !endif
'!endif
!return $internal_retval
!endfunction
!unquoted function _PUMIsStatic($elemalias)
!$retval = %true()
!foreach $el in $allelems.elements
!if ($el.alias == $elemalias)
!if ($el.kind == "dynamic")
!$retval = %false()
!endif
!endif
!endfor
!return $retval
!endfunction
' ############################################
' ---------------------------------------------
' create an instance of an element that exists
' in the json model repo. Internal txt creation.
!unquoted function _PUMLACreateInstanceOf($elemalias, $instalias, $instname)
!$retval = "ERROR"
!foreach $el in $allelems.elements
!if ($el.alias == $elemalias)
!if ($PUMVarShowInstantiationRel)
!$iname = $instname
!else
!$iname = $instname + " (" + $el.name + ")"
!endif
$elt = "ERROR - no valid type"
!if (($el.type == "-") || ($el.type == ""))
!$elt = "rectangle"
!else
!$elt = $el.type
!endif
!$sts = ""
!foreach $st in $el.stereotypes
!$sts = $sts + " <<" + $st + ">>"
!endfor
!$retval = $elt + ' "' + $iname + '" as ' + $instalias + ' <<instance>> ' + $sts
!endif
!endfor
!return $retval
!endfunction
' ############################################
' ---------------------------------------------
' default footer with pumla git repo reference.
' can be overwritten or turned off with the
' global variable.
!if ($PUMVarShowPUMLAFooterNote)
center footer created with help of **pumla** $PUMLAVersionNumber: https://github.com/DrMarkusVoss/pumla
!endif
' ############################################
' ---------------------------------------------
' add a tagged value to to element referenced by its alias
!unquoted procedure PUMLATestNewTVs($elemalias)
!$notestr = "-"
!foreach $el in $allelems.elements
!if ($el.alias == $elemalias)
!foreach $tv in $el.taggedvalues
!$notestr = $notestr + " \n" + "tag=" + $tv.tag + "; values = " + $tv.values
!endfor
note as n987
$notestr
end note
!endif
!endfor
!endprocedure