Appendix B: Creating new entities
What are PGP entities?
PGP entities are a collection of robust data structures that model data elements that are commonly used in government processes. The PGP entities are persistent data classes that come pre-configured as a part of PGP.
- Person
- Business
- Vehicle
- Facility
- Household
Entity data structures serve two distinct purposes within PGP: first, Entity instances are persisted to a data store like any local data type or data table; second, Entity data classes are used as a type for embedded pages defined on the PGP work ancestor to support case processing.
- Persistent Data Store
An entity data class (Data- class) is managed (curated) in an independent data store (database table) by the Add, Update, View and Search case types (Work- classes).
- Case Type embedded page
An entity data class is also used as a type for embedded pages incorporated into the PGP work ancestor. These embedded pages are used by the PGP component processes to implement PGP features.
PGP Entities follow a pattern of Persistent Data curated by Business Processes. This pattern allows for the possibility that in a customer implementation the entity datastore may be mapped to customer resource that is external to Pega and PGP. In this pattern a persistent datastore descended from PegaPS-Data-Entity is added, updated, viewed, and searched by Case Types descended from PegaPS-Work-Entity.
New entity overview
This guide will step through the process of extending the PGP Entity data structure adding a new entity called Item built in a PGP implementation layer.
In the following examples PGPImp is the organization name of the implementation application and DemoPGP is the name of the implementation application. The class PGPImp-DemoPGP-Work inherits (directed) from the PegaPS-Work class.
- Creating the persistent datastore
- PGPImp-DemoPGP-Data-Entity-Item
- Properties relevant to the entity
- View(s) for editing, reviewing
- Data Pages for retrieving
- Optional: Case match rule to avoid duplicates, and validation rules for data
- Extending the work class properties
- In the primary work class of the implementation application, PGPImp-DemoPGP-Work, add a page property of type PGPImp-DemoPGP-Data-Entity-Item to hold Item data during case management processing.
- Creating the data management case types
PGPImp-DemoPGP-Work-Entity-Item-Add
PGPImp-DemoPGP-Work-Entity-Item-View
PGPImp-DemoPGP-Work-Entity-Item-Search
PGPImp-DemoPGP-Work-Entity-Item-Update
- Enabling for App Studio
Use views and design templates to construct the user interface.
Catalog the new Entity’s rules in Relevant Records so they will appear in the App Studio smart prompts.
Configure whether case types will appear on +Create nav.
Development steps
While it is possible to do some of this work in App Studio, the approach discussed here is based on a Dev Studio experience. App Studio hides some development details, like class names and rulesets, to present a development environment that can focus on case types and business processes, but for this exercise we need full control over those details.
- Creating persistent datastore
- Create a persistent data type and supporting rules for the new entity.
- Creating data type ancestor
- Add an abstract data class to the implementation layer to leverage the Enterprise Class Structure pattern and provide extension points for reusable rules common to the Entity implementation layer data types.
- To create a new class, click Create > SysAdmin > Class.
- In the Label field, enter Entity.
- In the Class Name box, enter or select PGPImp-DemoPGP-Data-Entity.
- Click Create and open.
- In the Select class type list, select Abstract.
- In the Settings section, in the Created in version box, enter or select the current version.
- In the Class inheritance section, in the Parent class (Directed) box, enter or select PegaPS-Data-Entity.
- Click Save.
- Creating data type
- Create the new Item data type and supporting rules.
- In the navigation pane of Dev Studio, click Data types.
- Click Options > Add data type.
- In the Add Data Type dialog box, click New Data Type.
- In the Label field, enter Item.
- In the Description field, enter an appropriate description for the class.
- Expand Advanced section.
- In the Parent class box, enter or select PGPImp-DemoPGP-Data-Entity.
- Click Submit to create the new data type and open it for editing
- On the Data model tab, use the Add field button to add properties the
Item data type
- Add a property named EntityID of type Text.
- Add a property pyID of type Text.
- Continue adding properties as desired to define the Item data type.
- Save the data type.
- Switch to the Sources tab and click Create a local source.
- Click Submit to create a local source for the Item data type.
- Save the data type.
- Switch to the Views tab and create the UI for the new data type.
- Click Create new view name the view ItemDetail with
Applies-To of PGPImp-DemoPGP-Data-Entity-Item.
- Place all the fields from the Item data type.
- Click Submit to save the view.
- Click Create new view name the view ItemDetailRO with Applies-To of
PGPImp-DemoPGP-Data-Entity-Item.
- Place all the relevant properties from the Item data type, with the Presentation -> Edit Options set to Read-Only.
- Click Submit to save the view.
- Save the Data type.
- Extending the Work Ancestor Class
- Add a Page property to the implementation layer work ancestor of type PGPImp-DemoPGP-Data-Entity-Item to hold an Item instance during case management processes. The new embedded page will hold (contain) an instance of the new data class embedded on the work.
- To add a new property, click Create > Data Model > Property.
- In the Label field, enter Item.
- In the Apply to box, enter, or select PGPImp-DemoPGP-Work.
- Click Create and open.
- On the General tab, in the Property type section, click Change.
- Click Single Page.
- In the Page definitionbox, enter or select PGPImp-DemoPGP-Data-Entity-Item.
- Click Save.
Previous topic Appendix A: Cosmos overview Next topic What are PGP entities?