4
4
<Class name =" UMLExplorer.ClassView" >
5
5
<Description >
6
6
Class contains methods that return structured class data.</Description >
7
- <TimeChanged >63663,69939 </TimeChanged >
7
+ <TimeChanged >63668,773.59952 </TimeChanged >
8
8
<TimeCreated >63653,67019.989197</TimeCreated >
9
9
10
+ <Method name =" getClassTree" >
11
+ <ClassMethod >1</ClassMethod >
12
+ <ReturnType >%ZEN.proxyObject</ReturnType >
13
+ <Implementation ><![CDATA[
14
+ set resp = ##class(%ZEN.proxyObject).%New()
15
+
16
+ set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
17
+ set objects = ##class(%Library.ArrayOfObjects).%New()
18
+ set lastParts = $LB()
19
+
20
+ set level = 1
21
+ do objects.SetAt(resp, level)
22
+
23
+ do classes.Execute()
24
+ while (classes.Next()) {
25
+ set name = classes.Data("Name")
26
+ set parts = $LISTFROMSTRING(name, ".")
27
+ set i = 0
28
+ while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
29
+ set i = i + 1
30
+ }
31
+ set level = i + 1
32
+ set resp = objects.GetAt(level)
33
+ while ($LISTLENGTH(parts) > level) {
34
+ set level = level + 1
35
+ set resp = ##class(%ZEN.proxyObject).%New()
36
+ do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
37
+ do objects.SetAt(resp, level)
38
+ }
39
+ if ($LISTLENGTH(parts) = level) {
40
+ do resp.%DispatchSetProperty($LISTGET(parts, level), classes.Data("Hidden"))
41
+ }
42
+ set lastParts = parts
43
+ }
44
+
45
+ quit objects.GetAt(1)
46
+ ]]> </Implementation >
47
+ </Method >
48
+
10
49
<Method name =" getClassData" >
11
50
<ClassMethod >1</ClassMethod >
12
51
<FormalSpec >classDefinition:%Dictionary.ClassDefinition</FormalSpec >
13
52
<ReturnType >%ZEN.proxyObject</ReturnType >
14
53
<Implementation ><![CDATA[
15
54
set oClass = ##class(%ZEN.proxyObject).%New()
55
+
16
56
set oProperties = ##class(%ZEN.proxyObject).%New()
17
57
set oClass.super = classDefinition.Super
18
58
set oClass.properties = oProperties
@@ -35,7 +75,31 @@ Class contains methods that return structured class data.</Description>
35
75
do oMeth.%DispatchSetProperty("returns", classDefinition.Methods.GetAt(i).ReturnType)
36
76
}
37
77
38
- return oClass
78
+ set oParameters = ##class(%ZEN.proxyObject).%New()
79
+ set oClass.parameters = oParameters
80
+ set count = classDefinition.Parameters.Count()
81
+ for i = 1:1:count {
82
+ set oPar = ##class(%ZEN.proxyObject).%New()
83
+ do oParameters.%DispatchSetProperty(classDefinition.Parameters.GetAt(i).Name, oPar)
84
+ do oPar.%DispatchSetProperty("type", classDefinition.Parameters.GetAt(i).Type)
85
+ }
86
+
87
+ quit oClass
88
+ ]]> </Implementation >
89
+ </Method >
90
+
91
+ <Method name =" extendClassFromType" >
92
+ <ClassMethod >1</ClassMethod >
93
+ <FormalSpec >typeName:%String</FormalSpec >
94
+ <ReturnType >%String</ReturnType >
95
+ <Implementation ><![CDATA[
96
+ return $CASE(typeName,
97
+ "%String": "%Library.String",
98
+ "%Integer": "%Library.Integer",
99
+ "%DataType": "%Library.DataType",
100
+ "%Status": "%Library.Status",
101
+ "%CacheString": "%Library.CacheString",
102
+ :typeName)
39
103
]]> </Implementation >
40
104
</Method >
41
105
@@ -50,7 +114,7 @@ Class contains methods that return structured class data.</Description>
50
114
}
51
115
set oInherit = oData.inheritance.%DispatchGetProperty(baseClassDefinition.Name)
52
116
for i=1:1:$LISTLENGTH(superParts) {
53
- set className = $LISTGET(superParts, i)
117
+ set className = ..extendClassFromType( $LISTGET(superParts, i) )
54
118
do oInherit.%DispatchSetProperty(className, 1)
55
119
if (oData.classes.%DispatchGetProperty(className) = "") {
56
120
set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
@@ -60,13 +124,14 @@ Class contains methods that return structured class data.</Description>
60
124
}
61
125
}
62
126
}
63
- return $$$OK
127
+ quit $$$OK
64
128
]]> </Implementation >
65
129
</Method >
66
130
67
131
<Method name =" getClassView" >
68
132
<ClassMethod >1</ClassMethod >
69
133
<FormalSpec >baseClassDefinition:%Dictionary.ClassDefinition</FormalSpec >
134
+ <ReturnType >%ZEN.proxyObject</ReturnType >
70
135
<Implementation ><![CDATA[
71
136
set oData = ##class(%ZEN.proxyObject).%New()
72
137
set oData.classes = ##class(%ZEN.proxyObject).%New()
@@ -75,17 +140,43 @@ Class contains methods that return structured class data.</Description>
75
140
76
141
do ..collectInheritance(oData, baseClassDefinition)
77
142
78
- return oData
143
+ quit oData
144
+ ]]> </Implementation >
145
+ </Method >
146
+
147
+ <Method name =" getPackageView" >
148
+ <ClassMethod >1</ClassMethod >
149
+ <FormalSpec >rootPackageName:%String</FormalSpec >
150
+ <ReturnType >%ZEN.proxyObject</ReturnType >
151
+ <Implementation ><![CDATA[
152
+ set oData = ##class(%ZEN.proxyObject).%New()
153
+ set oData.classes = ##class(%ZEN.proxyObject).%New()
154
+ set oData.inheritance = ##class(%ZEN.proxyObject).%New()
155
+
156
+ set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
157
+ do classes.Execute()
158
+ set listLen = $LISTLENGTH($LISTFROMSTRING(rootPackageName, "."))
159
+ while (classes.Next()) {
160
+ set className = classes.Data("Name")
161
+ set packageName = $LISTTOSTRING($LIST($LISTFROMSTRING(className, "."), 1, listLen), ".")
162
+ if (packageName = rootPackageName) {
163
+ set classDef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
164
+ do oData.classes.%DispatchSetProperty(classDef.Name, ..getClassData(classDef))
165
+ do ..collectInheritance(oData, classDef)
166
+ }
167
+ }
168
+
169
+ quit oData
79
170
]]> </Implementation >
80
171
</Method >
81
172
</Class >
82
173
83
174
84
- <Project name =" UMLExplorer" LastModified =" 2015-04-12 19:03:12.221887 " >
175
+ <Project name =" UMLExplorer" LastModified =" 2015-04-25 15:46:50.605954 " >
85
176
<Items >
86
- <ProjectItem name =" UMLExplorer.Router " type =" CLS" ></ ProjectItem >
87
- <ProjectItem name =" UMLExplorer.ClassView " type =" CLS" ></ ProjectItem >
88
- <ProjectItem name =" UMLExplorer.StaticContent" type =" CLS" ></ ProjectItem >
177
+ <ProjectItem name =" UMLExplorer.ClassView " type =" CLS" / >
178
+ <ProjectItem name =" UMLExplorer.Router " type =" CLS" / >
179
+ <ProjectItem name =" UMLExplorer.StaticContent" type =" CLS" / >
89
180
</Items >
90
181
</Project >
91
182
@@ -94,7 +185,7 @@ Class contains methods that return structured class data.</Description>
94
185
<Description >
95
186
REST interface for UMLExplorer</Description >
96
187
<Super >%CSP.REST</Super >
97
- <TimeChanged >63663,76166.562046 </TimeChanged >
188
+ <TimeChanged >63667,85509.960346 </TimeChanged >
98
189
<TimeCreated >63648,30450.187229</TimeCreated >
99
190
100
191
<XData name =" UrlMap" >
@@ -107,6 +198,7 @@ REST interface for UMLExplorer</Description>
107
198
<Route Url="/Test" Method="GET" Call="Test"/>
108
199
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
109
200
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
201
+ <Route Url="/GetPackageView/:PackageName" Method="GET" Call="GetPackageView"/>
110
202
</Routes>
111
203
]]> </Data >
112
204
</XData >
@@ -117,37 +209,7 @@ Method returns whole class tree visible in the current namespace.</Description>
117
209
<ClassMethod >1</ClassMethod >
118
210
<ReturnType >%Status</ReturnType >
119
211
<Implementation ><![CDATA[
120
- set resp = ##class(%ZEN.proxyObject).%New()
121
- set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
122
- set objects = ##class(%Library.ArrayOfObjects).%New()
123
- set lastParts = $LB()
124
-
125
- set level = 1
126
- do objects.SetAt(resp, level)
127
-
128
- do classes.Execute()
129
- While (classes.Next()) {
130
- set name = classes.Data("Name")
131
- set parts = $LISTFROMSTRING(name, ".")
132
- set i = 0
133
- while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
134
- set i = i + 1
135
- }
136
- set level = i + 1
137
- set resp = objects.GetAt(level)
138
- while ($LISTLENGTH(parts) > level) {
139
- set level = level + 1
140
- set resp = ##class(%ZEN.proxyObject).%New()
141
- do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
142
- do objects.SetAt(resp, level)
143
- }
144
- if ($LISTLENGTH(parts) = level) {
145
- do resp.%DispatchSetProperty($LISTGET(parts, level), classes.Data("Hidden"))
146
- }
147
- set lastParts = parts
148
- }
149
-
150
- do objects.GetAt(1).%ToJSON(, "ou")
212
+ do ##class(UMLExplorer.ClassView).getClassTree().%ToJSON(, "ou")
151
213
return $$$OK
152
214
]]> </Implementation >
153
215
</Method >
@@ -167,6 +229,19 @@ Returns classTree by given class name</Description>
167
229
]]> </Implementation >
168
230
</Method >
169
231
232
+ <Method name =" GetPackageView" >
233
+ <Description >
234
+ Returns all package class trees by given package name</Description >
235
+ <ClassMethod >1</ClassMethod >
236
+ <FormalSpec >packageName:%String</FormalSpec >
237
+ <ReturnType >%Status</ReturnType >
238
+ <Implementation ><![CDATA[
239
+ set classData = ##class(UMLExplorer.ClassView).getPackageView(packageName)
240
+ do classData.%ToJSON(, "ou")
241
+ return $$$OK
242
+ ]]> </Implementation >
243
+ </Method >
244
+
170
245
<Method name =" Test" >
171
246
<Description >
172
247
Method to test accessibility of REST interface.</Description >
0 commit comments