Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

Creating classes

Updated on November 15, 2021

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.

  1. In the header of Dev Studio, click CreateSysAdminClass.
  2. In the Class record configuration section, in the Label field, enter a short description for the class that you want to create.
  3. 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.
  4. In the Context section, select an application layer in which to store your class.
  5. In the Add to ruleset list, select a ruleset in which to store your class.
  6. 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.
    For more information about default work items, see Setting your current work item.
  7. Click Create and open.
  8. On the General tab of the class form, select a class type, and then define the class settings for your new class:
    ChoicesActions
    Define the settings for an abstract class
    1. In the Select class type list, select Abstract.
    2. 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
    1. In the Select class type list, select Concrete.
    2. 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.
  9. Define the class group settings of a concrete class:
    ChoicesActions
    Create a class group
    1. In the This class list, select The class is a class group.
      Result: The Class group field autopopulates with the class name.
    2. 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.
      For more information, see Encrypting the storage stream (BLOB).
    3. 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.
    4. 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
    1. In the This class list, select does not belong to a class group.
    2. 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.
      For more information, see Encrypting the storage stream (BLOB).
    3. Optional: To define the key parts of the class, in the Keys section, provide a key name and a caption.
      For more information about class keys, see Creating classes.
    Define the settings for a class that belongs to a class group
    1. In the This class list, select belongs to a class group.
    2. In the Class group field, enter a class group name that you want to include this class.
    3. 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.
      For more information, see Encrypting the storage stream (BLOB).
  10. In the Class inheritance section, define how the class that you create inherits rules from superclasses:
    1. 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.
    2. 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.
  11. Click Save.
  12. 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.

  • 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.

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us