docs.intersystems.com
InterSystems IRIS Data Platform 2019.2  /  Routing XML Virtual Documents in Productions

Routing XML Virtual Documents in Productions
Defining Rule Sets for XML Virtual Documents
Previous section           Next section
InterSystems: The power behind what matters   
Search:  


This chapter discusses how to create rule sets for XML virtual documents, for use in business processes. It discusses the following topics:
To configure a business process to use a rule set, specify its Business Rule Name setting; see “Adding a Business Process to Handle XML Virtual Documents,” earlier in this book.
Creating a Rule Set
To create a rule set for XML virtual documents:
  1. Optionally load the applicable XML schema or schemas into InterSystems IRIS™.
    See “Loading XML Schemas into InterSystems IRIS” earlier in this book.
  2. Use the Rule Set editor in the Management Portal or in Studio, as described in Developing Business Rules.
  3. For the rule set basic definition, use Virtual Document Message Routing Rule for Type.
    This choice sets Context Class to EnsLib.MsgRouter.VDocRoutingEngine. It also sets Rule Assist Class to EnsLib.MsgRouter.VDocRuleAssist.
  4. For any rule constraint in the rule set, use the following values:
  5. Create rules as usual, using the XML property paths described earlier in this book. There are two basic scenarios:
After you save and compile the rule set, it is available for use in a business process.
Example
The following shows the class definition for a simple rule set. This rule set has one rule that uses a DOM-style path to check the <MRN> element of the <Patient> document. Depending on the returned value, the rule routes the message to either FileOut1 or FileOut2. Notice that in this case, the rule constraint does not refer to the XML schema or type.
Class Demo09.MyRules Extends Ens.Rule.Definition
{

Parameter RuleAssistClass = "EnsLib.MsgRouter.VDocRuleAssist";

XData RuleDefinition [ XMLNamespace = "http://www.intersystems.com/rule" ]
{
<ruleDefinition alias="" context="EnsLib.MsgRouter.VDocRoutingEngine">
<ruleSet name="" effectiveBegin="" effectiveEnd="">
<rule name="CheckMRN" disabled="false">
<constraint name="msgClass" value="EnsLib.EDI.XML.Document"></constraint>
<when condition="Document.{/$2:Patient/$2:MRN}=&quot;123456789&quot;">
<send transform="" target="FileOut1"></send>
<return></return>
</when>
<when condition="Document.{/$2:Patient/$2:MRN}!=&quot;123456789&quot;">
<send transform="" target="FileOut2"></send>
<return></return>
</when>
</rule>
</ruleSet>
</ruleDefinition>
}

}


Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-09-18 06:56:44