44<Class name =" UMLExplorer.ClassView" >
55<Description >
66Class contains methods that return structured class data.</Description >
7- <TimeChanged >63663,69939 </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()
55+
1656 set oProperties = ##class(%ZEN.proxyObject).%New()
1757 set oClass.super = classDefinition.Super
1858 set oClass.properties = oProperties
@@ -35,7 +75,31 @@ Class contains methods that return structured class data.</Description>
3575 do oMeth.%DispatchSetProperty("returns", classDefinition.Methods.GetAt(i).ReturnType)
3676 }
3777
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)
39103]]> </Implementation >
40104</Method >
41105
@@ -50,7 +114,7 @@ Class contains methods that return structured class data.</Description>
50114 }
51115 set oInherit = oData.inheritance.%DispatchGetProperty(baseClassDefinition.Name)
52116 for i=1:1:$LISTLENGTH(superParts) {
53- set className = $LISTGET(superParts, i)
117+ set className = ..extendClassFromType( $LISTGET(superParts, i) )
54118 do oInherit.%DispatchSetProperty(className, 1)
55119 if (oData.classes.%DispatchGetProperty(className) = "") {
56120 set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
@@ -60,13 +124,14 @@ Class contains methods that return structured class data.</Description>
60124 }
61125 }
62126 }
63- return $$$OK
127+ quit $$$OK
64128]]> </Implementation >
65129</Method >
66130
67131<Method name =" getClassView" >
68132<ClassMethod >1</ClassMethod >
69133<FormalSpec >baseClassDefinition:%Dictionary.ClassDefinition</FormalSpec >
134+ <ReturnType >%ZEN.proxyObject</ReturnType >
70135<Implementation ><![CDATA[
71136 set oData = ##class(%ZEN.proxyObject).%New()
72137 set oData.classes = ##class(%ZEN.proxyObject).%New()
@@ -75,17 +140,43 @@ Class contains methods that return structured class data.</Description>
75140
76141 do ..collectInheritance(oData, baseClassDefinition)
77142
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
79170]]> </Implementation >
80171</Method >
81172</Class >
82173
83174
84- <Project name =" UMLExplorer" LastModified =" 2015-04-12 19:03:12.221887 " >
175+ <Project name =" UMLExplorer" LastModified =" 2015-04-25 15:46:50.605954 " >
85176 <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" / >
89180 </Items >
90181</Project >
91182
@@ -94,7 +185,7 @@ Class contains methods that return structured class data.</Description>
94185<Description >
95186REST interface for UMLExplorer</Description >
96187<Super >%CSP.REST</Super >
97- <TimeChanged >63663,76166.562046 </TimeChanged >
188+ <TimeChanged >63667,85509.960346 </TimeChanged >
98189<TimeCreated >63648,30450.187229</TimeCreated >
99190
100191<XData name =" UrlMap" >
@@ -107,6 +198,7 @@ REST interface for UMLExplorer</Description>
107198 <Route Url="/Test" Method="GET" Call="Test"/>
108199 <Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
109200 <Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
201+ <Route Url="/GetPackageView/:PackageName" Method="GET" Call="GetPackageView"/>
110202</Routes>
111203]]> </Data >
112204</XData >
@@ -117,37 +209,7 @@ Method returns whole class tree visible in the current namespace.</Description>
117209<ClassMethod >1</ClassMethod >
118210<ReturnType >%Status</ReturnType >
119211<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")
151213 return $$$OK
152214]]> </Implementation >
153215</Method >
@@ -167,6 +229,19 @@ Returns classTree by given class name</Description>
167229]]> </Implementation >
168230</Method >
169231
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+
170245<Method name =" Test" >
171246<Description >
172247Method to test accessibility of REST interface.</Description >
0 commit comments