13 Working with Data Objects and Data Associations

This chapter describes how to use data objects to store the data used in a process-based business application. It also describes how to use data associations to define how data is handled within a business process.

This chapter includes the following sections:

13.1 About Handling Data Used by Your Business Processes

Most business applications require users to create and manipulate data. In a sales quote application, for example, a user enters data related to the quote which includes information about the customer, quote, and other types of data. Additionally, an application may have to create and manipulate other data that is only used internally as part of the overall function of the application.

When creating business processes you must define the data the application uses. In Oracle Business Process Management (Oracle BPM), data is stored within a data object. Data objects are defined based on simple types that are similar to those found in most programming languages.

Data objects can also be defined based on complex data types. In Oracle BPM, a business object is a complex data type. Complex data types allow you to group together related data. For example, if you are creating an application that must store information about an employee, you may have to create a complex data type that stores the name, address, salary, and other information about the employee. Complex data types are similar to the concept of classes used in object-oriented programming languages like Java. For more information about complex data types, see Using Complex Data Types to Define Data Structures.

13.1.1 How to Define the Data Used by an Oracle BPM Application

Defining how data is stored and manipulated is part of the overall design and development of an Oracle BPM application. The following high-level task outlines the typical process for defining the data used within an Oracle BPM application.

To Define the Data Used by Your Oracle BPM Application

  1. Define the complex data types required by your project.

    The first step in defining the data used within an Oracle BPM application is to define the required complex data types. Complex data types allow you to define the data structures used within your application. For more information about using complex data types, see Using Complex Data Types to Define Data Structures.

  2. Create the data objects used within your project.

    For more information about creating data objects, see How to Create a Data Object.

  3. Define the expressions used to manipulate the data in your process.

    For more information about defining expressions, see Using Expressions to Control Data .

  4. Define how information is passed between Business Process Model and Notation (BPMN) flow objects using data associations.

    For more information about data associations, see How to Configure Data Associations for a Flow Object.

  5. Define the input and output for your process.

13.2 Introduction to Data Objects

Data objects are, in general, the variables used to store the information used by your business processes and Oracle BPM application. They are defined during the design and implementation stage of a process. Before deploying a BPM project you must define all of the data objects that the running application requires.

At runtime, new data objects are not created, but the value of the information they store is altered as users interact with your application. Running processes can store, access, and manipulate data. The values of data can also determine process branching.

13.2.1 Introduction to Basic and Complex Data Objects

Oracle BPM supports two types of data objects: basic and complex. Which type of data object you use depends on the type of data it must handle.

  • Basic data objects

    Basic data objects are based on simple data types. These are the core data types common in most programming languages. Table Table 13-1 lists the basic data types supported by Oracle BPM.

    Table 13-1 Simple Data Objects

    Type Description

    Bool

    Represents the logical values true or false.

    Int

    Represents an integer. For example: 23, -10, 0.

    Decimal

    Represents a number than can be expressed in decimal notation. For example: 3.14, 62, 0.023.

    Real

    Represents a floating-point numeric value. For example: 2e-1, 2.3E8.

    String

    Represents a sequence of characters. For example: "This is a string."

    Time

    Represents a specific time expressed as: year-month day hour:minute:second. For example: 1995-02-03 13:30:28-08:00.

    Interval

    Represents a duration of time expressed as a number in years, months, days, hours, minutes, and seconds. For example: 1d3h30m.

    Binary

    Used to store binary data, including images or videos.

  • Complex data objects

    Complex data objects allow you to create data structures that group together different types of data. Complex data objects are based on complex data types. Complex data types allow you to create data structures based on basic data objects.

    For example, you can create a complex data object called employee that contains different types of data for employee like id, name, and age. The relationship between complex data types and complex data objects is analogous to the relationship between classes and instances in the Java programming language.

Figure 13-1 shows the relationship between basic and complex data objects.

Figure 13-1 Relationship Between Basic and Complex Data Objects

Description of Figure 13-1 follows
Description of "Figure 13-1 Relationship Between Basic and Complex Data Objects"

Before creating a complex data object, you must first define the complex data type that defines the data structure. For more information about using complex data types, see Using Complex Data Types to Define Data Structures.

13.2.2 Introduction to Process and Project Data Objects

In addition to specifying a data object's data type, you must also select its scope. In Oracle BPM, the scope refers to from where in the process or project the data object can be accessed.

In Oracle BPM, there are two types of data object scope: process and project. Process data objects are data objects that are defined for a specific process. Similarly, project data objects are defined for an entire BPM project. Both project and process data objects can be created from both basic and complex types.

13.2.2.1 Process Data Objects

Process data objects allow you to define data objects that are used only within a single process. Process data objects can be used only within the process where they are defined.

When designing a process-based application, if you know that a data object is required only within a single process, it is better to define it as a process data object in order to conserve system resources.

13.2.2.2 Project Data Objects

Project data objects allow you to share data between processes. For example, within an Oracle BPM application, both a purchase order process and an approval request process may track the data of the employee that created the request. The data created or modified in one process can be accessed by the other.

Project data objects can be used to ensure that all processes within an application have access to the same data. However, each process must assign and update the value of its data.

Although project data objects allow you to define data objects that are used by all processes in a project, they are not global data objects. Each process within your project uses its own version of the data object. Project data objects are not used to share data between processes. To share data between processes, you must create data associations. For more information about data associations, see Introduction to Data Associations.

