3 Implementation: C:/bpm/solutions/03-Implementation - Zip

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

BPM 11g Foundation Training

3 Implementation

3 Implementation ...........................................................................................................................................1
3.1 Introduction .........................................................................................................................................1
3.2 Launch BPM Studio............................................................................................................................2
3.3 Business Catalog .................................................................................................................................2
3.4 Creating a Business Object ................................................................................................................3
3.5 Data Inputs and Data Outputs..........................................................................................................5
3.6 Creating Data Objects ........................................................................................................................6
3.7 Implementing Enter Quote Details ..................................................................................................8
3.7.1 Defining the Task Service ...........................................................................................8
3.7.2 Generate Form for the Task ...................................................................................... 11
3.7.3 Task data mapping .................................................................................................... 13
3.7.4 Mapping swim lane Roles to LDAP Roles ............................................................. 14
3.8 Configuration of the Service Task .................................................................................................. 16
3.9 Data Association configuration for conditional flows ................................................................. 20
3.10 Configuration of Script Tasks ......................................................................................................... 24
3.11 Deploying the process ...................................................................................................................... 27

3.1 Introduction
Note: The solution for this chapter can be found in c:\bpm\solutions\03-
implementation.zip

In the first exercise, you built a basic process with roles, activities, and transitions. In
this lesson, you will further enhance the process by creating data types, variables, Task
Services, Rule Services, and Adapter Services and binding them to the process
activities.
Objectives
After completing this lesson, you will know how to:
 Implement Process Activities and create Task, Rule and Adapter Services
 Define the different kinds of Data Objects (variables)
 Define Data Inputs and Data Outputs (arguments)
 Map arguments to instance variables

The tasks you will complete in this lesson are:


 Understanding of Business Catalog
 Define Task Services and map to Interactive Tasks
 Define Rule Services and map to Rule Task

Page 1 Oracle Confidential. For authorized use only. Implementation 3.1


Do not distribute to third parties.
BPM 11g Foundation Training

 Define Adapter Services and map to Service Task.


 Create Business Objects (data types)
 Create Data Inputs (input arguments) and Data Outputs (output arguments)
for process and process steps
 Create Variables (Data Objects)
 Create Data Mappings

3.2 Launch BPM Studio


Launch BPM Studio and if prompted for the developer type, select Default.
Note: If you are not sure you have selected the correct developer type go to
Applications Navigator, highlight your BPM Project – QuoteProcessLab – and right-
click on Properties. Go to Technology Scope and see that both BPM and SOA are in
the Selected Technologies pane on the right. If necessary, you can add the technology
to the pane as shown in the figure below.

3.3 Business Catalog


The Business Catalog holds the different types of Services (System, BPEL processes,
Task Services, Rule Services) as well as Business Objects (Data). There are different
folders for holding different types of BPM artifacts. Some folders have a lock to
indicate that the artifacts inside them cannot be deleted.

3.2 Implementation Oracle Confidential. For authorized use only. Page 2


Do not distribute to third parties.
BPM 11g Foundation Training

3.4 Creating a Business Object


Complex types are referred to as Business Objects in BPM Studio and represented by
XML Schema. Business Objects are stored under the Business Catalog folder.
There are 2 ways to create a Business Object
• Create from scratch
• Browse an external schema definition and create Business Objects from it.
In this example, you create a Business Object named Quote defined by the
QuoteRequest element in the Quote.xsd file. Perform the following steps to create this
Business Object.
1. In the BPM Project Navigator, right-click on Business Catalog, select New and then
select Business Object.

This brings up the Business Object dialog.

Page 3 Oracle Confidential. For authorized use only. Implementation 3.4


Do not distribute to third parties.
BPM 11g Foundation Training

2. Type in Quote in the Name field.


3. Click on the browse button next to the Destination Module. This brings up the
Module List dialog. Click on the New symbol to add a module under Business
Catalog with the name Data.

4. Click OK
5. Select the Based on External Schema option and click the Schema Browser icon. This
brings up the Type Chooser dialog. Click on the Import Schema Files icon on the top
right corner to import an XSD file into your BPM Project.
6. Select the Copy to Project option in the Import Schema File dialog and select the
Browse Resources… icon

3.4 Implementation Oracle Confidential. For authorized use only. Page 4


Do not distribute to third parties.
BPM 11g Foundation Training

7. This brings up the SOA Resource Browser window. Locate and select the Quote.xsd
file in the lab materials xsd folder.

