Skip to main content

Ens.Rule.Definition

abstract class Ens.Rule.Definition

All business rule and routing rule classes are defined from this rule. A rule (definition) class may contain multiple rule sets, each of which has its own effective dates/times and may contain multiple rules and actions.

Method Inventory

Methods

final classmethod EvaluateRules(pRuleName As %String, pSessionId As %String = "", pContext As %RegisteredObject, pActivityName As %String = "", Output pReturnValue As %String, Output pReason As %String, pLogLevel As %String = $$$eRuleLogTypeReturn) as %Status
Evaluate the ruleDefinition.
This method will correctly resolve pRuleName to a class name if it is a rule alias.
pLogLevel is a set of character flags that control the logging performed during rule execution. To ensure that your value is correct, call NormalizeRuleLogTypes()() to produce a normalized set of flags for use by this method.
The following flags are available:
  • 'e' - log errors only. All errors will be logged irrespective of other flags, so setting the value to 'e' or leaving the value empty will only log errors.
  • 'r' - log return values. This is the default value for the setting, and is also automatic whenever the 'd' or 'c' flags are specified.
  • 'd' - log user-defined debug actions in the rule. The 'r' flag must also be specified for this flag to take effect.
  • 'c' - log details of the conditions that are evaluated in the rule. The 'r' flag must also be specified for this flag to take effect.
classmethod NormalizeRuleLogTypes(pRuleLogTypes As %String = "") as %String
This method normalizes user-defined rule logging flags in pRuleLogTypes into a valid set of flags as expected by the EvaluateRules()() method in this class.
The following flags are available:
  • 'e' - log errors only. All errors will be logged irrespective of other flags, so passing in 'e' or leaving the value empty return 'e'.
  • 'r' - log return values. This flag is added automatically whenever one of the 'd' or 'c' flags is specified.
  • 'd' - log user-defined debug actions in the rule. This will normalize to 'rd'.
  • 'c' - log details of the conditions that are evaluated in the rule. This will normalize to 'rc'.
  • 'a' - log all available information. This will normalize to 'rcd'.
classmethod SerializeVals(pValsSpec="", pArgs...) as %String
Serializes the provided arguments into a JSON string using any relevant metadata provided in the XData named in pValsSpec; override this method to serialize differently The first argument pValsSpec may be a %DynamicArray or a string. The string may be a JSON array; otherwise it's the name of an XData containing a JSON array in the Rule class, or if prefixed with '#' it's the name of an XData in the Rule's Assist class.
classmethod evaluateRuleDefinition(pContext As %RegisteredObject, Output pRuleSet As %String, Output pEffectiveBegin As %String, Output pEffectiveEnd As %String, Output pReturnValue As %String, Output pReason As %String, pLogLevel As %String = $$$eRuleLogTypeReturn, pDebugId As %Integer = "") as %Status
This method is generated for the subclass It contains the runtime code for all the ruleDefinition
classmethod findEffectiveDispatch(pEffectiveTable As %String) as %Status
pEffectiveTable is of the format: pEffectiveTable(index)= effectiveBegin_"$"_effectiveEnd_"$"_name
FeedbackOpens in a new tab