|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<Export generator="Cache" version="25"> |
| 3 | +<Class name="kutac.REST.ConfigBroker"> |
| 4 | +<IncludeCode>%ZEN.Utils</IncludeCode> |
| 5 | +<Super>%CSP.REST</Super> |
| 6 | +<TimeCreated>64469,36696.045094</TimeCreated> |
| 7 | + |
| 8 | +<XData name="UrlMap"> |
| 9 | +<Data><![CDATA[ |
| 10 | +<Routes> |
| 11 | +<Route Url="/classes" Method="GET" Call="getClasses"/> |
| 12 | +<Route Url="/class" Method="POST" Call="toggleClass"/> |
| 13 | +<Route Url="/mon" Method="GET" Call="checkMon"/> |
| 14 | +<Route Url="/mon" Method="POST" Call="toggleMon"/> |
| 15 | +<Route Url="/email" Method="GET" Call="getEmailSettings"/> |
| 16 | +<Route Url="/email" Method="POST" Call="setEmailSettings"/> |
| 17 | +<Route Url="/email_toggle" Method="POST" Call="toggleEmail"/> |
| 18 | +<Route Url="/test_mail" Method="GET" Call="testMail"/> |
| 19 | +<Route Url="/recipient" Method="GET" Call="getRecipients"/> |
| 20 | +<Route Url="/recipient" Method="POST" Call="addRecipient"/> |
| 21 | +<Route Url="/recipient" Method="DELETE" Call="deleteRecipient"/> |
| 22 | +</Routes> |
| 23 | +]]></Data> |
| 24 | +</XData> |
| 25 | + |
| 26 | +<Method name="getClasses"> |
| 27 | +<ClassMethod>1</ClassMethod> |
| 28 | +<ReturnType>%Status</ReturnType> |
| 29 | +<Implementation><![CDATA[ quit ##class(kutac.REST.Utils).getClasses() |
| 30 | +]]></Implementation> |
| 31 | +</Method> |
| 32 | + |
| 33 | +<Method name="toggleClass"> |
| 34 | +<ClassMethod>1</ClassMethod> |
| 35 | +<ReturnType>%Status</ReturnType> |
| 36 | +<Implementation><![CDATA[ |
| 37 | + do ..ConvertRequestBody() |
| 38 | + quit ##class(kutac.REST.Utils).toggleClass(%request.Content.classname, %request.Content.check) |
| 39 | +]]></Implementation> |
| 40 | +</Method> |
| 41 | + |
| 42 | +<Method name="checkMon"> |
| 43 | +<ClassMethod>1</ClassMethod> |
| 44 | +<ReturnType>%Status</ReturnType> |
| 45 | +<Implementation><![CDATA[ quit ##class(kutac.REST.Utils).checkMon() |
| 46 | +]]></Implementation> |
| 47 | +</Method> |
| 48 | + |
| 49 | +<Method name="toggleMon"> |
| 50 | +<ClassMethod>1</ClassMethod> |
| 51 | +<ReturnType>%Status</ReturnType> |
| 52 | +<Implementation><![CDATA[ |
| 53 | + do ..ConvertRequestBody() |
| 54 | + quit ##class(kutac.REST.Utils).toggleMon(%request.Content.toggle) |
| 55 | +]]></Implementation> |
| 56 | +</Method> |
| 57 | + |
| 58 | +<Method name="getEmailSettings"> |
| 59 | +<ClassMethod>1</ClassMethod> |
| 60 | +<Implementation><![CDATA[ quit ##class(kutac.REST.Utils).getEmailSettings() |
| 61 | +]]></Implementation> |
| 62 | +</Method> |
| 63 | + |
| 64 | +<Method name="setEmailSettings"> |
| 65 | +<ClassMethod>1</ClassMethod> |
| 66 | +<Implementation><![CDATA[ |
| 67 | + do ..ConvertRequestBody() |
| 68 | + set obj = %request.Content |
| 69 | + |
| 70 | + quit ##class(kutac.REST.Utils).setEmailSettings(obj) |
| 71 | +]]></Implementation> |
| 72 | +</Method> |
| 73 | + |
| 74 | +<Method name="toggleEmail"> |
| 75 | +<ClassMethod>1</ClassMethod> |
| 76 | +<Implementation><![CDATA[ |
| 77 | + do ..ConvertRequestBody() |
| 78 | + quit ##class(kutac.REST.Utils).toggleEmail(%request.Content.toggle) |
| 79 | +]]></Implementation> |
| 80 | +</Method> |
| 81 | + |
| 82 | +<Method name="getRecipients"> |
| 83 | +<ClassMethod>1</ClassMethod> |
| 84 | +<Implementation><![CDATA[ quit ##class(kutac.REST.Utils).getRecipients() |
| 85 | +]]></Implementation> |
| 86 | +</Method> |
| 87 | + |
| 88 | +<Method name="addRecipient"> |
| 89 | +<ClassMethod>1</ClassMethod> |
| 90 | +<Implementation><![CDATA[ |
| 91 | + do ..ConvertRequestBody() |
| 92 | + quit ##class(kutac.REST.Utils).addRecipient(%request.Content.rec) |
| 93 | +]]></Implementation> |
| 94 | +</Method> |
| 95 | + |
| 96 | +<Method name="deleteRecipient"> |
| 97 | +<ClassMethod>1</ClassMethod> |
| 98 | +<Implementation><![CDATA[ |
| 99 | + do ..ConvertRequestBody() |
| 100 | + quit ##class(kutac.REST.Utils).deleteRecipient(%request.Content.rec) |
| 101 | +]]></Implementation> |
| 102 | +</Method> |
| 103 | + |
| 104 | +<Method name="testMail"> |
| 105 | +<ClassMethod>1</ClassMethod> |
| 106 | +<Implementation><![CDATA[ quit ##class(kutac.REST.Utils).testMail() |
| 107 | +]]></Implementation> |
| 108 | +</Method> |
| 109 | + |
| 110 | +<Method name="ConvertRequestBody"> |
| 111 | +<ClassMethod>1</ClassMethod> |
| 112 | +<ReturnType>%Status</ReturnType> |
| 113 | +<Implementation><![CDATA[ |
| 114 | + #dim %request As %CSP.Request |
| 115 | + #dim obj As %ZEN.proxyObject |
| 116 | +
|
| 117 | + return:'$isobject(%request.Content) $$$OK //empty request body - nothing to do |
| 118 | +
|
| 119 | + // Convert request body into UTF8 proxyObject |
| 120 | + set content = %request.Content.Read($$$MaxStringLength) |
| 121 | + set content = $ZCVT(content,"I","UTF8") |
| 122 | + set st = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(content,,.obj,1) |
| 123 | + return:$$$ISERR(st) st |
| 124 | + return:'$IsObject(obj) $$$ERROR($$$ArgumentIsNotAnObject,"Body") |
| 125 | +
|
| 126 | + set %request.Content = obj // obj here is a valid UTF8 proxyObject with required property |
| 127 | + return $$$OK |
| 128 | +]]></Implementation> |
| 129 | +</Method> |
| 130 | + |
| 131 | +<Parameter name="CHARSET"> |
| 132 | +<Description><![CDATA[ |
| 133 | +Specifies the default character set for the page. This can be overriden using the |
| 134 | +<CSP:CONTENT CHARSET=> tag, or by setting the <b>%response</b>.CharSet property |
| 135 | +in the <method>OnPreHTTP</method> method. If this parameter is not specified, then |
| 136 | +for the default charset is utf-8.]]></Description> |
| 137 | +<Default>UTF-8</Default> |
| 138 | +</Parameter> |
| 139 | +</Class> |
| 140 | +</Export> |
0 commit comments