8. Click OK to close the SOA Resource Browser and click OK again on the Localize Files
dialog.
9. Expand the Project Schema Files folder in the Type Chooser and expand Quote.xsd
and select the QuoteRequest element. Click OK and click OK again.
10. The Quote Business Object opens. You can add description and documentation
details here as desired. When finished, close the Quote window.
This completes the creation of the Quote Business Object.

3.5 Data Inputs and Data Outputs


Data Input refers to the information required to start the Activity (Task, Sub-process)
or Process. It is the input argument. A collection of Data Inputs is referred to as an
Input Set.
Data Output refers to the data that is returned from the Activity or Process. It is the
output argument. A collection of Data Outputs is referred to as an Output Set.
The Start Event has only Output Set. The End Event has only Input Set. Other
activities can have both Input and Output Sets.
The Output Set of the Start Event and the Input Set of the End Event determine the
arguments of the Process.

Page 5 Oracle Confidential. For authorized use only. Implementation 3.5


Do not distribute to third parties.
BPM 11g Foundation Training

Note: As you will see in later section, the input and output arguments of the process
step is the same as the inputs and outputs of the Service (Task, Rules, or System) that it
is bound to.

3.6 Creating Data Objects


Data Objects represent variables. Data Objects can be one of:
 Process Level (process variables) – Visible throughout the process and
persisted through the life time of the process instance.
 Activity Level (local variables) – Visible within a particular scope of the
process. The lifetime of the Data Object is limited to the lifetime of the scope.
 Project Level (BPM project variables) – Visible across processes within a
particular BPM Project.
A Data Object has a Type. The type can be scalar or native type: String, Integer,
Decimal, Boolean, Array, or it can be a complex type defined by a Business Object.
In this lab, you create 3 String variables for the outcomes of Business Practices
Review, Approve Deal and Approve Terms activities.
In addition, you create a Boolean variable used to determine if the Business Practices
Review step is required or not.
You also create a complex variable of the QuoteRequest type in Quote.xsd using the
Business Object you created for QuoteRequest.
Using the steps outlined below create the Data Objects listed in this table.

Process Data Object Type

approveDealOutcome String

approveTermsOutcome String

businessPracticesOutcome String

businessPracticesReviewRequired Boolean

quote QuoteRequest in Quote.xsd (using the Quote


Business Object you already created)

1. In the BPM Project Navigator, highlight your RequestQuoteLab process to view the
Structure pane in the lower left of the screen. If the Structure pane is not visible, select
View Structure and be sure you have your process selected in the BPM Project
Navigator.

3.6 Implementation Oracle Confidential. For authorized use only. Page 6


Do not distribute to third parties.
BPM 11g Foundation Training

2. Right click on the Process Data Objects folder and select New to launch the Create
Data Object window.
3. Enter a value for the Name field and select the appropriate scalar type.

4. Create the four scalar type data objects listed in the table above.

Now create a Data Object of type Quote Business Object.


5. Right-click on Process Data Objects in the Structure Pane and select New. This brings
up the Create Data Object dialog. Type in “quote” for the Name of the Data Object.

Page 7 Oracle Confidential. For authorized use only. Implementation 3.6


Do not distribute to third parties.
BPM 11g Foundation Training

6. To set the quote to the type Quote Business Object, select the “…” option. This brings
up the Type Chooser window.
7. Select Component from the list of types and then choose the Quote from the list of
Business Objects

Click OK and click OK again

3.7 Implementing Enter Quote Details

3.7.1 Defining the Task Service


In the first exercise, you defined the outline of the process and specified only the Name and
Description for the activities. Now, in order to execute the process, you need to implement
the process activities. Every Interactive Task has to be bound to a Task Service. You can
either browse for existing Task Services or create one on the fly. Multiple Interactive Tasks
can share the same Task Service.

In this exercise, you create a new Task Service.

8. Right click on the Enter Quote Details user activity and select Properties
9. In the Properties dialog, click the Implementation tab
10. Click the green + next to Human Task

3.7 Implementation Oracle Confidential. For authorized use only. Page 8


Do not distribute to third parties.
BPM 11g Foundation Training

11. In the Create Human Task dialog Enter the name, EnterQuoteDetails

Select Initiator for Pattern. This automatically sets the outcome to SUBMIT.
12. Type in Enter Quote for the title.

13. Click on the green + next to Parameters to launch the Data Object dialog

14. Drag quote from the Data Object Navigator window to the Parameters section.

15. Set the parameter to Editable.

16. Click OK and the task definition gets created.

17. click OK again.

Page 9 Oracle Confidential. For authorized use only. Implementation 3.7


Do not distribute to third parties.
BPM 11g Foundation Training

This completes the creation of the EnterQuoteDetails Task Service.


18. Expand the Business Catalog > HumanTasks folder to examine the newly created
Task Service and the Types folder to see the associated types.

