Skip to content

Commit 07a1316

Browse files
committed
New info in /Test: version, debug mode
1 parent 3da6d8d commit 07a1316

2 files changed

Lines changed: 41 additions & 1 deletion

File tree

MDX2JSON/AbstractREST.cls.xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,36 @@ Issue an '500' error and give some indication as to what occurred.<br>
252252
]]></Implementation>
253253
</Method>
254254

255+
<Method name="GetMappings">
256+
<Description>
257+
Retums info about MDX2JSON package mapping</Description>
258+
<ClassMethod>1</ClassMethod>
259+
<ReturnType>%ArrayOfObjects</ReturnType>
260+
<Implementation><![CDATA[
261+
Set result = ##class(%ArrayOfObjects).%New()
262+
Set mapped = ##class(%ListOfDataTypes).%New()
263+
Set unmapped = ##class(%ListOfDataTypes).%New()
264+
Set st = ##class(%CSP.Portal.Utils).%GetNamespaceList(.nslist)
265+
If $$$ISERR(st) Quit st
266+
Set namespace = $O(nslist(""))
267+
While namespace '= "" {
268+
Set enabled = $lg(nslist(namespace),1)
269+
If enabled = 1 {
270+
Set st = ..CheckNamespace(namespace)
271+
if $$$ISOK(st) {
272+
do mapped.Insert(namespace)
273+
} else {
274+
do unmapped.Insert(namespace)
275+
}
276+
}
277+
Set namespace = $O(nslist(namespace))
278+
}
279+
do result.SetAt(mapped,"Mapped")
280+
do result.SetAt(unmapped,"Unmapped")
281+
return result
282+
]]></Implementation>
283+
</Method>
284+
255285
<Method name="CheckNamespace">
256286
<Description><![CDATA[
257287
Returns OK if namespace both exists and contains MDX2JSON package.<br>

MDX2JSON/REST.cls.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,17 @@ Test method, outputs <b>%request</b>, <b>%response</b> and <b>%session</b> objec
103103
<ClassMethod>1</ClassMethod>
104104
<ReturnType>%Status</ReturnType>
105105
<Implementation><![CDATA[
106-
write "{"_ $$$ZENJSPAIR("Status","OK") _"," _ $$$ZENJSPAIR("User",$Username) _"}"
106+
set obj = ##class(%ZEN.proxyObject).%New()
107+
set obj.Status = "OK"
108+
set obj.User = $Username
109+
set obj.Version = "2.0"
110+
if $$$Debug {
111+
set obj.Roles = $Roles
112+
set obj.Namespace = $Namespace
113+
set obj.Mappings = ..GetMappings()
114+
set obj.Cache = $zv
115+
}
116+
do obj.%ToJSON()
107117
return $$$OK
108118
]]></Implementation>
109119
</Method>

0 commit comments

Comments
 (0)