IBM Operational Decision Manager Blog
Daniel Selman 2700022VQ3 7,725 Views
As a follow-up to my last post on how to create instances from rules here is an excellent article by Raj Rao that shows this technique but goes a step further and also illustrates the synthetic object pattern. I discussed this pattern at IBM Impact this year in a "When Rules Meet Data" session. Thank you Adam Smolnik for reminding me of Raj's very useful article!
I had a question today from a colleague learning JRules: "How does a rule create an instance of a BOM type?"
The short answer is that you don't -- at least not directly. You need to create a factory method on one of your BOM classes using the BOM editor, verbalize the method, and then instantiate the type using B2X scripting. You can then return the type from the BOM method. Either the factory method can be made static or you need to put it on a class that you can navigate to from your rule.
For an example you can see the createFinancialEvent method in the sample: /studio/samples/architecture/xmlbinding/rules/bom/model.b2x