Classes in Pega
- Base Class, Work Class, Data class, Int Class..etc
Work class
If you want the class to perform some work or some case, then you will need to directly inherit the "work-" class as a parent. This makes the class you are creating a "work Class". It's job to be instantiated as a work object or a Case Object to contain data related to work it is doing.
- Work class - Something inheriting from Work - class of Pega
- Work class should contain all business rule (Workflows, Section, Flow action, Decision, Validation)
- Purpose of the work class is creating business rules and Instantiating a case.
- Work classes are very specific for your application.
- Work classes are direct inheritance or pattern inheritance
Data class
If you want the class to represent a Data Model, create a class that directly inherit the "Data-" class as a parent. so this becomes a "Data Class". It's job to be a data model for whatever data you want to represent in PRPC. Usually, a Data Class is not Instantiated, and it is used more as a template in the Work Class for containing data that is pertinent to work to be resolved.
- Data classes complete separate data component
- Data classes nothing but dealing with data model which is nothing but data process
- Static tables are created in a central repository to display their data's in front end.
Work class vs Data class
- All work classes will reuse the data classes across components/application.
- Basically, the difference is what they do. In summary, a Data Class is a template for Data Model, a Work Class represents a work type or case type for instantiating and resolving work.
- Data classes normally contain properties, sections, decision rules, etc for reuse, Unless you have a very special requirement, flows should be defined at the work level for standard.
- Data class - drop down data's, to show up some data to user to choose for transaction
- Work class - Transactions - all case details get stored into work classes. for example, capturing order details, payment details in workflows etc...
- Work class-create cases, and to store that case data we need table.
Can we create a Flow Rule under the Data Class?
- If you want to use the same flow rule in different work classes, then we can create the flow in Data classes and use it in application work classes,
- We can technically create a flow rule in data class, but typically flows are created in Work classes.
Pega Data Mapping
- There is a rule called as DATA BASE - here you create a mapping between Pega and database.
- - Goto under Records explorer -> SysAdmin-> Database -> Create mapping ->. instances of databases
- - Database: if Oracle then give as usual JDB parameters
- Or choose Configuration in preference. - make sure that the data store jar in the classpath and DB driver entry in the prconfig file.
- Class and Table mapping: - Database table
- Goto under Records explorer -> SysAdmin-> Click Database table
- Pega will keep all data in a single row with blob format
- Every class mapped to a data table
- Every properties in a class mapped to a db column
- PR PZ PV tables created in Pega with prefixes
- PZ PV streams for Work Class tables
- PR_Classname for Properties
- PX created for activities, PY created for flows
- PX and PZ are read-only you can't edit.
- The default database is PgSql and PostGRESql installed
- Class is connected to table and properties connected to columns in the table
- PX and PZ work stream of Work classes table contain n no of properties
Data Table Creation in Pega: (Data class + Table+ Properties + Column)
- Data Explore -> add data type (data table) -> create new -> member details is name of data type
- Advance -> choose org or implementation layer? -> applolo_data : Org data, applolo_ortho_care : implementation data. choose implementation data class and create.
Member Table Creation :
- Until unless you creating properties table column will not be created. Property names & column names are same and both will be created in same time.
- This is not page...so go to data model tab - > define each column (each properties with type.)
- Come to records tab -> this is where you are going to enter data to database. click on 'configure source' -> only entering to the first time. here you have define the mandatory primary and secondary key for the table. second time 'configure source' will not display and you will enter the data . -> tick the check box field for Key. you can enter one row of data if you want..just do this and submit the changes.. defining key is mandatory.
- Next time if you want to enter more data .. just click on
- Data explorer -> click on data link you created -> click add a record link and enter your data
- Data class created?
- Now you can the data class created in Application -> class explorer
- See a word -DATA- which indicates data class
- Under data model -> Property -> you can see property created for your data model
- Data created? You can see in Data explorer.
- You can see your table in PG sql : PR_table name
Open your database using PGadmin
- C:/PRPCPersonaledition/PGsql/pgadmin4/bin/PGadmin4.exe-> just click that you will see the data base. Server should up and running so you can connect with your db ...
Notes:
- Blob tables are less memory consumption. It can be created when the table using only by your application.
- RDB tables reused by multiple applications (read only) - need more memory each data store in each row.
- Reporting you need RDB tables..Store procedure and Function we need to go with RDB
- upstream -> data flowing
- downstream -> data who consuming
- Exposed means tables dedicated to every columns..
I would like to thank you for the efforts you have made in writing this article, Its good and Informative.
ReplyDeletepega cpba
Cheers!
ReplyDeleteThanks for sharing this info....
ReplyDeletePega Online Training
Best Pega Online Training