19. Now edit the Task Service. Double-click the .task file to open the Task Editor with the
Task Service definition.
20. Set the Title of the task in a dynamic fashion based on incoming payload using the
Text and XPath option and then click the Expression Builder icon on the far right.

3.7 Implementation Oracle Confidential. For authorized use only. Page 10


Do not distribute to third parties.
BPM 11g Foundation Training

21. This opens up the Expression Builder. Create the following XPath expression:

concat('Enter Quote Details for customer' ,


/task:task/task:payload/ns0:QuoteRequest/ns0:Summary/ns0:AccountName, 'Quote id = ',
/task:task/task:payload/ns0:QuoteRequest/ns0:Summary/ns0:OpportunityID)

22. Click OK.

3.7.2 Generate Form for the Task


23. Click on the Create Form menu and select Auto-Generate Task Form

24. Enter the Project Name EnterQuoteUILab and the Directory


SalesQuoteLab\EnterQuoteUILab. Click OK.

Page 11 Oracle Confidential. For authorized use only. Implementation 3.7


Do not distribute to third parties.
BPM 11g Foundation Training

25. The user interface for the Task Service is generated automatically. A number of
dialogs open to give you an opportunity to do some customization. For this exercise,
simply click OK to all the dialogs. You will know when the form is finished when you
see the taskdetails.jspx file open and displaying the form. Save the everything and
close all open task windows.
Complete the Task Service configuration of the remaining four Interactive Tasks – namely
Approve Deal, Approve Terms, Finalize Contract and Business Practices Review in the
same manner, following the steps below
26. Right click Business Practices Review and select the Properties window and the
Implementation tab.
27. Click the “+” symbol to create the Task Service.

28. Enter the Name as BusinessPracticesReview.

29. Select the Pattern as Simple.

30. Enter the title as Business Practices Review, and add the parameter, quote with the
Editable checkbox checked.
31. The Business Practices Review properties dialog looks like the picture below.

3.7 Implementation Oracle Confidential. For authorized use only. Page 12


Do not distribute to third parties.
BPM 11g Foundation Training

32. Click OK and click OK again.

The configuration of Approve Deal and Approve Terms activities are the same as the
configuration of Business Practices Review activity (they have same outcomes –
APPROVE and REJECT).
The configuration of Finalize Contracts activity is the same except that it has single
outcome – OK instead of APPROVE and REJECT.

33. Now create the Task Forms as described for EnterQuoteUILab. Remember to include
the suffix “UILab” for all the auto-generated task forms.

3.7.3 Task data mapping


For the Interactive Task activities, creating the Task also sets the Input Data and Output
Data associations automatically for the data defined in the task when possible. To view
the associations, open the Interactive Task Properties and in the Implementation tab click
on the pencil icon next to it.

Note that for Enter Quote Details, the output association is set while the input association
is empty. You manually set the input for Enter Quote Details towards the end of this lab.

Page 13 Oracle Confidential. For authorized use only. Implementation 3.7


Do not distribute to third parties.
BPM 11g Foundation Training

For the other tasks, you set the appropriate output association for outcome at the end as
well. It’s best to do data associations in the last part of implementation after all of the
different elements have been built.

3.7.4 Mapping swim lane Roles to LDAP Roles


Process Roles have to be mapped to LDAP Roles for the process to run. You use the pre-
seeded roles in the LDAP of the Oracle Weblogic Server installed as part of this training.
The user seeding is already done if you are using the vm image. You need to seed the roles
manually if you installed your own server.
Seed demo users manually: do the following on your running server
a. Open a new command window and unzip demo-community.zip
b. Edit the build.properties with your server name and paths for your
installation. Note bea.home is the same as <Middleware_Home>.
c. Set JAVA_HOME and PATH to point to jdk that is in <Middleware_Home>.
Execute the ant script as follows
cd demo-community/
<Middleware_Home>/modules/org.apache.ant_1.7.1/bin/ant seedDemoUsers

Note: The BPM engine (Oracle Weblogic Server) has to be running to map the Process
Roles to the LDAP roles. Be sure your server is running before continuing.
34. In BPM Studio, navigate to BPM Process Navigator

35. Right click on Organization and select Open

36. In the Organization editor, select the SalesRep role from the list of Roles

3.7 Implementation Oracle Confidential. For authorized use only. Page 14


Do not distribute to third parties.
BPM 11g Foundation Training

37. Click on the green + within the Members sub-panel

