Designing the data model: How to extend a data class to higher layers
Is there a better explanation of this topic, "How to extend a data class to higher layers", than the one found in the LSA course? Specifically, applying the template pattern to Dynamic Class Referencing. The template pattern is not explained in reference to DCR. There is an example but it does not explain clearly how the D_Vehicle data page can be configured to use polymorphism. The example also shows .pxObjClass being set in the AddToVehicleList data transform but that causes a severe best practice warning. Other sites claim that we should simply turn off this warning. Where is the DCR in this example? I thought DCR required using a class reference page at the enterprise level that can be overridden at the implementation level. This example hints that DCR can be done without the reference page by just using inheritance and perhaps manipulating .pxObjClass but I am not clear from reading what Pega's recommended approach is. Finally, can we mix vehicle types in the list? Can the list be implemented at the enterprise level so that a single instance of a list can support a mix cars, trucks and motorcycles at the same time?
Finally, can we mix vehicle types in the list? << YES.
Can the list be implemented at the enterprise level so that a single instance of a list can support a mix cars, trucks and motorcycles at the same time? << YES
Care must be taken when persisting data to the CustomerData schema where Pega-specific columns such as pzInsKey and pxObjClass do not exist. The DCR process described above needs to be revisited when a data instance is retrieved; the Type property providing the necessary input.
Also note that constructing an object and setting its class using Page-New is not the same as changing a class dynamically after the instance is constructed. The difference is that Page-New supports invoking the pyDefault Data Transform.
It is possible to defect when a particular class has yet to be initialized, at that point initializing it once and for all.
Also note that application layer classes directly extend enterprise layer classes whereas enterprise layer classes whereas enterprise classes directly extend the same class that they pattern-inherit.
If initialization is needed at the application layer for the pattern-inherited class, you must invoke a data transform with a different name than pyDefault plus do so before the application layer's class-specific pyDefault transform steps are invoked.