14 Using Complex Data Types to Define Data Structures

This chapter describes how to use complex data types to define the data structures required by your process-based business application. In Oracle Business Process Management (Oracle BPM), a business object is a complex data type. You define complex data types as part of the business catalog of a BPM project. After defining complex data types, you can use that to define complex data objects to store the data within your application.

This chapter includes the following sections:

14.1 Introduction to Complex Data Types

You can use complex data types to create the data structures required in your Oracle BPM application. Complex data types allow you to group related types of data together. This can help make your processes more manageable and readable to other users.

You can use Oracle Business Process Composer to create complex data types manually or based on an XML schema.

The structure of a complex data type is composed of three components:

  • Modules

    Modules are containers that allow you to create a hierarchical structure in your complex data type. Each complex data type must contain one top-level module. Within a module, you can create complex data types or other modules.

  • Complex data types

    Within a module you can define one or more complex data types. A complex data type can contain other complex data types or modules.

  • Attributes

    Attributes are the lowest level component of a complex data type. Attributes define the data types of the complex data type.

You can also add documentation to your complex data types and attributes. Adding documentation makes your data structures more understandable to other users who are collaborating on your BPM project.

The following example process defines two different complex data types to handle the required data. Figure 14-1 shows how these appear in the business component editor.

Figure 14-1 Complex Data Types Defined in the Example Project

Description of Figure 14-1 follows
Description of "Figure 14-1 Complex Data Types Defined in the Example Project"

14.2 Working with Complex Data Types

Using Oracle Business Process Composer you can create, edit, and delete complex data types and their modules and attributes.

You can use Oracle Business Process Composer to create complex data types manually or based on an XML schema.

14.2.1 How to Create a Complex Data Type Manually

You can manually create complex data types from the business components editor. When manually creating a complex data type, you can define the hierarchical relationship between modules and objects and the attributes used in the complex data type. A complex data type can include the following:

  • Simple data types

  • Arrays of data types

  • Complex data types that use other complex data types as a component

Note:

After creating a module, complex data type, or attribute, you cannot change their names.

You can create the following new business components from the project components panel located on the Project Welcome page, as shown in Figure 14-2:

  • Business object

  • Business exception

  • Enum object

Figure 14-2 Project Welcome Page - Business Components

Description of Figure 14-2 follows
Description of "Figure 14-2 Project Welcome Page - Business Components"

14.2.1.1 Creating a New Business Object

To create a new business object:

  1. From the Project Welcome Page, click Business Components.

  2. Click the New icon, then select New Business Object to open the New Business Object wizard, as shown in Figure 14-3.

    Figure 14-3 New Business Object Wizard

    Description of Figure 14-3 follows
    Description of "Figure 14-3 New Business Object Wizard"
  3. Enter a name for the new complex data type (business object).

  4. Select a parent module from the drop down list.

    You must select a parent module when creating a new complex data type. If no module currently exists, you must create a new one. To create a new module:

    1. Click the + icon.

    2. Enter a name for the new module, then click OK.

  5. Select the schema from the drop down list that appears when you select the From XSD check box.

  6. Click Finish to create your new business object or continue to the next step if you want to add attributes and methods.

  7. Click Next to add an attribute.

    The Attributes dialog appears, as shown in Figure 14-4.

    Figure 14-4 New Business Object Wizard - Attributes Dialog

    Description of Figure 14-4 follows
    Description of "Figure 14-4 New Business Object Wizard - Attributes Dialog"
  8. Click the new icon to add an attribute.

    Enter the name and then click Change Type if you want to change the type from the default String.

  9. Click Finish to create your new business object or continue to the next step if you want to add a method.

  10. Click Next.

    The Methods dialog appears. Click the new (+) icon to add a new method.

  11. Click Finish.

    The new complex data type appears in the Project Welcome Page under Business Components, as shown in Figure 14-2.

14.2.1.2 Creating a New Exception