38. Choose the Application Server connection for your server. If there is not one already
created, select the green + icon to create it.
Note the following if you need to create a connection. The training configurations
usually use user weblogic and password welcome1. The port is “7001” if you are
using a single server configuration and “8001” if you are using an Admin server
with a SOA managed server configuration. The domain name is “domain1” on
most training machine installations. When you test the connection, you only need
to have the HTTP protocol test successfully. The 8001 port connection will fail for
most of the other protocols but don’t worry; you don’t need them for LDAP!
39. Check the Realm selection and change it if necessary for your installation.

40. Click the Lookup icon to search for users.

41. Select user “jcooper” and click the Select button.

Page 15 Oracle Confidential. For authorized use only. Implementation 3.7


Do not distribute to third parties.
BPM 11g Foundation Training

In a similar manner, perform role mapping as shown in the table below for the remaining
Process Roles:

Approvers cdickens

Business Practices jstein


Contracts wfaulk

Process Owner jstein

You will need to remember which user is assigned to which role later when you run the
process. Write them down or keep this table handy.

3.8 Configuration of the Service Task


Now complete the following to add a service to your application which implements the
SaveQuote Service Task. First you create the service by adding a Service Reference to the
application using the composite editor. Then, you go back to the BPM process and bind
the service to the SaveQuote Service Task.
42. Navigate to the composite editor by clicking the Go To Composite Editor button at the
top of your BPM process.

43. Drag-and-drop the File Adapter from the Component Palette to the right hand
External References pane in the composite editor.
Note that with the composite editor, you must drag the File Adapter and drop it on
the External References pane. You do not use the click-and-drop method that you can
use in the BPM process editor.

3.8 Implementation Oracle Confidential. For authorized use only. Page 16


Do not distribute to third parties.
BPM 11g Foundation Training

44. Walk through steps in the File Adapter wizard and create a service called SaveQuote
to write to a file. The following screens show you the steps: choose the write
operation, specify the destination file name and directory – it must be a directory
accessible to your server such as c:\temp. Do not select the Native Format
Translation Required option, and for the schema choose the QuoteRequest schema
from the Quote.xsd file you used earlier.

Page 17 Oracle Confidential. For authorized use only. Implementation 3.8


Do not distribute to third parties.
BPM 11g Foundation Training

Bind Service Activity to Service


The File Adapter service that you just created in the composite application gets promoted
to the Business Catalog in the BPM Project Navigator automatically.
45. Navigate to BPM Project Navigator

46. Go to Business Catalog/Services/Externals folder and expand it. Verify that the
SaveQuote service is present.

3.8 Implementation Oracle Confidential. For authorized use only. Page 18


Do not distribute to third parties.
BPM 11g Foundation Training

47. Open RequestQuoteLab BPMN process.

48. Right click on Save Quote Service Activity, select Properties and click
Implementation tab
49. Select Service in the drop down menu within Service Task

50. Click on the magnifying glass next to Name to search for available services and select
the service SaveQuote. Click OK to select the service but don’t click OK on the
Properties dialog yet!

Pass Data to Service


51. Select Use Associations within Data Associations section and select type Simple.

52. Drag-and-drop the quote data object from the right hand panel to the Inputs area

Page 19 Oracle Confidential. For authorized use only. Implementation 3.8


Do not distribute to third parties.
BPM 11g Foundation Training

53. Now click OK and click OK again. The Save Quote Service Task is complete.

Warning: There is an intermittent issue with the setting of the Service activity data. To
verify it is set properly, select the SaveQuote service in the Business Catalog. The
structure pane shows the service signature. The parameter name must be
quoteRequest. If it shows as quote, save everything, exit JDeveloper and start it again.
When you see quoteRequest in the service signature, you can continue.

3.9 Data Association configuration for conditional flows


The outcomes of the Business Practices Review, Approve Deal and Approve Terms
Interactive tasks have to be evaluated for conditional branching. The task outcome of
these tasks is a string value of “APPROVE” or “REJECT”. You set these outcomes
when you defined the task. The outcomes get mapped to the Data Objects so you can
then use the Data Objects in the conditional expressions used for branching.
54. Open the Implementation tab for the Business Practices Review properties and map
the task outcome as shown in the figure below. You need to drag and drop the

3.9 Implementation Oracle Confidential. For authorized use only. Page 20


Do not distribute to third parties.
BPM 11g Foundation Training

businessPracticesOutcome data object into the field next to the outcome output
argument. Click OK and click OK again.

55. Map the outcome of the Approve Deal step as shown in the figure below:

56. Map the outcome of the Approve Terms step as shown in the figure below:

Page 21 Oracle Confidential. For authorized use only. Implementation 3.9


Do not distribute to third parties.
BPM 11g Foundation Training

