Skip to content

Commit a5e0f4d

Browse files
committed
ExecuteAction method. To execute call /Action/:Cube/:Action POST
1 parent b86d2dd commit a5e0f4d

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

MDX2JSON/MDX2JSON.inc.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
<Routine name="MDX2JSON.MDX2JSON" type="INC"><![CDATA[
44
#include %occErrors
55
#include %ZEN.Utils
6+
#include %DeepSee
7+
68
#define get(%name) $get(%request.Data(%name,1))
79
#define WebContext $d(%request)'=0
810
#define Debug (($$$WebContext) && ($d(%request.Data("Debug"))))

MDX2JSON/REST.cls.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Example: send HTTP GET request to web application with Dispatch class <b>MDX2JSO
6060
<Route Url="/Dashboards" Method="POST" Call="GetDashboardList" Body="Folder"/>
6161
<Route Url="/Dashboard" Method="POST" Call="GetDashboard" Body="Dashboard"/>
6262
<Route Url="/Widgets" Method="POST" Call="GetWidgetsList" Body="Dashboard"/>
63+
<Route Url="/Action/:Cube/:Action" Method="POST" Call="ExecuteAction"/>
6364
6465
<!-- Get info about system format and locale-->
6566
<Route Url="/Format" Method="GET" Call="GetFormat"/>
@@ -339,5 +340,16 @@ Wrapper for ##class(MDX2JSON.Users).SetConfig()</Description>
339340
return ##class(%DeepSee.UserLibrary.Utils).%RemoveFavorite(Name)
340341
]]></Implementation>
341342
</Method>
343+
344+
<Method name="ExecuteAction">
345+
<ClassMethod>1</ClassMethod>
346+
<FormalSpec>Cube:%String,Action:%String</FormalSpec>
347+
<ReturnType>%Status</ReturnType>
348+
<Implementation><![CDATA[
349+
set Cube = $ZCONVERT($ZCONVERT(Cube ,"I","URL") ,"I","UTF8")
350+
set Action = $ZCONVERT($ZCONVERT(Action ,"I","URL") ,"I","UTF8")
351+
return ##class(MDX2JSON.Utils).ExecuteAction(Cube,Action,%request.Content)
352+
]]></Implementation>
353+
</Method>
342354
</Class>
343355
</Export>

MDX2JSON/Utils.cls.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,20 @@ Get format defaults.</Description>
283283
return st
284284
]]></Implementation>
285285
</Method>
286+
287+
<Method name="ExecuteAction">
288+
<ClassMethod>1</ClassMethod>
289+
<FormalSpec>Cube:%String,Action:%String,Context:%ZEN.proxyObject=##class(%ZEN.proxyObject).%New()</FormalSpec>
290+
<ReturnType>%Status</ReturnType>
291+
<Implementation><![CDATA[
292+
set st = $$$OK
293+
set Cube = $$$UPPER(Cube)
294+
set ActionClass = $G($$$DeepSeeMetaGLVN("cubes",Cube,"actionClass"))
295+
if (ActionClass'="") {
296+
set st = $classmethod(ActionClass,"%OnDashboardAction",Action,Context)
297+
}
298+
return st
299+
]]></Implementation>
300+
</Method>
286301
</Class>
287302
</Export>

0 commit comments

Comments
 (0)