Pega Class, Inheritance and Rule Resolution

  1. Class
  2. Inheritance
  3. Rule Resolution

Class - Object

 ‘Object’ is an instance of ‘Class’, Pega we define ‘Work Object’ as an instance of a concrete class derived from ‘Work-’ base.

Now we have to learn about the ‘Class’  concept in Pega

Types of Classes in Pega:

1.Abstract Class.
2.Concrete Class.

    Abstract classes end with hyphen/dash. Instances of Abstract classes are not stored into the database. Example: ABC-

    Concrete classes are used to building our application and their instances are stored in the database, these classes will not end with hyphen/dash.

Example: ABC-Work-myApp


In Pega, Inheritance is categorized into four types, they are;

1.Rule Set Version Inheritance.
2.Rule Set Inheritance.
3.Organizational Inheritance.

4.Class Inheritance.

Class Inheritance

    Class Inheritance is a very important part of Pega. Pega has a sophisticated algorithm to search for a rule; it is named ‘Rule Resolution’.

This class inheritance helps Rule Resolution to find a required rule. Class Inheritance is again divided into two types:

1.Directed Inheritance.

2.Pattern Inheritance.
Directed Inheritance causes a class to inherit characteristics directly from the specified parent class. Specifying Directed Inheritance is mandatory while creating a Class.

Pattern Inheritance causes a class to inherit characteristics from classes that it resembles in naming, moving up the pattern class hierarchy. In Pattern Inheritance dashes/ hyphens are delimiters for pattern matching. Pattern Inheritance is optional while creating a class but if specified takes precedence.

‘Rule Resolution’ – Class Inheritance 

‘Rule Resolution’ a very best algorithm used by Pega to search for a required rule, here in this topic, we discuss Rule Resolution only in the context of ‘Class Inheritance’.

Rule Resolution always looks for the rule in the class provided (current class). If it does not find the required rule them it uses the algorithm as below:

If Pattern Inheritance is used, then it precedes Directed Inheritance. For a class using Pattern Inheritance, the following (next slide) is a simplified description of the Rule Resolution algorithm.

Step 1:  Search each class formed by repeatedly truncating the original class name, stopping if the required rule is found.

Step 2: If the Pattern search finishes without finding the rule, go back to the original class and use Directed Inheritance to find the parent of the original class.

Step 3: If the parent class identified in Step 2, was searched during Step 1, skip it and skip to Step 5.

Step 4: If the parent class was not previously searched, search it. Stop if the required rule is found.

Step 5: If not found, determine whether the parent class uses Pattern Inheritance, if so repeat, this the algorithm, starting at Step 1, with the parent class.

Step 6: Otherwise, Identify the parent of the parent, continue at Step 4. 

Example for Class Inheritance

To find the rule in MyApp-Extn-Bpm”, which is derived from “Academy-App” and MyApp-Extn-Bpm” uses pattern inheritance.

1.Is the rule in MyApp-Extn-Bpm”? If Not
2.Is the rule in MyApp-Extn-”? If Not.
3.Is the rule in MyApp-Extn”? If Not
4.Is the rule in MyApp-”? If Not.
5.Is the rule in MyApp”? If Not, this is the end of the Patten Inheritance, now look at the parent “Academy-App”. Check to see is “Academy-App” uses Pattern Inheritance. If so use the algorithm. If not found, again go to the parent of the parent.

No comments:

Post a comment