Discussion

26
Views
BraamCLSA Member since 2012 100 posts
PEGA
Posted: September 23, 2020
Last activity: September 24, 2020

Inheritance: Strategies to wrap superclass behavior, not clone it [LSA Data Excellence]

What strategies are available for rules on subclasses to delegate to or "wrap" the corresponding behavior from a superclass without copying it and creating a maintenance issue?

In other words, how do I emulate the following Java ...

@Override
public void myMethod() {
  ...
  super.myMethod();
  ...
}

... in Pega so that I don't "copy and paste" configuration from the superclass into the subclass?

 

Data Transforms have the best support for this, through the "Call superclass data transform" checkbox. This invokes the same rule via the Applies To class's inheritance hierarchy as "Step 0" (i.e. before any steps in the actual data transform called are performed). This continues to cascade (subject to the same checkbox being set in the superclass rules) such that the same Data Transform resident many times in the inheritance hierarchy is invoked from most generic to most specific. 

pyDefault is the best reference implementation of this in Pega Platform - use the Tracer to see the invocation seqeuence for yourself!

There is a syntax in Activities that allows for calling the an Activity implementation from a superclass at any point in the Activity - very reminiscent of super.myMethod().

Beyond that I am not aware of any such capability for any other rule types, such as Section or Validate rules. For those, implement a differently named rule in your subclass and reference the intended rule by its original name. This will allow upgrades to the referenced rule to continue to be referenced by your subclass rule.

 

Discussion on this topic was sought from the LSA Data Excellence (Pega 8.4) webinar conducted in July 2020. The webinar and its full set of discussions that arose from it are available at LSA Data Excellence: Webinar, Questions & Answers

Pega Platform 8.4.1 Data Integration Case Management Lead System Architect Senior System Architect Developer Knowledge Share
Share this page LinkedIn