4
4
<Class name =" UMLExplorer.ClassView" >
5
5
<Description >
6
6
Class contains methods that return structured class data.</Description >
7
- <TimeChanged >63667,81331.819092 </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()
16
55
17
-
18
56
set oProperties = ##class(%ZEN.proxyObject).%New()
19
57
set oClass.super = classDefinition.Super
20
58
set oClass.properties = oProperties
@@ -105,13 +143,39 @@ Class contains methods that return structured class data.</Description>
105
143
quit oData
106
144
]]> </Implementation >
107
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
170
+ ]]> </Implementation >
171
+ </Method >
108
172
</Class >
109
173
110
174
111
- <Project name =" UMLExplorer" LastModified =" 2015-04-12 19:03:12.221887 " >
175
+ <Project name =" UMLExplorer" LastModified =" 2015-04-25 15:46:50.605954 " >
112
176
<Items >
113
- <ProjectItem name =" UMLExplorer.Router" type =" CLS" ></ProjectItem >
114
177
<ProjectItem name =" UMLExplorer.ClassView" type =" CLS" ></ProjectItem >
178
+ <ProjectItem name =" UMLExplorer.Router" type =" CLS" ></ProjectItem >
115
179
<ProjectItem name =" UMLExplorer.StaticContent" type =" CLS" ></ProjectItem >
116
180
</Items >
117
181
</Project >
@@ -121,7 +185,7 @@ Class contains methods that return structured class data.</Description>
121
185
<Description >
122
186
REST interface for UMLExplorer</Description >
123
187
<Super >%CSP.REST</Super >
124
- <TimeChanged >63663,76166.562046 </TimeChanged >
188
+ <TimeChanged >63667,85509.960346 </TimeChanged >
125
189
<TimeCreated >63648,30450.187229</TimeCreated >
126
190
127
191
<XData name =" UrlMap" >
@@ -134,6 +198,7 @@ REST interface for UMLExplorer</Description>
134
198
<Route Url="/Test" Method="GET" Call="Test"/>
135
199
<Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
136
200
<Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
201
+ <Route Url="/GetPackageView/:PackageName" Method="GET" Call="GetPackageView"/>
137
202
</Routes>
138
203
]]> </Data >
139
204
</XData >
@@ -144,37 +209,7 @@ Method returns whole class tree visible in the current namespace.</Description>
144
209
<ClassMethod >1</ClassMethod >
145
210
<ReturnType >%Status</ReturnType >
146
211
<Implementation ><![CDATA[
147
- set resp = ##class(%ZEN.proxyObject).%New()
148
- set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
149
- set objects = ##class(%Library.ArrayOfObjects).%New()
150
- set lastParts = $LB()
151
-
152
- set level = 1
153
- do objects.SetAt(resp, level)
154
-
155
- do classes.Execute()
156
- While (classes.Next()) {
157
- set name = classes.Data("Name")
158
- set parts = $LISTFROMSTRING(name, ".")
159
- set i = 0
160
- while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
161
- set i = i + 1
162
- }
163
- set level = i + 1
164
- set resp = objects.GetAt(level)
165
- while ($LISTLENGTH(parts) > level) {
166
- set level = level + 1
167
- set resp = ##class(%ZEN.proxyObject).%New()
168
- do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
169
- do objects.SetAt(resp, level)
170
- }
171
- if ($LISTLENGTH(parts) = level) {
172
- do resp.%DispatchSetProperty($LISTGET(parts, level), classes.Data("Hidden"))
173
- }
174
- set lastParts = parts
175
- }
176
-
177
- do objects.GetAt(1).%ToJSON(, "ou")
212
+ do ##class(UMLExplorer.ClassView).getClassTree().%ToJSON(, "ou")
178
213
return $$$OK
179
214
]]> </Implementation >
180
215
</Method >
@@ -194,6 +229,19 @@ Returns classTree by given class name</Description>
194
229
]]> </Implementation >
195
230
</Method >
196
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
+
197
245
<Method name =" Test" >
198
246
<Description >
199
247
Method to test accessibility of REST interface.</Description >
0 commit comments