-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsqlUMLSpecFunctions.puml
133 lines (113 loc) · 4 KB
/
sqlUMLSpecFunctions.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
@startuml
!unquoted function $textColor($parameter, $color="red")
'$color= Red, Blue, Green,...
!return %chr(34) + "<color:" + $color + ">" + $parameter + "</color>" +%chr(34)
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClass($classType="", $name="", $stereotype="", $color="")
!local $aux = %lower($classType)
!if ($aux != "" || %lower($aux) != "abstract")
!$classType = ""
!endif
!if ($name == "")
!$name = $textColor("name", "Red")
!endif
!return $classType + " class " + $name + " " + $stereotype + $color +" {"
!endfunction
'--------------------------------------------------------------------------------
!function $defClassEnd()
!return "}"
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClassAttribute($visibility = "-", $name="" , $dataType = "T", $defaultValue = "", $label="", $pk = "FALSE", $unique = "FALSE", $required = "FALSE", $readOnly="FALSE", $hidden = "FALSE", $calculate = "", $format="", $pattern="", ,$constraint = "")
!local $aux = "{field} "
!$aux = $aux + $visibility
!if ($name == "")
!$aux = $aux + $textColor("missingAttribute","red")
!else
!$aux = $aux + $name
!endif
!if ($dataType != "")
!$aux = $aux + " :" + $dataType
!endif
!if ($defaultValue != "")
!$aux = $aux + ' = "' + %string($defaultValue) + '"'
!endif
!if ($label != "")
!$aux = $aux + ' {displayLabel = "' + $label + '"}'
!endif
!if (%lower($pk) == "true")
!$aux = $aux + " {PK}"
!endif
!if (%lower($unique) == "true")
!$aux = $aux + " {unique}"
!endif
!if (%lower($required) == "true")
!$aux = $aux + " {required}"
!endif
!if (%lower($readOnly) == "true")
!$aux = $aux + " {readOnly}"
!endif
!if (%lower($hidden) == "true")
!$aux = $aux + " {hidden}"
!endif
!if ($calculate != "")
!$aux = $aux + ' {calculate: "' + $calculate + '"}'
!endif
!if ($format != "")
!$aux = $aux + ' {format: "' + $format + '"}'
!endif
!if ($pattern != "")
!$aux = $aux + ' {pattern: "' + $pattern + '"}'
!endif
!if ($constraint != "")
!$aux = $aux + ' {"' + $constraint + '"}'
!endif
!return $aux
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClassSetWhere($logicOper="NONE", $condition="")
!local $aux = '+ setWhere( "'
!if (%upper($logicOper) == "NONE")
!$logicOper = ""
!endif
!if (%lower($logicOper) == "and" || %lower($logicOper) == "or" || $logicOper == "")
!if ($logicOper != "" && $condition != "")
!$aux = $aux + $logicOper + " " + $condition
!elseif ($logicOper == "" && $condition != "")
!$aux = $aux + $condition
!elseif ($logicOper != "" && $condition == "")
!$aux = $aux + "**errorMissingCondition**"
!endif
!else
!$aux = $aux + "**errorLogicOper**"
!endif
!return $aux + '" ) :void'
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClassSetOrderBy($columnList="")
!local $aux = '+ setOrderBy( "'
!$aux = $aux + $columnList
!return $aux + '" ) :void'
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClassSetGroupBy($columnList="")
!local $aux = '+ setGroupBy( "'
!$aux = $aux + $columnList
!return $aux + '" ) :void'
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClassSetHaving($condition="")
!local $aux = '+ setHaving( "'
!$aux = $aux + $condition
!return $aux + '" ) :void'
!endfunction
'--------------------------------------------------------------------------------
!unquoted function $defClassSetParameter($methodName="", $parameterName="", $dataType="T" )
!local $aux = '- <<input>> '
!$aux = $aux + $methodName + '('
!$aux = $aux + $parameterName
!$aux = $aux + ' :' + $dataType
!return $aux + ') :void'
!endfunction
@enduml