Oracle® Fusion Middleware Modeling and Implementation Guide for Oracle Business Process Management 11g Release 1 (11.1.1.7) Part Number E15176-10 |
|
|
PDF · Mobi · ePub |
This chapter describes how to use Business Objects in a BPM Project. Business Objects allow you to manage the data in your process efficiently and enable you to reuse existing components. They reduce the complexity of your process making it easier to maintain.
This chapter includes the following sections:
Business Objects allow you to model and develop the business entities that are part of your process using the Object Oriented paradigm.
Using Business Objects simplifies the management of the data in your process by encapsulating the data and business behavior associated with the business entity it represents.
A business object is composed of a set of attributes and a set of methods. Attributes store the data related to the entity you are modeling. Methods manipulate the value of these attributes, or perform calculations based on their values.
Typically Business Objects represent entities in an actual business, but you can also use them to encapsulate business logic that is not associated to any particular entity.
Generally when your process contains a large number of data objects, you can group those that describe the same identity in a business object. For example, in the Sales Quote example you can group the following data in a Quote object:
Quote Summary
Quote Request Status
Recommended Discount
Using Business Objects to manage a group of related data reduces significantly the complexity of your process by replacing multiple process data objects by a single data object of the type of the business object you defined. Additionally it provides you other benefits described in the Section 10.1.2, "Benefits of Modeling Using Business Objects".
In a Sales Quote example you can identify the following business entities:
Quote
License Terms
Product Item
Approval Flow
Contract
Each of these entities groups a set of highly related data. This data is represented in the attributes of an business object. The attributes define and describe the same business entity. The value of these attributes defines the state of the business object.
The Business Objects you define in your BPM project are stored in user-defined modules in the business catalog. When you open a business object, its editor shows you its description and the attributes that compose it.
Oracle BPM Studio provides an editor to view and edit the structure of a business object. The editor enables you to:
Add a description
Add documentation
Add, edit, and remove attributes.
View the namespace information
Figure 10-1 shows the Business Object Editor editing a Quote object created manually.
The way you create a business object determines its characteristics and functionality.
The following are different ways of creating a business object:
Manually: You can build a business object manually by creating it and then adding attributes and documentation.
Based on an XML schema element or complex type: The resulting business object contains one or more attributes that map the selected schema element or complex type. You cannot remove these attributes, but you can add new attributes.
By customizing a synthetic type in the Types: You can customize the types that the business catalog adds to the Types predefined module when you add a Service or a Reference that require them as arguments. When you customize a type you can store it in a user-defined module, change its name and add attributes to it.
Using business objects to manage the data in your process provides you the following benefits:
Simpler Processes: Using business objects reduces the quantity of process data objects in your process. This makes your process simpler and easier to read.
Coupling Reduction: If your process has fewer data objects, the subprocesses and activities that compose it, require less parameters.
Re-use: You can use a business object you defined for a particular process in other processes that do not necessarily belong to the same project. Reusing business objects can dramatically reduce the development time of your project.
Easy Maintenance: If you update or fix a bug in a business object all the processes using it benefit from those changes.
Parallel Development: After you agree on a certain interface for the business objects in your process, some members of your team can work on the development of those business objects while others work on the development of the process.
Unit Testing: You can test each of the business objects in your process separately. Unit Testing reduces the complexity of your test cases and improves significantly the quality of your project.
When you name a business object you should respect the following rules:
Use one or more nouns, or nouns modified by adjectives.
Do not start the name with a number.
Use capital letters only to distinguish internal words.
Keep names simple and descriptive.
Use whole words, avoid using acronyms unless they are widely known.
Note:
Oracle BPM Studio forces the first letter of the name of a business object to uppercase.
You can add business objects to your BPM project to store data related to the processes it contains. The business objects you add are stored in the business catalog, for more information about the business catalog, see Chapter 9, "Using the Business Catalog".
When developing a business object you can modify it, rename it, or delete them. You can also add documentation that helps you identify the functionality of the business object or describes how to use it.
You can add business objects to the business catalog to model the business entities to store the data in your BPMN process.
To add a business object:
Right-click a user-defined module in the business catalog.
Select New and then select Business Object.
Enter a name to identify the new business object.
Note:
You cannot repeat a name within the same module. However you can assign the same name to business objects in different modules.
Click OK.
The business object appears in the business catalog. You can use this business object to define the type of the following elements in your BPMN process:
Arguments in data associations
Process data objects
Project data objects
You can modify an existing business object by:
Adding attributes
See Section 10.6.1, "How to Add a Business Object Attribute".
Deleting attributes
See Section 10.6.2, "How to Delete a Business Object Attribute".
Adding documentation
See Section 10.6.3, "How to Document a Business Object Attribute".
You can delete a business object that you do not use or need. If your project contains flow objects or data associations that use the deleted business object, then you must remove them manually.
To delete a business object:
In the BPM Project Navigator, right-click the business object you want to delete.
Select Delete.
A confirmation message appears.
Click OK.
Oracle BPM Studio removes the business object from the business catalog. If there are any flow objects in your process that use the removed business object, then you must remove these references manually.
You can add documentation to a business object for other process developers to understand its functionality and data structure.
To Document a business object:
Edit the business object.
In the business object editor, in the business object Editor, click the Edit button next to the Documentation field.
Add the documentation for the business object.
See Section 3.6.1, "Introduction to the Documentation Editor", for details on how to create and edit documentation.
Click Close.
You can use business objects to store data related to your process. To use a business object in your project, add a process data object to your process and set its type to the business object you created. You can update the information in this data object from any of the activities in the process.
You can create a complex data object in your process that defines its type using a business object.
To use a business object in a Process:
Add a process data object to your process. Use the business object as the type of the data object.
See Section 5.3.1, "How to Add a Process Data Object", for information on how to add a process data object.
Note:
When selecting the type of the data object use the Browse More Types... button to display the complete list of types. Then select <Component> to display the list of available business objects.
Initialize the value of the data object in the process using a Script Task or Data Associations.
The data object you defined has the structure defined in the business object. The type of the data object is the name of the business object. For example, if you define a business object SalesQuote and then create a data object that uses this business object as its type, then the type of the data object is SalesQuote.
You can assign values to the data objects that use these types using data associations and script tasks.
You can create a business object based on an XML schema element or complex type. The XML schema element or complex type you use to create your business object has to be part of your BPM Project. You can add an XML schema that contains the element or complex type to your project, or you can use a use a type defined inline in a WSDL file. For the latter you must add the WSDL file to your project by adding an SOA Adapter of type Web Service.
When you create a business object using an XML schema element, the selected element becomes an attribute of the resulting business object.
When you create a business object using an XML schema element, the selected element becomes an attribute of the resulting business object.
If you create a business object based on a schema contained in a WSDL file, then you cannot use the resulting business object as the type of an attribute of another business object.
Before following this procedure ensure that the business catalog contains the XML schema you want to use as a base for your Business Objects.
To add a business object based on an XML schema or complex type:
Right-click a user-defined module.
Select New and then select Business Object.
The Create Business Object Dialog appears.
Enter a name to identify the new business object.
Select Based on External Type.
Click the Browse button next to the External Type field or add a new XML schema following the procedure described in Section 10.4.3, "How to add an XML Schema to Your BPM Project".
Select the external type from which to create the new business object.
You cannot modify or add attributes to the business object. The structure of the business object is based on the structure of the XML schema element or type.
From the Create Business Object dialog you can add an XML schema to your project.
To add an XML schema to your BPM project:
In the Create Business Object Dialog, click the Schema Browser button.
The Type Chooser dialog appears.
In the upper right corner, click the Import Schema Files button.
The Import Schema File dialog appears.
Click the Browse Resources button next to the URL field.
The SOA Resource Browser appears.
Browse your file system and select a schema file.
Select Copy to Project.
Click OK.
If the XML schema contains references to other types a dialog to confirm their import appears.
The Browse Resources dialog closes and the Type Chooser dialog appears.
Select an element to use as the base of your business object.
Attributes store data that defines and describes the business object. The attributes in a business object are equivalent to instance variables in Object Orientation.
In the Sales Quote example you can identify the following attributes in the Quote object:
Summary
Product Items
Quote Request Status
License Terms
Recommended Discount
These attributes describe the product and are relevant to the process. The ID or SKU serves to identify the chosen product. The description is probably used to show the user what the product does. And the price is used to show the customer how much the product costs and later in the process to calculate the total amount due.
When you define an attribute you must specify:
Name: used to identify the attribute.
Type: that defines the type of data you can store in the attribute. Attributes support simple types or other defined business objects.
Additionally you can define the following:
Description: provides details about the attribute that help other process developers to understand its use.
Documentation. See Section 10.6.3, "How to Document a Business Object Attribute".
Custom default value
Not null constraint.
The following table describes the supported data types for an attribute in a business object:
Data Type | Description |
---|---|
Bool |
True or false values |
Int |
Integer numbers |
Decimal |
Decimal numbers with defined precision |
Real |
Real numbers |
String |
Alphanumeric values |
Time |
Units of time |
Interval |
Intervals of time |
Binary |
Binary values (For example: images, files) |
Array |
A collection of elements of a specified data type |
Complex Types |
Other business objects |
When you name a attribute of a business object you should respect the following rules:
Use one or more nouns, or nouns modified by adjectives
Use capital letters only to distinguish internal words
Keep names simple and descriptive
Use whole words, avoid using acronyms unless they are widely known
Do not start the name with symbols
Use short but meaningful names
Avoid using one-character names
Note:
Studio forces the first letter of the name of an attribute to lowercase.
To model a business object you must add it attributes. These attributes store the data related to your process. You can add, modify and delete attributes as necessary.
You can also add them documentation that describes the data they store and provides any necessary information to the user of the business object.
To model a business object that you created from the start, you must add attributes.
To add an attribute to an existing business object:
In the BPM Project Navigator Right-click the business object where you want to add the attribute.
Select New and then select Attribute.
Note:
Another alternative for the previous steps is editing the business object and clicking the Add button in the Attributes section.
Enter a name to identify the new attribute.
From the type list, select a type for the new attribute, or click the Browse More Types... button to select a complex type.
Click OK.
To delete an attribute from an existing BPM Object:
Edit the Business Object that contains the attribute you want to remove.
In the Attributes section, click the Remove Attribute button next to the attribute you want to remove.
A confirmation message appears.
Click OK.
You can add documentation to a business object attribute for other process developers to understand its functionality.
To document a business object Attribute:
Edit the business object that contains the attribute you want document.
In the Attributes section, expand the business object attribute you want to document.
Click the Edit... button next to the Documentation field.
The Documentation Dialog appears.
Add the text to document the functionality of the selected attribute.
See Section 3.6.1, "Introduction to the Documentation Editor", for details on how to create and edit documentation.
You can share business objects between different projects by exporting them to a file and then importing them.
You can choose to export a single business objects or multiple business objects. When exporting multiple business objects you can also export exceptions. The file that contains the exported business object has the extension .bob. If the business object depends on other business objects, then those dependencies are also included in the export file.
You can import the business objects from the export file in any other project. When you import a business object, Studio also imports the module where it was stored if the module does not exist already.
To export a business object:
In the BPM Project Navigator, right-click the business object.
Select Export.
The Select Object File dialog appears.
Select a directory where to store the exported business object.
In the File Name field, enter a name for the exported business object.
Click Save.
The exported business object file is stored to the selected directory.
To export multiple business objects:
In the BPM Project Navigator, right-click the Business Catalog node.
Select Export Business Objects and Exceptions.
The Choose Objects dialog appears.
Select the business objects and exceptions to export:
From the Search list select a business object or exception.
Click the Select button.
The business object or exception appear in the Selected list.
Click OK.
The Select Object File dialog appears.
Select a directory where to store the exported business object.
In the File Name field, enter a name for the exported business object.
Click Save.
The exported file is stored to the selected directory.
To import business objects from a file:
In the BPM Project Navigator, right-click the Business Catalog node.
Select Import Business Objects.
The Select Object File dialog appears.
Select the file that contains the exported business objects.
Click Open.
The business objects contained in the selected file appear in the business catalog.