Creating Application Packages and Classes

This chapter provides an overview of application packages and discusses how to:

See Also

Application Classes

Click to jump to parent topicUnderstanding Application Packages

Use the Application Packages Editor to create application packages. A package contains other packages or application classes. A subpackage is any package within a primary, or parent, package.

The title bar of the editor window displays the name of the application package definition. The main window displays the classes and other application packages that make up the application package definition.

The application package hierarchy is displayed as a tree structure. You can use the expand icon (+) and the collapse icon (-) to expand or collapse individual nodes.

To expand all the nodes in a package select View, Expand All or click the Expand All Nodes button on the toolbar. To collapse all the nodes in a package select View, Collapse All or click the Collapse All Nodes button on the toolbar.

In the following example, PTAF_UTILITIES is the primary package, and Encryption, Exception Utilities, Integration, and so on, are subpackages. Printable Document is a class in the PTAF_UTILITIES application package, while Base64 and PSCipher are classes in the Encryption subpackage.

Click to jump to parent topicCreating Application Packages

This section provides an overview of package names and discusses how to create application package definitions.

Click to jump to top of pageClick to jump to parent topicUnderstanding Package Names

You can create a subpackage with the same name as another package or subpackage within the same application package definition, as long as the fully qualified name is unique for each subpackage. Each subpackage is differentiated by the full path name of the class (from the package definition name and the subpackage name).

For example, suppose in the application class PT_FRUIT, where PT_FRUIT is the primary class, you had the following structure of subpackages (no classes are listed in this example):

Example of application package naming conventions

In this example, three subpackages are named Raw, but the fully qualified name for each is unique. For example, the first one is qualified by the name of the primary package. Its fully qualified name is PT_FRUIT:Raw.

The other Raw subpackages are also qualified by the subpackages that contain them. Their names are PT_FRUIT:Reciepies:Raw and PT_FRUIT:Smoothies.Raw.

Similarly, you cannot create two classes with the same name within a given package or subpackage. You can create classes with the same name within the same application package definition, just like subpackages, as long as the fully qualified name is unique. Each class is differentiated by the full path name of the class.

Note. You cannot create a structure for which more than two levels of subpackages are defined below the primary package.

Click to jump to top of pageClick to jump to parent topicCreating Application Package Definitions

This section discusses how to create a new application package or insert a new package or class into an application package.

To create a new application package, access Application Designer and select File, New, Application Package.

To insert a new package or class, open an application package definition. Select a package or subpackage and select Insert, Package or Insert, Application Class.

Application package names and application class names must begin with an alphabetic character and must consist of only alphanumeric characters and underscores ( _ ).

Note. In certain cases you may encounter an error if you use Save As to create a new application package.

The error occurs when you choose to save the PeopleCode with the application package and the PeopleCode uses a %This system variable. The %This system variable is used in application class PeopleCode to refer to the current object.

See Also

Using %This with Constructors

Click to jump to parent topicUsing the Application Package Editor

When you right-click an open Application Package Editor window, you see the available functions:

Application Package Editor pop-up menu

Cut, Copy, and Paste

Not available for this release. Instead, insert new subpackage and class nodes where needed and use the clipboard to copy and paste PeopleCode text from class to class.

To copy the primary package, select File, Save As.

Delete

Click to delete either a class or a package. The PeopleCode text is not actually deleted until you save the application package. Deleted PeopleCode classes can be recovered by reinserting the class node, as long as you have not saved in the interim.

Insert App Class (insert application class)

Click to insert an application class. Because classes cannot have children (subclasses), they can be inserted only into an existing package.

Insert Package

Click to insert an application package. You can only insert packages into an existing package or subpackage.

Rename

Click to rename either a class or a subpackage. When you save the definition, all PeopleCode programs associated with the renamed class are also updated. To rename the primary package definition, select File, Rename.

View PeopleCode

Click to view the associated PeopleCode. PeopleCode can be defined only for application classes, and it is not directly related to package nodes.

Print

Click to print the application package definition, including all the PeopleCode in the classes.

Click to jump to parent topicEditing Application Package Classes

From an application package, you can access the PeopleCode programs associated with the classes of the package.

The Application Packages Editor and the PeopleCode Editor interfaces are similar. You can add, delete, and change text, you can use the find and replace functions, and you can validate syntax. When you save application packages, the code is automatically formatted (indented and so on), just as it is in the PeopleCode Editor.

The editor window contains the main edit pane, the drop-down definition list at the upper-left, and the drop-down event list at the upper-right, as shown in the following example:

Only one event is defined for an application class, OnExecute. This is not an event in the Component Processor flow. The application class runs when called.

The drop-down list at the upper-left enables you to navigate directly to the PeopleCode associated with every class in the package, as well as to every subpackage and its classes.

To edit an application class:

  1. Open the application package.

  2. Select a class.

  3. Either select View, PeopleCode or right-click and select View PeopleCode.

    A PeopleCode Editor window appears.

See Also

Writing and Editing PeopleCode