Another benefit of defining project data objects is that after publishing your project you can configure Oracle Business Process Management Workspace views to display the values of the variables. This is possible only when using project data objects.

13.3 Working with Data Objects

Data objects can also be defined based on complex data types. In Oracle BPM, a business object is a complex data type. Complex data types allow you to group together related data.

This section describes the procedures for working with data objects, including how to create new data objects and edit or delete existing ones.

13.3.1 How to Create a Data Object

The procedures in this section describe how to create a new process or project data object. If you must create a data object based on a complex data type, you must create the complex data type first. For more information about complex data types, see Using Complex Data Types to Define Data Structures.

To create a data object from the Project Welcome Page:

  1. Ensure that you are editing your project.
  2. Go to the Project Welcome Page.
  3. Open the process for which you want to create a data object.
  4. Click the Data Objects icon in the toolbar to open the Data Objects dialog.

    Click the name of the project or process, then select Add as shown in Figure 13-2.

    Figure 13-2 Process Editor - Data Objects

    Description of Figure 13-2 follows
    Description of "Figure 13-2 Process Editor - Data Objects"
  5. Enter a unique name for your data object.
    • If you are creating a basic data object, select any of the basic types from the drop-down list.

    • If you are creating a complex data object, select <object> from the drop-down list, then select the complex data type on which you want to base the complex data object.

    For information about data object types supported by Oracle BPM, see Introduction to Basic and Complex Data Objects.

  6. Click OK.

13.3.2 How to Edit or Delete a Data Object

You can edit or delete process or project data objects.

To edit or delete a data object:

  1. Ensure you are editing the project.
  2. Open the process where you want to delete a data object.
  3. Click the data objects icon in the process editor toolbar.
  4. In the list of data objects, select the project or process data object you want to delete or edit, then:
    • To edit the data object, click Edit, then provide new name and change the data type as necessary.

    • To delete the data object, click Delete.

  5. Click OK.

13.3.3 What Happens When You Delete or Edit a Data Object

After editing or deleting data objects, validate your project to verify that there are no references to the changed or deleted data objects.

After editing a data object, you must ensure that all references to it are still valid. For example, if you change a data object from type int to type string, you must verify that all of the expressions that use the data objects still function correctly.

After deleting a data object, you must ensure that all references to it are removed. This includes any data associations and expressions that use the data object. If you do not remove references to the deleted data object, the project does not validate.

13.4 Introduction to Data Associations

Data associations determine how information stored in data objects is handled.

These are the contexts in which data associations can be used:

  • To and from another process or service invoked from a BPMN process.

  • To and from a Human Task service.

  • To and from an Oracle Business Rule.

  • To and from a script task.

    This BPMN flow object is used to pass data objects through data associations.

Table Table 13-2 lists the flow objects where you can define data associations. It also lists the objects implemented.

Table 13-2 Flow Objects that Accept Data Associations

Flow Objects Implementation

Message start and end events

Services and other BPMN processes

Message throw and catch events

Services and other BPMN processes

Send and receive tasks

Services and other BPMN processes

Script tasks

Do not contain an implementation, are used to pass data objects through data associations.

User tasks

Oracle Human Tasks

Business rule tasks

Oracle Business Rules

Service Tasks

Services and BPMN processes

Data associations are used to define the input and output arguments from a flow object to an external service or process. Figure 13-3 shows the relationship between a flow object, its corresponding implementation, and external processes or services.

The arrows represent the input and output arguments to the external process or service. These are defined using data associations.

Figure 13-3 Relationship between a Flow Object, Implementation and an External Service or Process

Description of Figure 13-3 follows
Description of "Figure 13-3 Relationship between a Flow Object, Implementation and an External Service or Process"

It is important to note that although the inputs and outputs are defined in the data associations for a flow object, they define values that are passed to the systems or services being called. These systems and services exist outside of the business process as shown in Figure 13-4.

Figure 13-4 Data Associations within a process

Description of Figure 13-4 follows
Description of "Figure 13-4 Data Associations within a process "

You can use expressions to evaluate and change the input and output values

13.4.1 Introduction to the Data Associations Editor

The data associations editor allows you to configure the input and output values passed between a flow object and its implementation, as shown in Figure 13-5.

Figure 13-5 Data Association Editor

Description of Figure 13-5 follows
Description of "Figure 13-5 Data Association Editor"

Table 13-3 describes the different areas of the data associations editor.

Table 13-3 The Data Associations Editor User Interface

UI Area Description

Inputs

Contains text boxes that display the data objects assigned as inputs to the service or process implemented in the flow object. Next to each text box is an icon that launches the expression editor.

Flow Object Interface

Lists the expected input arguments for the service or process implemented. The flow object interface also contains an expandable list of the data objects supplied as input and output. Within the flow object area, you can expand complex data objects to map to specific basic data objects within a complex data object.

Outputs

Contains text boxes that display the data objects assigned as outputs from the service or process implemented in the flow object.

Data Objects

Displays a list of all the data objects. This list is divided between process and project data objects.

13.4.2 How to Configure Data Associations for a Flow Object

You can configure data associations for flow objects.

To configure a data association for a flow object:

  1. Open the process where you want to configure data associations.
  2. Right-click a flow object that enables data associations, then select Data Associations.

    See Table 13-2 for the list of sequence flows that allow data associations.

  3. From the data objects column on the right, select the data object you want to map as an input argument.
  4. Click and drag the data object to an input text field.