Skip to content

Commit 2a5c410

Browse files
committed
POtoStr refactoring into generic method
1 parent 4921dc9 commit 2a5c410

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

MDX2JSON/AbstractREST.cls.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,9 @@ This is the Schema which defines the form of the dispatch map</Description>
444444
]]></Data>
445445
</XData>
446446

447-
<Method name="POtoStr">
447+
<Method name="OutputToStr">
448448
<ClassMethod>1</ClassMethod>
449-
<FormalSpec>obj:%ZEN.proxyObject</FormalSpec>
449+
<FormalSpec>pObj:%ZEN.proxyObject,pMethod:%String="%ToJSON",pArgs...</FormalSpec>
450450
<ProcedureBlock>0</ProcedureBlock>
451451
<ReturnType>%String</ReturnType>
452452
<Implementation><![CDATA[
@@ -457,8 +457,12 @@ This is the Schema which defines the form of the dispatch map</Description>
457457
458458
//Enable redirection
459459
do ##class(%Device).ReDirectIO(1)
460-
461-
set st = obj.%ToJSON()
460+
461+
if $d(pArgs)= 0 {
462+
do $Method(pobj,pMethod)
463+
} else {
464+
do $Method(pobj,pMethod,pArgs)
465+
}
462466
463467
//Disable redirection
464468
do ##class(%Device).ReDirectIO(0)

MDX2JSON/Dashboard.cls.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ Converts relevant parts of %DeepSee.Dashboard.Widget object into %ZEN.proxyObjec
205205
do ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(overridestr,,.override,1) // convert it into %ZEN.proxyObject
206206
207207
#if $$$IsNewJSON // if we are on new versions
208-
set overridestr = ##class(MDX2JSON.AbstractREST).POtoStr(override) // convert it into valid json
208+
set overridestr = ##class(MDX2JSON.AbstractREST).OutputToStr(override,"%ToJSON") // convert it into valid json
209209
set override = ##class(%Object).$fromJSON(overridestr) // and into %Object
210210
#endif
211211

MDX2JSON/REST.cls.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Wrapper for ##class(MDX2JSON.Users).SetConfig()</Description>
305305
<Implementation><![CDATA[
306306
set config = $$$R("Config")
307307
if (($IsObject(config)) && (config.%IsA("%ZEN.proxyObject"))) {
308-
set config = ..POtoStr(config)
308+
set config = ..OutputToStr(config,"%ToJSON")
309309
}
310310
return ##class(MDX2JSON.Users).SetConfig($$$R("Application"),config)
311311
]]></Implementation>

0 commit comments

Comments
 (0)