diff --git a/MDX2JSON/AbstractREST.cls.xml b/MDX2JSON/AbstractREST.cls.xml index b7bda35..a2f34b5 100644 --- a/MDX2JSON/AbstractREST.cls.xml +++ b/MDX2JSON/AbstractREST.cls.xml @@ -1,5 +1,5 @@ - + All logic related to the proceccing of http requests. @@ -12,6 +12,10 @@ All logic related to the proceccing of http requests. 1 + +1 + + @@ -34,6 +38,12 @@ Add param Namespace to a request to execute MDX in desired namespace.]]> #; Don't want the session token Set %response.OutputSessionToken = 0 - #; We don't want Basic authentication usually - Do:$$$Debug %response.SetHeader("WWW-Authenticate","Basic") + #; We want Basic authentication + //Do %response.SetHeader("WWW-Authenticate","Basic") #; We need to manually write out the headers here because PAGE has not been called Do %response.WriteHTTPHeader() @@ -254,10 +265,7 @@ Issue an '500' error and give some indication as to what occurred.
// we are expecting status #; Set the response Http status Set %response.Status="500 Internal Server Error" - - #; Skip duplicate calls - Quit:$isObject(pStatus) $$$OK - + #; Return a helpful error string Write "{""Error"":"_$$$ZENJSSTR($System.Status.GetErrorText(pStatus,%session.Language))_"}" @@ -308,21 +316,15 @@ Returns OK if namespace both exists and contains MDX2JSON package.
return $$$OK } - return:('##class(%SYS.Namespace).Exists(Namespace)) $$$ERROR($$$NamespaceUnavailable, Namespace) - new $Namespace - set $Namespace = Namespace - - set class = "MDX2JSON.Utils" - - set exists = ##class(%Dictionary.CompiledClass).%ExistsId(class) - return:(exists=$$$NO) $$$ERROR($$$GeneralError, "MDX2JSON package is not mapped to " _ Namespace) - - // If the current namespace holds unmapped MDX2JSON, include it regardless of dashboards existence - return:(##class(%RoutineMgr).IsMapped(class _ ".cls") = $$$NO) $$$OK - - // Strictly speaking this can be a false-positive check - set exists = ($data(@##class(MDX2JSON.DashboardRS).#global)>0) - return:(exists=$$$NO) $$$ERROR($$$GeneralError, "No dashboards exist in " _ Namespace) + return:('##class(%SYS.Namespace).Exists(Namespace)) $$$ERROR($$$NamespaceUnavailable,Namespace) + + if Namespace'=$Namespace { + set oldNS = $Namespace + zn Namespace + set exists = ##class(%Dictionary.CompiledClass).%ExistsId("MDX2JSON.Utils") + zn oldNS + return:(exists=0) $$$ERROR($$$GeneralError, "MDX2JSON package is not mapped to " _ Namespace) + } return $$$OK ]]>
@@ -333,10 +335,11 @@ Returns OK if namespace both exists and contains MDX2JSON package.
This project creates the DispatchMethod used to dispatch the Url and Method to the associated target method
1 generator -pIndex:%Integer +pIndex:%String,pMethod:%String,*pResourceMatched:%Boolean,*pMatcher:%Regex.Matcher %String 0 %String - + Class with methods related to DeepSee Dashboard and Widget processing. @@ -87,26 +87,26 @@ Opens DeepSee dashboard by it's name. Returns status of aatempt to locate and op DashName:%Integer,*Dashboard:%DeepSee.Dashboard.Definition %Status
@@ -460,7 +460,7 @@ Returns name of widget's pivot source cube. -%Library.CacheStorage +%Storage.Persistent diff --git a/MDX2JSON/DashboardFilters.cls.xml b/MDX2JSON/DashboardFilters.cls.xml index ccde7e3..110af55 100644 --- a/MDX2JSON/DashboardFilters.cls.xml +++ b/MDX2JSON/DashboardFilters.cls.xml @@ -1,5 +1,5 @@ - + Class with methods related to DeepSee Dashboard and Widget processing. diff --git a/MDX2JSON/DashboardRS.cls.xml b/MDX2JSON/DashboardRS.cls.xml index cb89b31..dcb7a76 100644 --- a/MDX2JSON/DashboardRS.cls.xml +++ b/MDX2JSON/DashboardRS.cls.xml @@ -1,5 +1,5 @@ - + Custom result set to get dashboard list, visible to user in a specific folder @@ -41,9 +41,9 @@ Custom result set to get dashboard list, visible to user in a specific folder%Status @@ -52,16 +52,16 @@ Custom result set to get dashboard list, visible to user in a specific folder%Execute %Integer @@ -71,11 +71,11 @@ Iterate over data global till we find dashboard definition thet satisfies all conditions @@ -87,18 +87,18 @@ Check if element with that id satisfies our conditions id:%String @@ -183,7 +183,7 @@ do ##class(MDX2JSON.DashboardRS).Test() - Execute query and output results as JSON + Execute query and output results as JSON 1 folderName:%String="" while rs.%Next() { write:separator ",",$$$CRLF write "{" - write $$$ZENJSONPAIR("title",rs.title,""),"," - write $$$ZENJSONPAIR("path",rs.path,""),"," - write $$$ZENJSONPAIR("Cover",rs.cover,"") - write "}" - - set separator = 1 - } - write "]}" + write $$$ZENJSONPAIR("title",rs.title,""),"," + write $$$ZENJSONPAIR("path",rs.path,""),"," + write $$$ZENJSONPAIR("Cover",rs.cover,"") + write "}" + + set separator = 1 + } + write "]}" ]]>
diff --git a/MDX2JSON/EmptyPortlet.cls.xml b/MDX2JSON/EmptyPortlet.cls.xml index 1281e6c..4a4408d 100644 --- a/MDX2JSON/EmptyPortlet.cls.xml +++ b/MDX2JSON/EmptyPortlet.cls.xml @@ -1,5 +1,5 @@ - + %DeepSee.Component.Portlet.abstractPortlet 63677,67001.020851 diff --git a/MDX2JSON/Installer.cls.xml b/MDX2JSON/Installer.cls.xml index 13a7638..0d084b5 100644 --- a/MDX2JSON/Installer.cls.xml +++ b/MDX2JSON/Installer.cls.xml @@ -1,5 +1,5 @@ - + 63481,77165.410085 @@ -29,7 +29,7 @@ todo add optional parameter WEBAPP to Alter web app name if it needs to have ano - + @@ -163,30 +163,30 @@ Do ##class(MDX2JSON.Installer).setup(.pVars) - Owner - The name of the repository owner.
- Repository - The name of the repository.
- Branch - The name of the commit/branch/tag. If skipped the repository’s default branch (usually master) would be used.
- Username - GitHub user, who has access to repository. Optional for public repositories.
- Password - GitHub password, corresponding to Username. Optional for public repositories.
- Note, that with Username, you can make up to 5,000 requests per hour. - For unauthenticated requests, the rate limit allows to make up to 60 requests per hour. - Unauthenticated requests are associated with an IP address.
- Namespace - Namespace, where to download and compile repository.
- - For example in the repository: https://github.com/intersystems-ru/Cache-MDX2JSON
- Owner - intersystems-ru, Repository - Cache-MDX2JSON.
]]>
+ Owner - The name of the repository owner.
+ Repository - The name of the repository.
+ Branch - The name of the commit/branch/tag. If skipped the repository’s default branch (usually master) would be used.
+ Username - GitHub user, who has access to repository. Optional for public repositories.
+ Password - GitHub password, corresponding to Username. Optional for public repositories.
+ Note, that with Username, you can make up to 5,000 requests per hour. + For unauthenticated requests, the rate limit allows to make up to 60 requests per hour. + Unauthenticated requests are associated with an IP address.
+ Namespace - Namespace, where to download and compile repository.
+ + For example in the repository: https://github.com/intersystems-ru/Cache-MDX2JSON
+ Owner - intersystems-ru, Repository - Cache-MDX2JSON.
]]> 1 Namespace=$Namespace,Owner:%String="intersystems-ru",Repository:%String="Cache-MDX2JSON",Branch:%String,Username:%String,Password:%String %Status If ($d(Username) && $d(Password)) { // supply Username and Passwor, if both are provided. GitHub accept Basic Auth Set req.Username = Username // https://developer.github.com/v3/auth/ - Set req.Password = Password + Set req.Password = Password } - Set links = ##class(%ListOfDataTypes).%New() - Set st = ..ProcessDirectory("",req,.links) - Return:$$$ISERR(st) st - - Zn Namespace + Set links = ##class(%ListOfDataTypes).%New() + Set st = ..ProcessDirectory("",req,.links) + Return:$$$ISERR(st) st + + Zn Namespace Set st = ..DownloadFiles(links,req,.list) Set st2 = $system.OBJ.CompileList(.list) Zn namespace - Return $$$ADDSC(st, st2) + Return $$$ADDSC(st, st2) ]]>
@@ -228,10 +228,10 @@ Process one directory of GitHub repository. Recursive.
Return:$$$ISERR(st) st Return:(Request.HttpResponse.StatusCode = 404) $$$ERROR($$$GeneralError,"Repository doesn't exist OR you don't have access") Return:((Request.HttpResponse.StatusCode = 403) && (Request.HttpResponse.GetHeader("X-RATELIMIT-REMAINING")=0)) $$$ERROR($$$GeneralError,"API rate limit exceeded. Try logging in.") - Return:(Request.HttpResponse.StatusCode '= 200) $$$ERROR($$$GeneralError,"Received " _ Request.HttpResponse.StatusCode _ " status, expected 200") + Return:(Request.HttpResponse.StatusCode '= 200) $$$ERROR($$$GeneralError,"Received " _ Request.HttpResponse.StatusCode _ " status, expected 200") - #dim objects As List of %ZEN.proxyObject - #dim obj As %ZEN.proxyObject + #dim objects As List of %ZEN.proxyObject + #dim obj As %ZEN.proxyObject Set st = ##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject(Request.HttpResponse.Data,,.objects,1) Return:$$$ISERR(st) st @@ -260,7 +260,7 @@ Check that incoming file is the one you need. @@ -356,10 +356,10 @@ Delete Namespace, related web apps and databases]]> Kill NamespaceObj // Remove Ensemble namespace - If ((##class(%Library.EnsembleMgr).IsEnsembleInstalled() || ##class(%Library.EnsembleMgr).IsHealthShareInstalled())) { - Set st1 = ##class(%Library.EnsembleMgr).DisableNamespace(Namespace) - Set st = $$$ADDSC(st, st1) - } + If ((##class(%Library.EnsembleMgr).IsEnsembleInstalled() || ##class(%Library.EnsembleMgr).IsHealthShareInstalled())) { + Set st1 = ##class(%Library.EnsembleMgr).DisableNamespace(Namespace) + Set st = $$$ADDSC(st, st1) + } Set st1 = ..DeleteWebApps(Namespace) Set st = $$$ADDSC(st, st1) @@ -400,9 +400,9 @@ Delete all webapps in a Namespace, also dele]]> Set st = $$$OK Try { If ##Class(Config.Databases).Get(Database,.Properties) { - Set Directory = $G(Properties("Directory")) - Set st1 = ##class(SYS.Database).DismountDatabase(Directory) - Set st = $$$ADDSC(st, st1) + Set Directory = $G(Properties("Directory")) + Set st1 = ##class(SYS.Database).DismountDatabase(Directory) + Set st = $$$ADDSC(st, st1) Set st1 = ##class(Config.Databases).Delete(Database) Set st = $$$ADDSC(st, st1) Set st1 = ##class(SYS.Database).DeleteDatabase(Directory) @@ -513,7 +513,7 @@ Activate a configuration in a Namespace]]> Return:$$$ISERR(st) st Set st = ##Class(Config.Map).MoveToActive(Namespace) Return:$$$ISERR(st) st - Set st = ##Class(Config.Namespaces).Load(Namespace) + Set st = ##Class(Config.Namespaces).Load(Namespace) Return st ]]> diff --git a/MDX2JSON/REST.cls.xml b/MDX2JSON/REST.cls.xml index c30a686..69b5955 100644 --- a/MDX2JSON/REST.cls.xml +++ b/MDX2JSON/REST.cls.xml @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@ You can send requests to:
Dashboard related requests are: -
    +
    • webapplication/Dashboards - get all dashboards in a namespace (GET request).
    • webapplication/Dashboards - get folder specific (recursively) dashboards in a namespace (POST request with {Folder:"FolderName"} body) ).
    • webapplication/Dashboard - get all dashboard widgets (POST request with {Dashboard:"DashboardName"} body) with filters as part of dashboard.
    • @@ -47,64 +47,52 @@ Example: send HTTP GET request to web application with Dispatch class MDX2JSO - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> - -End user session by force. -Returns status. 1 %Status %request, %response and %session objec %Status @@ -249,19 +235,9 @@ Wrapper for ##class(MDX2JSON.Utils).WriteFiltersForDataSource(pDataSource, pValu set DataSource = $$$R("DataSource") set Values = $$$R("Values") set Search = $$$R("Search") - - #dim RequestedFilters As %ListOfDataTypes = $$$R("RequestedFilters") - - #dim RelatedFiltersList As %ListOfObjects = $$$R("RelatedFilters") - if $IsObject(RelatedFiltersList) { - for i=1:1:RelatedFiltersList.Count() { - set RelatedFilter = RelatedFiltersList.GetAt(i) - set RelatedFilters(RelatedFilter.Filter) = RelatedFilter.Value - } - } - set st = ##class(MDX2JSON.Utils).WriteFiltersForDataSource(DataSource, Values, Search, .RelatedFilters, RequestedFilters) - return st + set st = ##class(MDX2JSON.Utils).WriteFiltersForDataSource(DataSource,Values,Search) + return st ]]> @@ -273,22 +249,12 @@ Converts incoming request object and calls abovementioned method.]]>%Status JSON transformation. Only in 15.3+ - set st = ##class(MDX2JSON.Utils).WriteJSONfromMDXNew(mdx) + set st = ##class(MDX2JSON.Utils).WriteJSONfromMDXNew($$$R("MDX")) } else { // Default MDX2JSON engine. 14.1+ - if mdx'="" { - set st = ##class(MDX2JSON.Utils).WriteJSONfromMDX(mdx, timeout) - } else { - set st = ##class(MDX2JSON.Utils).WriteJSONfromQuery(cubeKey, queryKey, timeout) - } + set st = ##class(MDX2JSON.Utils).WriteJSONfromMDX($$$R("MDX")) } } catch ex { set st=ex.AsStatus() @@ -354,8 +320,6 @@ Wrapper for ##class(MDX2JSON.Users).SetConfig() - -Get a list of favorites for a current user 1 %Status return ##class(MDX2JSON.Utils).ExecuteAction(Cube,Action,%request.Content) ]]> - - -Cupe. -See correspontding method from DeepSee.REST.v1.InfoServer ]]> -1 -Cube:%String -%Status - - - - - -DSW specific method, returns available addons -1 -%Status - - - - - -DSW specific method, returns available themes -1 -%Status - - - - -1 -objectgenerator -%Status - - diff --git a/MDX2JSON/ResultSet.cls.xml b/MDX2JSON/ResultSet.cls.xml index c562faa..9abb793 100644 --- a/MDX2JSON/ResultSet.cls.xml +++ b/MDX2JSON/ResultSet.cls.xml @@ -1,5 +1,5 @@ - + set info.cubeClass = tCubeClass set info.cubeKey = tCubeIndex - set info.numericGroupSeparator = ##class(%SYS.NLS.Format).GetFormatItem("NumericGroupSeparator") + set info.numericGroupSeparator = ##class(%SYS.NLS.Format).GetFormatItem("NumericGroupSeparator") set info.numericGroupSize = ##class(%SYS.NLS.Format).GetFormatItem("NumericGroupSize") set info.decimalSeparator = ##class(%SYS.NLS.Format).GetFormatItem("DecimalSeparator") diff --git a/MDX2JSON/Tests.cls.xml b/MDX2JSON/Tests.cls.xml index acb1ec5..ef893f2 100644 --- a/MDX2JSON/Tests.cls.xml +++ b/MDX2JSON/Tests.cls.xml @@ -1,5 +1,5 @@ - + Classes with support methods for testing MDX2JSON @@ -24,19 +24,19 @@ do ##class(MDX2JSON.Tests).ProjectLength() Mask:%String="MDX2JSON" %String @@ -170,24 +170,24 @@ Changes widget key if previously encountered set rs = ##class(%DeepSee.Dashboard.Definition).ExtentFunc() set WidgetKeyList="" while rs.%Next() { - set Dash = ##class(%DeepSee.Dashboard.Definition).%OpenId(rs.%Get("ID")) - for i=1:1:Dash.widgets.Count() { - set WidgetKey = Dash.widgets.GetAt(i).key - if $LF(WidgetKeyList,WidgetKey) { - write "Duplicate dash: ", rs.%Get("ID"), " oldkey: ", WidgetKey - // generate new randow widget key - do { - set WidgetKey = $R(1000000000) - } while ($LF(WidgetKeyList,WidgetKey)'=0) - set WidgetKeyList = WidgetKeyList _$LB(WidgetKey) - set Dash.widgets.GetAt(i).key = WidgetKey - write "newkey: ", WidgetKey, ! - write $System.Status.GetErrorText(Dash.%Save()) - } else { - set WidgetKeyList = WidgetKeyList _$LB(WidgetKey) - } - } - } + set Dash = ##class(%DeepSee.Dashboard.Definition).%OpenId(rs.%Get("ID")) + for i=1:1:Dash.widgets.Count() { + set WidgetKey = Dash.widgets.GetAt(i).key + if $LF(WidgetKeyList,WidgetKey) { + write "Duplicate dash: ", rs.%Get("ID"), " oldkey: ", WidgetKey + // generate new randow widget key + do { + set WidgetKey = $R(1000000000) + } while ($LF(WidgetKeyList,WidgetKey)'=0) + set WidgetKeyList = WidgetKeyList _$LB(WidgetKey) + set Dash.widgets.GetAt(i).key = WidgetKey + write "newkey: ", WidgetKey, ! + write $System.Status.GetErrorText(Dash.%Save()) + } else { + set WidgetKeyList = WidgetKeyList _$LB(WidgetKey) + } + } + } ]]> diff --git a/MDX2JSON/Users.cls.xml b/MDX2JSON/Users.cls.xml index fba933e..6e0bf57 100644 --- a/MDX2JSON/Users.cls.xml +++ b/MDX2JSON/Users.cls.xml @@ -1,5 +1,5 @@ - + settings for various apps.
      @@ -104,7 +104,7 @@ Map Global From Database into Namespace]]>
      return:$$$ISERR(st) st set st = ##Class(Config.Map).MoveToActive(Namespace) return:$$$ISERR(st) st - set st = ##Class(Config.Namespaces).Load(Namespace) + set st = ##Class(Config.Namespaces).Load(Namespace) return st ]]> @@ -230,11 +230,11 @@ Get list of all users set $Namespace = "%SYS" set userlist = ##class(%ListOfDataTypes).%New() set statement = ##class(%SQL.Statement).%New() - set status = statement.%PrepareClassQuery("Security.Users","List") - if $$$ISERR(status) { do $system.OBJ.DisplayError(status) } - set resultset = statement.%Execute() - while resultset.%Next() { - do userlist.Insert(resultset.%Get("Name")) + set status = statement.%PrepareClassQuery("Security.Users","List") + if $$$ISERR(status) { do $system.OBJ.DisplayError(status) } + set resultset = statement.%Execute() + while resultset.%Next() { + do userlist.Insert(resultset.%Get("Name")) } return userlist ]]> diff --git a/MDX2JSON/Utils.cls.xml b/MDX2JSON/Utils.cls.xml index 04d7f94..ed42af1 100644 --- a/MDX2JSON/Utils.cls.xml +++ b/MDX2JSON/Utils.cls.xml @@ -1,5 +1,5 @@ - + MDX2JSON.ResultSet. @@ -231,7 +231,7 @@ Get all filters for DeepSee DataSource in JSON format.
      quit:key="" kill:'pRequestedFilters.Find($lg(tFilters(key),2)) tFilters(key) set key = $order(tFilters(key)) - } + } } if (pValues=1) { @@ -241,10 +241,10 @@ Get all filters for DeepSee DataSource in JSON format.
      return:$$$ISERR(st) st merge tFilters(key) = tMembers // merge filter values set key = $order(tFilters(key)) - } + } } - - set st = ##class(%ZEN.Auxiliary.jsonProvider).%ArrayToJSON($lb("name","path","info"),.tFilters) + + set st = ##class(%ZEN.Auxiliary.jsonProvider).%ArrayToJSON($lb("name","path","info"),.tFilters) return st ]]> @@ -292,26 +292,26 @@ Opens DeepSee pivot by it's name. Returns status of atempt to locate and open pi PivotName:%Integer,*Pivot:%DeepSee.Dashboard.Pivot %Status @@ -322,8 +322,8 @@ Get Pivot full name by id
      id:%String