For improved development and maintenance of your application, organize the rules and
other objects in your application into classes. By creating classes, you define collections of
objects that are available to other classes or to instances of the class. You can reuse classes,
and as a result reduce both development time and costs.
- In the header of Dev Studio, click .
- In the Class record configuration section, in the
Label field, enter a short description for the class that you
want to create.
- In the Class name field, enter a unique name for your
class.
A class name can have the maximum length of 56 characters.
To show the
relationship between classes, use a hyphen in the class name in which the first name is a
parent class.
For example: To create a Jobtitles class that derives from an
HR class, enter HR-Jobtitles.
Note: Avoid using names that start with Code-,
System-, and History-, because the
system creates these classes automatically.
- In the Context section, select an application layer in which to
store your class.
- In the Add to ruleset list, select a ruleset in which to store
your class.
- Optional: To override the default work item that your application associates with this class, in
the Work item to associate field, press the Down arrow key, and
then select a work item.
- Click Create and open.
- On the General tab of the class form, select a class type, and
then define the class settings for your new class:
Choices | Actions | Define the settings for an abstract class | - In the Select class type list, select
Abstract.
- In the Settings section, in the Created in
version field, enter the ruleset version that applies to this
class, and then go to step 10.
Abstract classes have no instances in a database.
|
Define the settings for a concrete class | - In the Select class type list, select
Concrete.
- In the Settings section, in the Created in
version field, enter the ruleset version that applies to this
class, and then go to step 9.
Concrete classes have instances in a database. For more information, see
Class keys.
|
- Define the class group settings of a concrete class:
Choices | Actions | Create a class group | - In the This class list, select The class is
a class group.
Result: The Class group field autopopulates with the
class name. - Optional: To encrypt the Storage Stream of each instance of this concrete class when
saved to the PegaRULES database, and to decrypt the Storage Stream when an
instance is retrieved from the database, select the Encrypt
BLOB check box.
- Optional: To define key parts of the class, in the Keys section,
provide a key name and a caption.
For more information about class keys, see Class keys. - Optional: If you provide only one key, to ensure that instances of this class are
unique, and to automatically supply a globally unique value for further new
instances, select the Automatically generate a unique ID for records
of this type check box.
|
Define the settings for a class that does not belong to a class
group | - In the This class list, select does not
belong to a class group.
- Optional: To encrypt the Storage Stream of each instance of this concrete class when
saved to the PegaRULES database, and to decrypt the Storage Stream when an
instance is retrieved from the database, select the Encrypt
BLOB check box.
- Optional: To define the key parts of the class, in the Keys
section, provide a key name and a caption.
|
Define the settings for a class that belongs to a class group | - In the This class list, select belongs to a
class group.
- In the Class group field, enter a class group name
that you want to include this class.
- Optional: To encrypt the Storage Stream of each instance of this concrete class when
saved to the PegaRULES database, and to decrypt the Storage Stream when an
instance is retrieved from the database, select the Encrypt
BLOB check box.
|
- In the Class inheritance section, define how the class that you
create inherits rules from superclasses:
- Optional: To use pattern inheritance before direct inheritance when the system finds rules at
run time, select the Find by name first (Pattern) check
box.
Pattern inheritance searches in superclasses based on prefixes to class names that
end in a hyphen.
- In the Parent Class (Directed) field, enter the class name
of the immediate parent of your new class:
For concrete classes that are class groups, enter Work- or a
class that inherits from the Work- base class, or enter
History-Work- or a class that inherits from the
History-Work- class, if you create a class to hold the
history of work items.
If you enter the longest possible prefix for your new class ending in a hyphen, you
can select or clear the Find by name first (Pattern) check
box, with no difference in rule resolution behavior or results. For example, if you
create a Work-Object-Mortgage class and the parent class is
Work-Object-, the system performs the same search
regardless of the check box setting. Avoid using System- and
Code- base classes, because these classes are reserved.
Note: During rule resolution, the system considers only direct parent classes. For
example, class C inherits from class B, and B inherits from A, but C does not
inherit from A.
- Click Save.
- Optional: If you create a concrete class, check the class connection with the database by
clicking Test connection.
Note: For the test connection to work, ensure that the JDBC JAR file for the database
platform is present and included in the classpath, and that the prconfig.xml file
contains an entry for the database driver. For example, <env
name="database/drivers" value="org.postgresql.Driver" />
Result: A window that contains the test results opens. The results include whether the
class is abstract or concrete, and the database and database table if the class is
concrete.
Naming conventions for classes
Unified naming standards for classes help you manage your resources in a
logical and efficient way. You can avoid duplicating your content, maximize efficiency,
and speed up application development by sharing resources between multiple classes or
class layers.
For example, you can create class names that support class
inheritance, so that you can reuse resources across different classes. When you name a class
ReviewRequest-LoanRequest, you indicate that a new class
LoanRequest inherits resources from the
ReviewRequest class.
When you name classes, consider the following guidelines:
- Use a noun for a class name, for example Customer or
Address to distinguish classes from actions and
processes. For better readability, capitalize the first letter of each word, for
example, CustomerAddress.
- Ensure that your class name is descriptive and clearly conveys the purpose of
the class.
- Avoid using acronyms and abbreviations that are difficult to decode. The
exception are common acronyms, such as HTML.
- Avoid including underscores (_) in class names.
- Pega Platform provides a set of base classes that includes
the Work-, History-, and
Data- classes. Create new classes only under the
organization base class, for example, UPlusTelco-.
- The system displays labels for class names on some of the forms, worklists,
reports, and other areas of an application. The system also displays a short
description for the class. Therefore, use class names that are self-explanatory
and reflect the purpose of the work. Avoid using class names that reflect a
status or action, instead of a unit of work.
- Choose class names that support pattern inheritance, as well as directed
inheritance. For more information about class inheritance, see Understanding class hierarchy and inheritance.
- To distinguish hierarchy position and inheritance, use class names that visually
reflect pattern inheritance. For subclasses, include the names of all parent
classes, including your top-level class, separated by dashes. For example, if
the parent class YourCoLoan-Request includes child classes
for mortgage and car loan applications, name the child classes
YourCoLoan-Request-Mortgage and
YourCoLoan-Request-Auto.
- Name related objects with consistent prefixes, so that you can quickly locate
similar classes in an alphabetical list.
- Use the same naming conventions for class groups as for classes.
Class keys
When you define concrete classes, you can add keys to identify the classes. You can
add the keys when you create a class, or you can update the keys later.
Every instance of a concrete class includes a key formed from the value of the properties
that the class contains. The value is unique within the class or class group. For
example, your system can contain only one instance of the
Data-Admin-Operator-ID class with an ID value of
SampleID. Similarly, your system can contain only one HTML
fragment rule named MyFragment in the same ruleset and version.
The properties that form the key might apply to the concrete class itself, or to a parent
class. For rule instances, the system appends the ruleset and version as part of the
internal key.
Pega Platform looks in three places to learn which property values to
connect to, and in what order, to form the unique key. The system assembles keys the
first time it saves an instance:
- For a concrete class that does not belong to a class group, the system first
examines the Keys array of the Class form. If this array is not empty, it forms
a key by connecting the values of the properties identified in that array.
- If the Keys array of a class is empty, the system uses class inheritance to
locate a superclass for which the Keys array on the Class form is not blank.
When the system finds such a class, it connects the values of the properties in
that Keys array, and forms the key.
- For a concrete class that does belong to a class group, the system forms a key
based on properties in the Keys array of the Class Group form. As a result, the
system ignores any information in the Keys array of the Class form.
When you add keys to a class, consider the following factors:
- The system creates both a new class and single value properties of the Text type
when you enter the property names into the Keys array, before you save the Class
form for the first time. If you want to apply one or more already-defined
properties as key properties to a super class of this class, enter the
already-defined properties after you save the Class form.
- For concrete classes derived from the Log- base class, the
property pxCreateDateTime is usually the final or only key
part. In some high-volume systems, two log events might occur in the same
millisecond. If this can occur in your Log- class, choose
additional properties to ensure uniqueness.
- For concrete classes derived from the Index- base class,
enter the properties pxInsIndexedKey,
pxIndexCount, and pxIndexPurpose
in that order. Avoid using any other properties in the key.
- For external classes, use of properties with a Type value
of Date, Time,
DateTime, or Double as key parts
might introduce rounding or uniqueness issues. Review the data representation on
the external database that you use, to confirm that it maps one-to-one with the
Pega Platform representation.
- If two or more properties form the key, the order of rows in the Keys array is
significant. Consider which order is likely to produce a natural or frequently
presented sort order in reporting or searching.
Creating classes
For improved development and maintenance of your application, organize the rules and
other objects in your application into classes. By creating classes, you define collections of
objects that are available to other classes or to instances of the class. You can reuse classes,
and as a result reduce both development time and costs.
- In the header of Dev Studio, click .
- In the Class record configuration section, in the
Label field, enter a short description for the class that you
want to create.
- In the Class name field, enter a unique name for your
class.
To show the relationship between classes, use a hyphen in the class name in which the
first name is a parent class.
For example: To create a Jobtitles class that derives from an
HR class, enter HR-Jobtitles.
Note: Avoid using names that start with Code-,
System-, and History-, because the
system creates these classes automatically.
- In the Context section, select an application layer in which to
store your class.
- In the Add to ruleset list, select a ruleset in which to store
your class.
- Optional: To override the default work item that your application associates with this class, in
the Work item to associate field, press the Down arrow key, and
then select a work item.
- Click Create and open.
- On the General tab of the class form, select a class type, and
then define the class settings for your new class:
Choices | Actions | Define the settings for an abstract class | - In the Select class type list, select
Abstract.
- In the Settings section, in the Created in
version field, enter the ruleset version that applies to this
class, and then go to step 10.
Abstract classes have no instances in a database.
|
Define the settings for a concrete class | - In the Select class type list, select
Concrete.
- In the Settings section, in the Created in
version field, enter the ruleset version that applies to this
class, and then go to step 9.
Concrete classes have instances in a database. For more information, see
Class keys.
|
- Define the class group settings of a concrete class:
Choices | Actions | Create
a class group | - In the This class list, select The class is
a class group.
Result: The Class group field autopopulates with the
class name. - Optional: To encrypt the Storage Stream of each instance of this concrete class when
saved to the PegaRULES database, and to decrypt the Storage Stream when an
instance is retrieved from the database, select the Encrypt
BLOB check box.
- Optional: To define key parts of the class, in the Keys section,
provide a key name and a caption.
For more information about class keys, see Class keys. - Optional: If you provide only one key, to ensure that instances of this class are
unique, and to automatically supply a globally unique value for further new
instances, select the Automatically generate a unique ID for records
of this type check box.
|
Define
the
settings for a class that does not belong to a class group | - In the This class list, select does not
belong to a class group.
- Optional: To encrypt the Storage Stream of each instance of this concrete class when
saved to the PegaRULES database, and to decrypt the Storage Stream when an
instance is retrieved from the database, select the Encrypt
BLOB check box.
- Optional: To define the key parts of the class, in the Keys
section, provide a key name and a caption.
|
Define the settings for a class that belongs to a class group | - In the This class list, select belongs to a
class group.
- In the Class group field, enter a class group name
that you want to include this class.
- Optional: To encrypt the Storage Stream of each instance of this concrete class when
saved to the PegaRULES database, and to decrypt the Storage Stream when an
instance is retrieved from the database, select the Encrypt
BLOB check box.
|
- In the Class inheritance section, define how the class that you
create inherits rules from superclasses:
- Optional: To use pattern inheritance before direct inheritance when the system finds rules at
run time, select the Find by name first (Pattern) check
box.
Pattern inheritance searches in superclasses based on prefixes to class names that
end in a hyphen.
- In the Parent Class (Directed) field, enter the class name
of the immediate parent of your new class:
For concrete classes that are class groups, enter Work- or a
class that inherits from the Work- base class, or enter
History-Work- or a class that inherits from the
History-Work- class, if you create a class to hold the
history of work items.
If you enter the longest possible prefix for your new class ending in a hyphen, you
can select or clear the Find by name first (Pattern) check
box, with no difference in rule resolution behavior or results. For example, if you
create a Work-Object-Mortgage class and the parent class is
Work-Object-, the system performs the same search
regardless of the check box setting. Avoid using System- and
Code- base classes, because these classes are reserved.
Note: During rule resolution, the system considers only direct parent classes. For
example, class C inherits from class B, and B inherits from A, but C does not
inherit from A.
- Click Save.
- Optional: If you create a concrete class, check the class connection with the database by
clicking Test connection.
Note: For the test connection to work, ensure that the JDBC JAR file for the database
platform is present and included in the classpath, and that the prconfig.xml file
contains an entry for the database driver. For example, <env
name="database/drivers" value="org.postgresql.Driver" />
Result: A window that contains the test results opens. The results include whether the
class is abstract or concrete, and the database and database table if the class is
concrete.