To create a new exception:

  1. From the Project Welcome Page, click Business Components.

  2. Click the New icon, then select New Business Exception to open the New Business Exception dialog, as shown in Figure 14-5.

    Figure 14-5 New Business Exception Dialog

    Description of Figure 14-5 follows
    Description of "Figure 14-5 New Business Exception Dialog"
  3. Enter a name for the new business exception.

  4. Select a parent module from the drop down list.

    You must select a parent module when creating a new complex data type. If no module currently exists, you must create a new one. To create a new module:

    1. Click the + icon.

    2. Enter a name for the new module, then click OK.

  5. Click Change Type if you want to change the type from the default String.

  6. Click Create to create your new exception.

14.2.1.3 Creating a New Enum Object

To create a new Enum object

  1. From the Project Welcome Page, click Business Components.

  2. Click the New icon, then select New Enum Object to open the New Enum Object wizard, as shown in Figure 14-6.

    An enum object (enumeration) is a special data object that enables a variable to be a set of predefined constants.

    Figure 14-6 New Enum Object Wizard

    Description of Figure 14-6 follows
    Description of "Figure 14-6 New Enum Object Wizard"
  3. Enter a name for the new enum object.

  4. Select a parent module from the drop down list.

    You must select a parent module when creating a new complex data type. If no module currently exists, you must create a new one. To create a new module:

    1. Click the + icon.

    2. Enter a name for the new module, then click OK.

  5. Click Change Type if you want to change the type from the default String.

  6. Click Finish to create your new enum object or continue to the next step if you want to add enum items.

  7. Click Next to add enum items.

    The Enum Items dialog appears.

  8. Click the new icon to add an Enum item. Enter the name and value, then click OK.

  9. Click Finish to create your new enum object.

14.2.2 What Happens When You Create a Complex Data Type

After you define a complex data type, it appears in the list of complex data types under business components in the project components panel, as shown in Figure 14-2. You can use the complex data type to create new complex data objects that are based on it. You can also use the complex data type to define other complex data types.

14.2.3 How to Edit a Complex Data Type

After creating a complex data type, you can add or change the type of its attributes and methods, or add documentation. You can also add exceptions, Enum objects and Enum items. The components you can add are based on the component you have highlighted in the hierarchy, as shown in Figure 14-7

Figure 14-7 Add New Business Component Example

Description of Figure 14-7 follows
Description of "Figure 14-7 Add New Business Component Example"

When you highlight a business component in the hierarchy, its details appear on the right-hand side of the business components editor. You can edit the details or add documentation.

If you right-click on a component in the hierarchy you can select to delete the component, move the component, or collapse a section of the hierarchy.

To add a new module, a new complex data type, or attribute:

  1. Click the complex data type you just created.

    The business components editor opens, as shown in Figure 14-8.

    Figure 14-8 Business Component Editor

    Description of Figure 14-8 follows
    Description of "Figure 14-8 Business Component Editor"
  2. If necessary, create a new module within the complex data type:

    1. Right click on the complex data type, then select New Module.

    2. Enter a name for the new module, then select OK.

      After creating a new module, you can create additional sub-modules if necessary.

  3. If necessary, create a new complex data type:

    1. Right-click on a module, then select Add New Business Object.

    2. Enter a name, then click OK.

      The new complex data type appears within the list of complex data types. You can create additional complex data types or sub-modules within the complex data type if necessary.

  4. Add a new attribute.

    1. Select a complex data type, then select Add New Attribute from the menu.

    2. Enter a name for the attribute and select a type from the drop down menu.

  5. Click OK.

14.2.4 How to Delete a Complex Data Type, Module, or Attribute

You can use the business component editor to delete a complex data type or its modules or attributes.

To Delete a Complex Data Type, Module, or Attribute:

  1. From the Project Welcome Page, click Business Components as shown in Figure 14-2.
  2. Hover the cursor to the right of the complex data type you want to delete.
  3. Click the Delete icon, then click OK.

    Note:

    When you delete a complex data type, module, or attribute it cannot be recovered. When deleting a module or complex data type that contains other components, the components are also be deleted. However, if the deleted complex data type or module contains an attribute based on a complex data type, that complex data type is not deleted.