SKILL
LESSON
Classes and class hierarchy
Understanding rule reuse through class inheritance
Tactical Skill Category: Case Management
Overview
Classes and class hierarchy influences
rule reuse.
Managing where a rule is suitably
created and updated helps to
maintain the integrity of the rules,
and promote reuse.
This lesson covers:
• Classes and class hierarchy
• Rule reuse through inheritance
Pegasystems 2020 Classroom Training Materials 3
Definition
• Class – describes a collection of rules or other
objects. It defines the scope and organizes rules
within an application based on their capacity for
reuse.
• The usage of a class in Pega is similar to
Object-Oriented Programming (OOP) where a class
contains properties and methods. Method
• Each Pega application consist of three class types.
– Work class (Work-)
– Integration class (Int-)
Properties
– Data class (Data-)
Pegasystems 2020 Classroom Training Materials 4
Definition
• Work class – contains the rules that describe how to
process a case or cases, such as processes, data
elements, and user interfaces.
• A Work class described a case type. In the example
on the right, the ApplicantMgr application has three
case types: Interview, JobApplicant, and Onboard.
Pegasystems 2020 Classroom Training Materials 5
Definition
• Integration class – contains the rules that describe
how the application interacts with external systems,
such as the integration assets that connect the
application to a customer database or a third-party
web server.
• An Integration class also contains properties and
mapping rules for the Pega application to
communicate with the service – preparing the
requests and understanding the responses.
Pegasystems 2020 Classroom Training Materials 6
Definition
• Data class – contains the rules that describe the
data objects used in the application, such as a
customer data type or order items data type.
• A Data class is created to model the data required
by the case type. Other than property rules, it can
also contain other rules to perform validation,
calculation of values, and user interface views.
Pegasystems 2020 Classroom Training Materials 7
Best Practices
You need to have the big picture of the class structure in mind and answer these questions
when creating a class:
• What is the type of the class?
– Work class
– In which application or framework should it be created?
– Is this class sharing rules from other class?
– Does the class have access to all the shared rules or do you need to add parent classes?
– Integration class
– These classes are often created by connector wizards
– Can you reuse existing integration classes?
– Data class
– In which application or framework should it be created?
– Is this class sharing rules from other class?
– Does the class have access to all the shared rules or do you need to add parent classes?
Pegasystems 2020 Classroom Training Materials 8
Definition
• Parent Class – describes a class that contains another class.
• Child Class – describes a class that is contained by another class. A child
class can reuse or inherit any of the rules defined for its parent class.
• The Work class contains a
child class for each case type
in your application.
– Each case type child class
contains all of the rules
unique to a case type, such
as an auto insurance claim.
• The Data class contains a
child class for each data
object.
Pegasystems 2020 Classroom Training Materials 9
Definition
• Class hierarchy – describes the organization of the classes in a multi-level
hierarchy.
– The system searches the class hierarchy from the most-specific class and
expands the search to increasingly general classes.
• Class name identifies the position of the class within the class hierarchy.
TGB TGB
TGB-HR HR Sales
TGB-HR-Work Work Int Data Work Int Data
Pegasystems 2020 Classroom Training Materials 10
Description
Case type classes
• A case type class describes a specific case type, such as
expense reports or auto insurance claims. The rules
associated with case type classes are unique to the
corresponding case type and are not reused elsewhere in the
organization.
Pegasystems 2020 Classroom Training Materials 11
Description
Work classes
• Work classes contain all case types in an application. In a
Pega Platform application, all case types in an application are
associated with a work class.
• While integration and data classes can occur at any level of
the class hierarchy, work classes are generally the most
specific of the three classes.
Pegasystems 2020 Classroom Training Materials 12
Description
Application classes
• The application layer contains the required work, integration,
and data classes for a single application and allows for
sharing common rules among these classes.
Pegasystems 2020 Classroom Training Materials 13
Description
Div / Unit classes
• You create division and unit layers only when necessary. The
division layer contains the work, data, and integration classes
for the division. The optional unit layer contains the work,
data, and integration classes for the unit. These classes allow
the reuse of rules at the division and unit level, such as an
approval process shared across the entire IT department.
Pegasystems 2020 Classroom Training Materials 14
Description
Organization classes
• The organization layer contains all the classes for applications
across an entire business or organization. The organization
layer often contains data and integration classes that can be
applied across the entire organization.
Pegasystems 2020 Classroom Training Materials 15
Description
Other application classes
• Classes from other applications, such as industry-specific
Pega Platform applications, are contained in what is
sometimes referred to as the framework layer. You can use
a generic application for insurance policy administration as a
base for customizing versions for different policy types.
• Using other applications is optional and determined for each
implementation by a more experienced developer.
Pegasystems 2020 Classroom Training Materials 16
Description
Base classes
• Pega Platform provides base classes. These classes contain
rules that provide basic functionality for case processing. For
example, the Pega Platform provides data elements that
record who created a case and the time needed to complete
an assignment.
Pegasystems 2020 Classroom Training Materials 17
Navigation
• The class hierarchy can be displayed from Dev Studio.
• Select the App icon in the Explorer pane on the left.
Pegasystems 2020 Classroom Training Materials 18
Navigation
• The class hierarchy can be displayed from Dev Studio.
• Select the App icon in the Explorer pane on the left.
• Use the autocomplete field to change the context of the
hierarchy by entering the name of the class you are
interested to view.
Pegasystems 2020 Classroom Training Materials 19
Navigation
• The class hierarchy can be displayed from Dev Studio.
• Select the App icon in the Explorer pane on the left.
• Use the autocomplete field to change the context of the
hierarchy by entering the name of the class you are
interested to view.
• Click the expand icon to drill into each item in the
class hierarchy.
Pegasystems 2020 Classroom Training Materials 20
Definition
• Inheritance – allows your application to
reuse existing rules for other cases or
applications.
• Rule reuse reduces development and
testing time without sacrificing
application quality.
• Pega provides two methods for rule
inheritance:
– Pattern inheritance
– Directed inheritance
Pegasystems 2020 Classroom Training Materials 21
Pattern Inheritance
Reus
• Pattern inheritance is automatic, and uses the class name structure to •
determine rules available to reuse.
•
• Allows reuse of rules within a single application.
•
Pegasystems 2020 Classroom Training Materials 22
Pattern Inheritance
Reusing a standard SLA rule from the Organization layer
• ABCIns maintains a standard SLA rule for all cases created
regardless of the division.
• A division may make changes to the standard SLA rule
without increasing the deadline.
• Creating the standard SLA in the organization layer enables
mary reuse by both the Consumer and Business divisions.
milies
lass
sary. Pegasystems 2020 Classroom Training Materials 23
Case wide action
Pattern Inheritance (Change primary driver)
• The consumer division offers family Reus
coverage and requires a specific •
primary driver be assigned to each
vehicle. Management has observed •
that families sometimes change
primary drivers due to licensing •Case
changes among the younger family (Cha
members.
•
• A case-wide action to Change
primary driver in the ABCIns-
Consumer-PolicyProcessing-
Work class enables users of all
•
child case types of that class to
adjust the primary driver if
necessary.
Pegasystems 2020 Classroom Training Materials 24
Pattern Inheritance
amily
rved
Case wide action
mily (Change insured vehicle)
• The Business division frequently needs to
adjust or change the insured vehicle due to
errors identifying which vehicle or vehicles in
the fleet is the subject of a quote or claim case.
child
• A case-wide action to Change insured vehicle in
the ABCIns-Business-PolicyProcessing-
Work makes the case-wide action available for
all the child case types of the ABCIns-Business-
PolicyProcessing-Work class.
Pegasystems 2020 Classroom Training Materials 25
Pattern Inheritance
Pegasystems 2020 Classroom Training Materials 26
Directed Inheritance
• Directed inheritance is inheritance between classes where the parent class
is explicitly specified.
• Allows reuse of rules in other applications, including standard rules provided
as part of the Pega Platform.
• Directed inheritance is not automatic, and needs to be explicitly specified in
the class rule form.
Pegasystems 2020 Classroom Training Materials 27
Directed Inheritance
• Directed inheritance allows an application class to inherit rules defined for
standard Pega class, e.g. Work- or Data- class.
Work-
Work-Cover-
Pegasystems 2020 Classroom Training Materials 28
Navigation
• The pattern inheritance
of a class is easily
defined by the name of
the class.
Pegasystems 2020 Classroom Training Materials 29
Navigation
• The pattern inheritance
of a class is easily
defined by the name of
the class.
• To define the directed
inheritance of a class,
you will need to open the
Class rule form and
specify the directed
inheritance class.
Pegasystems 2020 Classroom Training Materials 30
Use Case
A case type needs to reuse rules
found within the application’s class
hierarchy, as well as standard rules
from Pega, or rules contained in
other application.
Use the Enterprise Class Structure
design pattern to implement the
reuse of rules through inheritance.
Pegasystems 2020 Classroom Training Materials 31
Implementation
Reusing rules through inheritance.
• Pega searches through the parent classes
indicated by pattern inheritance first,
then followed by directed inheritance.
Work-
• This process repeats until Pega reaches
the ultimate base class or @baseclass.
• If the rule cannot be found after
Work-Cover-
searching @baseclass, Pega returns an
error.
Pegasystems 2020 Classroom Training Materials 32
Implementation
Step 1
• An auto insurance claim
case, described by
the InsCorp-Claims-Work-
AutoClaim class,
references the case ID
data element.
Work-
Work-Cover-
Pegasystems 2020 Classroom Training Materials 33
Implementation
Step 2
• The data element is not
found in the InsCorp-
Claims-Work-
AutoClaim class , so Pega
Platform searches
through the parent
classes by using pattern Work-
inheritance.
Work-Cover-
Pegasystems 2020 Classroom Training Materials 34
Implementation
Step 3
• The data element is not
found through pattern
inheritance, so Pega
Platform searches the
parent class specified by
directed
inheritance, InsApp-FW- Work-
Claims-Work-Claim.
• This class belongs to the
generic policy
administration Work-Cover-
application.
Pegasystems 2020 Classroom Training Materials 35
Implementation
Step 4
• The data element is not
found in the InsApp-FW-
Claims-Work-Claim class,
so Pega Platform
searches its parent
classes by using pattern
inheritance. Work-
Work-Cover-
Pegasystems 2020 Classroom Training Materials 36
Implementation
Step 5
• The data element is not
found through pattern
inheritance, so Pega
Platform searches the
parent class specified by
directed
inheritance, Work-Cover-. Work-
This class belongs to the
Pega Platform.
Work-Cover-
Pegasystems 2020 Classroom Training Materials 37
Implementation
Step 6
• The data element is not
found in the Work-Cover-
class, so Pega Platform
searches its parent
classes by using pattern
inheritance.
Work-
Work-Cover-
Pegasystems 2020 Classroom Training Materials 38
Implementation
Step 7
• The data element is not
found in the Work class,
so Pega Platform
searches the ultimate
base class specified by
directed
inheritance, @baseclass. Work-
• Pega Platform locates the
data element
in @baseclass.
Work-Cover-
• If the data element is not
found @baseclass, Pega
returns an error.
Pegasystems 2020 Classroom Training Materials 39
Implementation
Step 1
• An auto insurance claim
case, described by
the InsCorp-Claims-Work-
AutoClaim class,
references the case ID
data element.
Work-
Work-Cover-
Pegasystems 2020 Classroom Training Materials 40
Navigation
• To discover the inheritance path of a class, right-click on the class in App
explorer and select Inheritance.
Pegasystems 2020 Classroom Training Materials 41
Unit Testing and Debugging Guidance
• To discover which rules are
referencing, and being
referenced, click on Actions >
View references in the rule form.
Pegasystems 2020 Classroom Training Materials 42
Unit Testing and Debugging Guidance
• To discover which rules are
referencing, and being
referenced, click on Actions >
View references in the rule form.
• You can discover the referencing
rules.
Pegasystems 2020 Classroom Training Materials 43
Unit Testing and Debugging Guidance
• To discover which rules are
referencing, and being
referenced, click on Actions >
View references in the rule form.
• You can discover the referencing
rules.
• As well as referenced rules.
Pegasystems 2020 Classroom Training Materials 44
Skill Mastery
• Explain the role of classes and
inheritance in promoting modular
application design
• Differentiate between class types
and class hierarchy
Pegasystems 2020 Classroom Training Materials 45