Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 16 Functions : VRF Functions

VRF Functions
These functions are used only with TIBCO BusinessEvents Decision Manager.
The VRF category of functions (within the Built-in > Standard Functions) provide flexibility when you are working with virtual rule function implementations.
Virtual rule functions are implemented by decision tables.
Default Implementation  When you deploy multiple implementations (tables) for one virtual rule function, but use a function that doesn’t specify the implementation by name, for example if you use Functions.MyVirtualRuleFunction(), the default implementation is used. The default implementation is whichever was the last implementation to be deployed. However, if you use hot deployment, it may not be possible to determine which implementation was deployed last.
The VRF category of functions contains the following:
getVRFImplByName()
getVRFImplNames()
getVRFImpls()
invokeAllVRFImpls()
invokeVRFImpl()
invokeVRFImplByName()
invokeVRFImpls()
Common arguments used in the above functions are described in Table 27, Common Arguments for VRF Functions.
To Add a Virtual Rule Function
1.
Right-click the folder where you want to store the virtual rule function and select New > Rule Function. You see the New Rule Function Wizard.
a.
b.
In the Description field, type a description. (In the source editor the description appears in the * @description line of the comments at the top of the editor).
c.
Check the Virtual checkbox.
2.
Click Finish.
Click the tabs at the bottom of the editor to switch between the form-based editor and the source editor as you work, depending on your preference. These instructions use the form editor and mention the equivalent settings in the source editor.
3.
In the Form editor Configuration panel, add or edit a description as desired. (In the source editor the description appears in the * @description line of the comments at the top of the editor).
4.
   virtual void rulefunction folder.RFName
Do not add code to the Body block in the source editor of a virtual rule function. If you do, you see error messages if you try to save or to switch to the form-based editor.
In virtual rule functions, the Validity field is set to Action and the Return Type is set to Void. column, select where the rule function can be used (source editor equivalents shown in parentheses:
5.
In the Scope section (scope statements in the source editor), drag an ontology entity into the Scope area, OR do the following:
a.
Click Add to add resources that you will be using in your rule function. You see the Select Rule Function Scope Arguments dialog.
b.
c.
d.
Your selection appears in the Declarations list. TIBCO BusinessEvents assigns an alias to it. You can edit the alias.
Add more entities as needed.
6.
For example, here is the source view for a simple virtual rule function:

 
/**
* @description Action to take when account is suspended
*/
virtual void rulefunction Rules.FollowUp {
  attribute {
    validity = ACTION;
  }
  scope {
 
    Concepts.Account account;
  }
  body {
 
  }
}

 
VRF Function Arguments
The VRF functions use various subsets of the following common arguments:
The universal resource identifier (URI) for the virtual rule function. This is typically the full path to the virtual rule function within the project directory. For example, in the CreditCardApplication example, the virtual rule function Person_VirtualRuleFunction() has the following URI:
An object representing a virtual rule function implementation. This argument is required when invoking specific virtual rule function implementations.
The name of a decision table (also known as a virtual rule function implementation). For example, in the CreditCardApplication example, the virtual rule function BankUser_VirtualRuleFunction has an implementation (decision table) called bankUser.
The implName argument is used to retrieve a corresponding implementation object, or to execute an implementation.
The arguments to be passed to one or more virtual rule function implementations on invocation. These objects consist of the concepts, events, scorecards, and so on. that are needed by the implementation or implementations. For example, the processApplication implementation in the CreditCardApplication example project requires concepts of type Application, BankUser, and CreditCardApplication to be passed as arguments. In order to invoke the processApplication implementation, an instance of each concept type must be passed in the args array.
Not used in this release. This argument is used only for the invokeVRFImpls function. When invoking multiple implementations, the return value of each implementation is stored in this array. The array will contain a null entry for each implementation that does not return a value.
 

Copyright © TIBCO Software Inc. All Rights Reserved