InterSystems IRIS Data Platform 2020.4 > Class Reference > ENSLIB namespace > Ens.Rule.Utils

Ens.Rule.Utils

abstract class Ens.Rule.Utils

Utility methods used by the Rules editor and compiler.

Method Inventory

Methods

classmethod ConstructExpressionFromJSONClose(ByRef qHandle As %Binary) as %Status [ Language = objectscript ]
classmethod ConstructExpressionFromJSONExecute(ByRef qHandle As %Binary, pJSON As %String = "") as %Status [ Language = objectscript ]
classmethod ConstructExpressionFromJSONFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status [ Language = objectscript ]
classmethod GetAllFunctions(Output func) as %Status [ Language = objectscript ]
Build a list of all defined utility functions, comprising InterSystems IRIS built-in functions plus user-defined custom functions, and return errors for the entire set of functions and specific errors for a given function. User-defined custom functions are class methods defined in subclasses of Ens.Rule.FunctionSet. The list is returned in array func() in the form:
func(Function) = $LB(Class,Method)
func(Function,"error") = optional error status indicating if this particular function has conflict errors
The method returns an error status containing all the errors for all functions. In case there are functions with the same name (case insensitive) defined in more than one user-defined function set class, an error will be reported for all the definitions of the function.
Note: This method is used by the Rule compiler to catch errors for given user-defined functions, and by the installer to report all errors in file ensinstall.log.
classmethod GetFunction(pFuncName As %String, ByRef pSC As %Status) as %String [ Language = objectscript ]
Returns a value for the named function of the form: $LB(class,name,specparsed).
classmethod GetFunctionSet(Output funcset, pClass As %String) as %Status [ Language = objectscript ]
Builds a list of functions (methods) for a given FunctionSet class and its subclasses. This list is returned in funcset. The list is of the form: list(NAME) = $LB(class,name,specparsed).
Note: This method is used by the Rule editor and DTL editor. Unlike method GetAllFunctions(), it builds the list from the compiled classes.
classmethod GetPropertyList(ByRef list As %String, class As %String, documentClass As %String, maintainSequence As %Boolean = 0) as %Status [ Language = objectscript ]
Returns a list of all the properties (and referenced properties) of class class in order.
The list is an array indexed by ordinal position. The value at each node is returned in the format:
list(n) = $LB(prop,type,classtype,collection,desc,sequenceNumber) If maintainSequence is true, then the values will be ordered by sequence number.
classmethod GetPropertyTree(ByRef tree As %String, class As %String, documentClass As %String = "", level As %Integer = {$G(^Ens.Config("Rules", "MaxPropLevel"), 4)}, node As %String = "") as %Status [ Language = objectscript ]
Return a tree containing a selected node or all the properties of class.
The tree is in the form:
tree(prop,subprop..)=$LB(type,classtype,collection,desc)
The selected node (if any) is addressed by a comma-separated list of descending ordinal positions. Use -1 to address the top-level node.
classmethod GetRuleExpressionAsJSONClose(ByRef qHandle As %Binary) as %Status [ Language = objectscript ]
classmethod GetRuleExpressionAsJSONExecute(ByRef qHandle As %Binary, pExpression As %String = "", pLogicalOnly As %Boolean = 1) as %Status [ Language = objectscript ]
classmethod GetRuleExpressionAsJSONFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status [ Language = objectscript ]
classmethod RuleDefinitionAsJSONToXMLClose(ByRef qHandle As %Binary) as %Status [ Language = objectscript ]
classmethod RuleDefinitionAsJSONToXMLExecute(ByRef qHandle As %Binary, pJSON As %String = "") as %Status [ Language = objectscript ]
classmethod RuleDefinitionAsJSONToXMLFetch(ByRef qHandle As %Binary, ByRef Row As %List, ByRef AtEnd As %Integer = 0) as %Status [ Language = objectscript ]

Queries

query ConstructExpressionFromJSON(pJSON As %String = "")
Selects Expression
Given a decomposed expression model tree in JSON format, return the recomposed expression string.
Call the query with the first parameter being the JSON conditionObject.
{
   "operator": "&&",
   "operands": [
     {
       "value": "NOT(@excluded)",
       "type": "value"
     },
     {
       "value": "@a1c10high>=7.5",
       "type": "value"
     },
     {
       "value": "ToLower(@allConditions)[diabetes",
       "type": "value"
     }
   ],
   "type": "binary"
}

Returns the constructed expression:
NOT(@excluded)&&(@a1c10high>=7.5)&&(ToLower(@allConditions)[diabetes)
query GetRuleExpressionAsJSON(pExpression As %String = "", pLogicalOnly As %Boolean = 1)
Selects ExpressionAsJSON
Query to parse rule expression. Second parameter is to indicate if logical only with the default being 1.
Returns parsed Expression model as JSON
query RuleDefinitionAsJSONToXML(pJSON As %String = "")
Selects RuleDefinitionAsXML
Converts the JSON format of the Rule Definition object to XML format
Feedback