1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <Export generator =" Cache" version =" 25" zv =" Cache for Windows (x86-64) 2015.2 (Build 540)" ts =" 2015-04-12 16:26:04" >
3+ <Class name =" UMLExplorer.ClassView" >
4+ <Description >
5+ Class contains methods that return structured class data.</Description >
6+ <TimeChanged >63654,59126.207802</TimeChanged >
7+ <TimeCreated >63653,67019.989197</TimeCreated >
8+
9+ <Method name =" getClassData" >
10+ <ClassMethod >1</ClassMethod >
11+ <FormalSpec >classDefinition:%Dictionary.ClassDefinition</FormalSpec >
12+ <ReturnType >%ZEN.proxyObject</ReturnType >
13+ <Implementation ><![CDATA[
14+ set oClass = ##class(%ZEN.proxyObject).%New()
15+ set oProperties = ##class(%ZEN.proxyObject).%New()
16+ set oClass.super = classDefinition.Super
17+ set oClass.properties = oProperties
18+ set count = classDefinition.Properties.Count()
19+ for i = 1:1:count {
20+ set oProp = ##class(%ZEN.proxyObject).%New()
21+ do oProperties.%DispatchSetProperty(classDefinition.Properties.GetAt(i).Name, oProp)
22+ do oProp.%DispatchSetProperty("private", classDefinition.Properties.GetAt(i).Private)
23+ do oProp.%DispatchSetProperty("readOnly", classDefinition.Properties.GetAt(i).ReadOnly)
24+ do oProp.%DispatchSetProperty("type", classDefinition.Properties.GetAt(i).Type)
25+ }
26+
27+ set oMethods = ##class(%ZEN.proxyObject).%New()
28+ set oClass.methods = oMethods
29+ set count = classDefinition.Methods.Count()
30+ for i = 1:1:count {
31+ set oMeth = ##class(%ZEN.proxyObject).%New()
32+ do oMethods.%DispatchSetProperty(classDefinition.Methods.GetAt(i).Name, oMeth)
33+ do oMeth.%DispatchSetProperty("private", classDefinition.Methods.GetAt(i).Private)
34+ do oMeth.%DispatchSetProperty("returns", classDefinition.Methods.GetAt(i).ReturnType)
35+ }
36+
37+ return oClass
38+ ]]> </Implementation >
39+ </Method >
40+
41+ <Method name =" collectInheritance" >
42+ <ClassMethod >1</ClassMethod >
43+ <FormalSpec >oData:%ZEN.proxyObject,baseClassDefinition:%Dictionary.ClassDefinition</FormalSpec >
44+ <ReturnType >%Status</ReturnType >
45+ <Implementation ><![CDATA[
46+ set superParts = $LISTFROMSTRING(baseClassDefinition.Super, ",")
47+ if (oData.inheritance.%DispatchGetProperty(baseClassDefinition.Name) = "") {
48+ do oData.inheritance.%DispatchSetProperty(baseClassDefinition.Name, ##class(%ZEN.proxyObject).%New())
49+ }
50+ set oInherit = oData.inheritance.%DispatchGetProperty(baseClassDefinition.Name)
51+ for i=1:1:$LISTLENGTH(superParts) {
52+ set className = $LISTGET(superParts, i)
53+ do oInherit.%DispatchSetProperty(className, 1)
54+ if (oData.classes.%DispatchGetProperty(className) = "") {
55+ set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
56+ if (cdef '= "") {
57+ do oData.classes.%DispatchSetProperty(className, ..getClassData(cdef))
58+ do ..collectInheritance(oData, cdef)
59+ }
60+ }
61+ }
62+ return $$$OK
63+ ]]> </Implementation >
64+ </Method >
65+
66+ <Method name =" getClassView" >
67+ <ClassMethod >1</ClassMethod >
68+ <FormalSpec >baseClassDefinition:%Dictionary.ClassDefinition</FormalSpec >
69+ <Implementation ><![CDATA[
70+ set oData = ##class(%ZEN.proxyObject).%New()
71+ set oData.classes = ##class(%ZEN.proxyObject).%New()
72+ set oData.inheritance = ##class(%ZEN.proxyObject).%New()
73+ do oData.classes.%DispatchSetProperty(baseClassDefinition.Name, ..getClassData(baseClassDefinition))
74+
75+ do ..collectInheritance(oData, baseClassDefinition)
76+
77+ return oData
78+ ]]> </Implementation >
79+ </Method >
80+ </Class >
81+
82+
83+ <Project name =" UMLExplorer" LastModified =" 2015-04-12 19:03:12.221887" >
84+ <Items >
85+ <ProjectItem name =" UMLExplorer.Router" type =" CLS" ></ProjectItem >
86+ <ProjectItem name =" UMLExplorer.ClassView" type =" CLS" ></ProjectItem >
87+ </Items >
88+ </Project >
89+
90+
91+ <Class name =" UMLExplorer.Router" >
92+ <Description >
93+ REST interface for UMLExplorer</Description >
94+ <Super >%CSP.REST</Super >
95+ <TimeChanged >63654,68682.349536</TimeChanged >
96+ <TimeCreated >63648,30450.187229</TimeCreated >
97+
98+ <XData name =" UrlMap" >
99+ <Data ><![CDATA[
100+ <Routes>
101+ <Route Url="/" Method="GET" Call="Index"/>
102+ <Route Url="/index" Method="GET" Call="Index"/>
103+ <Route Url="/Test" Method="GET" Call="Test"/>
104+ <Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
105+ <Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
106+ </Routes>
107+ ]]> </Data >
108+ </XData >
109+
110+ <Method name =" GetClassTree" >
111+ <Description >
112+ Method returns whole class tree visible in the current namespace.</Description >
113+ <ClassMethod >1</ClassMethod >
114+ <ReturnType >%Status</ReturnType >
115+ <Implementation ><![CDATA[
116+ set resp = ##class(%ZEN.proxyObject).%New()
117+ set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
118+ set objects = ##class(%Library.ArrayOfObjects).%New()
119+ set lastParts = $LB()
120+
121+ set level = 1
122+ do objects.SetAt(resp, level)
123+
124+ do classes.Execute()
125+ While (classes.Next()) {
126+ set name = classes.Data("Name")
127+ set parts = $LISTFROMSTRING(name, ".")
128+ set i = 0
129+ while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
130+ set i = i + 1
131+ }
132+ set level = i + 1
133+ set resp = objects.GetAt(level)
134+ while ($LISTLENGTH(parts) > level) {
135+ set level = level + 1
136+ set resp = ##class(%ZEN.proxyObject).%New()
137+ do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
138+ do objects.SetAt(resp, level)
139+ }
140+ if ($LISTLENGTH(parts) = level) {
141+ do resp.%DispatchSetProperty($LISTGET(parts, level), classes.Data("Hidden"))
142+ }
143+ set lastParts = parts
144+ }
145+
146+ do objects.GetAt(1).%ToJSON(, "ou")
147+ return $$$OK
148+ ]]> </Implementation >
149+ </Method >
150+
151+ <Method name =" GetClassView" >
152+ <Description >
153+ Returns classTree by given class name</Description >
154+ <ClassMethod >1</ClassMethod >
155+ <FormalSpec >className:%String</FormalSpec >
156+ <ReturnType >%Status</ReturnType >
157+ <Implementation ><![CDATA[
158+ set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
159+ if (cdef = "") quit ..Http404()
160+ set classData = ##class(UMLExplorer.ClassView).getClassView(cdef)
161+ do classData.%ToJSON(, "ou")
162+ return $$$OK
163+ ]]> </Implementation >
164+ </Method >
165+
166+ <Method name =" Test" >
167+ <Description >
168+ Method to test accessibility of REST interface.</Description >
169+ <ClassMethod >1</ClassMethod >
170+ <ReturnType >%Status</ReturnType >
171+ <Implementation ><![CDATA[
172+ set resp = ##class(%ZEN.proxyObject).%New()
173+ set resp2 = ##class(%ZEN.proxyObject).%New()
174+ set resp2.Status = "OK"
175+ set resp.obj = resp2
176+ do resp.%ToJSON(, "o")
177+ return $$$OK
178+ ]]> </Implementation >
179+ </Method >
180+
181+ <Method name =" Index" >
182+ <Description >
183+ Method returns user application.</Description >
184+ <ClassMethod >1</ClassMethod >
185+ <ReturnType >%Status</ReturnType >
186+ <Implementation ><![CDATA[
187+ &html<{{replace:HTML}}>
188+ return $$$OK
189+ ]]> </Implementation >
190+ </Method >
191+ </Class >
192+ </Export >
0 commit comments