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 16:26:04.713512" >
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 >63653,74965.264444</TimeChanged >
96
+ <TimeCreated >63648,30450.187229</TimeCreated >
97
+
98
+ <XData name =" UrlMap" >
99
+ <Data ><![CDATA[
100
+ <Routes>
101
+ <Route Url="/Test" Method="GET" Call="Test"/>
102
+ <Route Url="/GetClassTree" Method="GET" Call="GetClassTree"/>
103
+ <Route Url="/GetClassView/:ClassName" Method="GET" Call="GetClassView"/>
104
+ </Routes>
105
+ ]]> </Data >
106
+ </XData >
107
+
108
+ <Method name =" GetClassTree" >
109
+ <Description >
110
+ Method returns whole class tree visible in the current namespace.</Description >
111
+ <ClassMethod >1</ClassMethod >
112
+ <ReturnType >%Status</ReturnType >
113
+ <Implementation ><![CDATA[
114
+ set resp = ##class(%ZEN.proxyObject).%New()
115
+ set classes = ##class(%ResultSet).%New("%Dictionary.ClassDefinition:Summary")
116
+ set objects = ##class(%Library.ArrayOfObjects).%New()
117
+ set lastParts = $LB()
118
+
119
+ set level = 1
120
+ do objects.SetAt(resp, level)
121
+
122
+ do classes.Execute()
123
+ While (classes.Next()) {
124
+ set name = classes.Data("Name")
125
+ set parts = $LISTFROMSTRING(name, ".")
126
+ set i = 0
127
+ while (i < $LISTLENGTH(parts)) && ($LISTGET(lastParts, i + 1) = $LISTGET(parts, i + 1)) {
128
+ set i = i + 1
129
+ }
130
+ set level = i + 1
131
+ set resp = objects.GetAt(level)
132
+ while ($LISTLENGTH(parts) > level) {
133
+ set level = level + 1
134
+ set resp = ##class(%ZEN.proxyObject).%New()
135
+ do objects.GetAt(level - 1).%DispatchSetProperty($LISTGET(parts, level - 1), resp)
136
+ do objects.SetAt(resp, level)
137
+ }
138
+ if ($LISTLENGTH(parts) = level) {
139
+ do resp.%DispatchSetProperty($LISTGET(parts, level), classes.Data("Hidden"))
140
+ }
141
+ set lastParts = parts
142
+ }
143
+
144
+ do objects.GetAt(1).%ToJSON(, "ou")
145
+ return $$$OK
146
+ ]]> </Implementation >
147
+ </Method >
148
+
149
+ <Method name =" GetClassView" >
150
+ <Description >
151
+ Returns classTree by given class name</Description >
152
+ <ClassMethod >1</ClassMethod >
153
+ <FormalSpec >className:%String</FormalSpec >
154
+ <ReturnType >%Status</ReturnType >
155
+ <Implementation ><![CDATA[
156
+ set cdef = ##class(%Dictionary.ClassDefinition).%OpenId(className)
157
+ if (cdef = "") quit ..Http404()
158
+ set classData = ##class(UMLExplorer.ClassView).getClassView(cdef)
159
+ do classData.%ToJSON(, "ou")
160
+ return $$$OK
161
+ ]]> </Implementation >
162
+ </Method >
163
+
164
+ <Method name =" Test" >
165
+ <Description >
166
+ Method to test accessibility of REST interface.</Description >
167
+ <ClassMethod >1</ClassMethod >
168
+ <ReturnType >%Status</ReturnType >
169
+ <Implementation ><![CDATA[
170
+ set resp = ##class(%ZEN.proxyObject).%New()
171
+ set resp2 = ##class(%ZEN.proxyObject).%New()
172
+ set resp2.Status = "OK"
173
+ set resp.obj = resp2
174
+ do resp.%ToJSON(, "o")
175
+ return $$$OK
176
+ ]]> </Implementation >
177
+ </Method >
178
+ </Class >
179
+ </Export >
0 commit comments