Using pattern inheritance for rule resolution
Rule resolution always first looks for a rule that it needs in the class initially provided.
When the Find by name first (Pattern) check box (which corresponds to the Rule-Obj-Class.pyPatternInheritance property) is selected on the Class rule form, the system uses pattern inheritance for a class. Pattern inheritance causes the system to next search for a rule in classes derived from the current class name by truncating, from the right, alphanumeric segments that follow a hyphen.
For example, a request for a rule in the WalCare-Financial-Credit class causes the system to search through these classes, in the order indicated:
If this check box is selected and the rule is not found, rule resolution forms a sequence of candidate classes to search by truncating, from the left, portions of the class name that consist only of a hyphen, or consist only of characters other than a hyphen. If no class exists for one of these computed names, rule resolution continues with the next prefix.
For a class using pattern inheritance, the following is a simplified description of the rule resolution algorithm:
- Search each class formed by repeatedly truncating the original class name, stopping if the needed rule is found.
- If the pattern search finishes without finding a rule, go back to the original class and use directed inheritance to find the parent of the original class.
- If the parent class identified in step 2 was searched during step 1, skip it and skip to step 5.
- If the parent class was not previously searched, search it. Stop if the needed rule is found.
- If not found, determine whether the parent class uses pattern inheritance. If so, repeat this algorithm, starting at step 1, with the parent class.
- Otherwise, identify the parent of the parent. Continue at step 4.
The ultimate base class @baseclass is searched last.
For example, assume your application requests a rule from WalCare-Financial-Credit, which derives from PegaCare-Financial-Credit, and WalCare-Financial-Credit uses pattern inheritance.
The system searches for the rule as follows:
- Is the rule in WalCare-Financial-Credit? If not,
- Is the rule in WalCare-Financial- ? If not,
- Is the rule in WalCare-Financial ? If not,
- Is the rule in WalCare- ? If not,
- Is the rule in WalCare ? This is the end of the pattern. If the system still cannot find the rule, it returns to Walcare-Financial-Credit and looks at the parent. If the parent was previously checked because of a similar pattern, it continues with the parent's parent.
- Is the rule in PegaCare-Financial-Credit? If not, see if PegaCare-Financial-Credit uses pattern inheritance first. If so, start the sequence again. If not, go next to the parent of PegaCare-Financial-Credit.