44<Class name =" UMLExplorer.ClassView" >
55<Description >
66Class contains methods that return structured class data.</Description >
7- <TimeChanged >63667,81331.819092 </TimeChanged >
7+ <TimeChanged >63668,773.59952 </TimeChanged >
88<TimeCreated >63653,67019.989197</TimeCreated >
99
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+
1049<Method name =" getClassData" >
1150<ClassMethod >1</ClassMethod >
1251<FormalSpec >classDefinition:%Dictionary.ClassDefinition</FormalSpec >
1352<ReturnType >%ZEN.proxyObject</ReturnType >
1453<Implementation ><![CDATA[
1554 set oClass = ##class(%ZEN.proxyObject).%New()
1655
17-
1856 set oProperties = ##class(%ZEN.proxyObject).%New()
1957 set oClass.super = classDefinition.Super
2058 set oClass.properties = oProperties
@@ -105,13 +143,39 @@ Class contains methods that return structured class data.</Description>
105143 quit oData
106144]]> </Implementation >
107145</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 >
108172</Class >
109173
110174
111- <Project name =" UMLExplorer" LastModified =" 2015-04-12 19:03:12.221887 " >
175+ <Project name =" UMLExplorer" LastModified =" 2015-04-25 15:46:50.605954 " >
112176 <Items >
113- <ProjectItem name =" UMLExplorer.Router" type =" CLS" ></ProjectItem >
114177 <ProjectItem name =" UMLExplorer.ClassView" type =" CLS" ></ProjectItem >
178+ <ProjectItem name =" UMLExplorer.Router" type =" CLS" ></ProjectItem >
115179 <ProjectItem name =" UMLExplorer.StaticContent" type =" CLS" ></ProjectItem >
116180 </Items >
117181</Project >
@@ -121,7 +185,7 @@ Class contains methods that return structured class data.</Description>
121185<Description >
122186REST interface for UMLExplorer</Description >
123187<Super >%CSP.REST</Super >
124- <TimeChanged >63663,76166.562046 </TimeChanged >
188+ <TimeChanged >63667,85509.960346 </TimeChanged >
125189<TimeCreated >63648,30450.187229</TimeCreated >
126190
127191<XData name =" UrlMap" >
@@ -134,6 +198,7 @@ REST interface for UMLExplorer</Description>
134198 <Route Url="/Test" Method="GET" Call="Test"/>
135199 <Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
136200 <Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
201+ <Route Url="/GetPackageView/:PackageName" Method="GET" Call="GetPackageView"/>
137202</Routes>
138203]]> </Data >
139204</XData >
@@ -144,37 +209,7 @@ Method returns whole class tree visible in the current namespace.</Description>
144209<ClassMethod >1</ClassMethod >
145210<ReturnType >%Status</ReturnType >
146211<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")
178213 return $$$OK
179214]]> </Implementation >
180215</Method >
@@ -194,6 +229,19 @@ Returns classTree by given class name</Description>
194229]]> </Implementation >
195230</Method >
196231
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+
197245<Method name =" Test" >
198246<Description >
199247Method to test accessibility of REST interface.</Description >
0 commit comments