57. Now, specify the data object based conditional expression for the Business Practices
Reject and Deal or Terms Rejected paths as shown in the figures below.

3.9 Implementation Oracle Confidential. For authorized use only. Page 22


Do not distribute to third parties.
BPM 11g Foundation Training

58. Add the condition for the Yes path for Is Business Practices Review Required?
Gateway.

Page 23 Oracle Confidential. For authorized use only. Implementation 3.9


Do not distribute to third parties.
BPM 11g Foundation Training

3.10 Configuration of Script Tasks

Finally, you need to add a Script Task to set the payload (the input data) for the Enter
Quote Details task and to determine whether the Business Practices Review activity is
required or not. The script goes right before Enter Quote Details. Using a script to set the
input data makes testing this process easier but when running such a process for real, the
user who initiates the task would enter the input data.
59. Click and drop a Script Task from the BPMN Component Palette and place it
between the Start and Enter Quote Details steps. Name it Initialize Quote.

60. Click the Implementation tab and select Use Associations.

61. Select the XPath option and click the pencil icon to edit.

62. Drag the quote Data Object into the Custom Assignments area

3.10 Implementation Oracle Confidential. For authorized use only. Page 24


Do not distribute to third parties.
BPM 11g Foundation Training

The XPath expression for the left hand side is shown below. The XML is also available in
the c:\bpm\input\testData.xml file.
oraext:parseXML('<ns1:QuoteRequest
xmlns:ns1="http://www.mycompany.com/ns/salesquote">
<ns1:Summary>
<ns1:OpportunityID>zzzz2</ns1:OpportunityID>
<ns1:AccountName>Acme New</ns1:AccountName>
<ns1:Address>
<ns1:Street>Demo Way</ns1:Street>
<ns1:City>Redwood Shores</ns1:City>
<ns1:State>CA</ns1:State>
<ns1:Zip>94065</ns1:Zip>
<ns1:Country>USA</ns1:Country>
</ns1:Address>
<ns1:SalesRepId>jcooper</ns1:SalesRepId>
<ns1:SalesRepName>James Cooper</ns1:SalesRepName>
<ns1:ValidUntil>2010-05-30</ns1:ValidUntil>
<ns1:EffectiveDiscount>0.0</ns1:EffectiveDiscount>
</ns1:Summary>
<ns1:QuoteRequestStatus/>
</ns1:QuoteRequest>')

63. Click the Expression Builder icon to open the Expression Builder and enter the XML
string. Be sure to use the oraext:parseXML function and enter single quotes around
the XML string inside the ( ).

Page 25 Oracle Confidential. For authorized use only. Implementation 3.10


Do not distribute to third parties.
BPM 11g Foundation Training

The quote Data Object is now initialized to the data in testData.xml.


64. Add another custom data mapping by dragging businessPracticesReviewRequired
into the Custom Assignments area.
65. Set the businessPracticesReviewRequired to false() by either typing it into the
Expression Builder or selecting it from the list of Logical Functions.

66. Go back to Enter Quote Details and set the input mapping to the quote Data Object as
shown in the figure below. There is no need to set the outcome output data because
this task has only a SUBMIT outcome.

3.10 Implementation Oracle Confidential. For authorized use only. Page 26


Do not distribute to third parties.
BPM 11g Foundation Training

67. This completes the implementation of the process.

3.11 Deploying the process

68. Go to Applications Navigator.

69. Highlight the BPM Project QuoteProcessLab and select Deploy.

70. Follow the steps as shown in the screen shot below.

Page 27 Oracle Confidential. For authorized use only. Implementation 3.11


Do not distribute to third parties.
BPM 11g Foundation Training

Note: You will need to configure a connection to the BPM run-time engine along the
way. Earlier, you set up a connection for LDAP access. If you have a managed server
configuration, the LDAP connection used the 8001 port and will not work for
deployment. The training configurations usually use user weblogic and password
welcome1. For deployment, most training configurations use 7001 for the port and
domain1 for the domain. When you test the connection, all protocols should test
successfully.

3.11 Implementation Oracle Confidential. For authorized use only. Page 28


Do not distribute to third parties.
BPM 11g Foundation Training

Page 29 Oracle Confidential. For authorized use only. Implementation 3.11


Do not distribute to third parties.
BPM 11g Foundation Training

3.11 Implementation Oracle Confidential. For authorized use only. Page 30


Do not distribute to third parties.
BPM 11g Foundation Training

This completes deployment of the process. You are now ready to run the process. Go
to the next chapter for instructions on running and testing the process.

Page 31 Oracle Confidential. For authorized use only. Implementation 3.11


Do not distribute to third parties.

You might also like