BPM 11g Samples. bpm-api-101-instance-query

BPM 11g Samples bpm-api-101-instance-query Copyright  2011 Oracle Corporation All Rights Reserved Samples are provided as-is with no warranty Page...
Author: Marsha Barrett
2 downloads 0 Views 589KB Size
BPM 11g Samples bpm-api-101-instance-query

Copyright  2011 Oracle Corporation All Rights Reserved

Samples are provided as-is with no warranty

Page 1 of 10

Contents

1.

Introduction ............................................................................................................4

2.

Environment Requirements ..................................................................................5

3.

Installation and Configuration .............................................................................6

4.

3.1

Updating Project Library Definitions ..................................................................................... 6

3.2

Deploying the BPM and Task Form Projects ......................................................................... 7

3.3

Update wf_client_config.xml ................................................................................................. 7

Samples Overview ..................................................................................................8 4.1

5.

6.

Java Project Contents ............................................................................................................. 8

Sample Scenarios ...................................................................................................9 5.1

InitiateCreditRequest.java ...................................................................................................... 9

5.2

ProcessQueryExamples.java .................................................................................................. 9

Running the Samples ...........................................................................................10

Samples are provided as-is with no warranty

Page 2 of 10

History

Date

Version

Change Reference

Nov-09-2011

1.0

First release of samples

Samples are provided as-is with no warranty

Page 3 of 10

1. Introduction Oracle BPM11g includes a set of APIs that can be used to create and query process instances. The APIs were not documented in 11.1.1.4, but are being documented as part of the 11.1.1.5FP release. See: http://www.oracle.com/technetwork/middleware/soasuite/documentation/bpm-e25378-01-488744.zip This document describes an initial (small) set of samples provided to illustrate use of those APIs. The BPM11g APIs are related to and modeled after the existing SOA Human Workflow (HWF) APIS. The documentation for these samples assumes a working knowledge of: 

The HWF APIs



Developing and deploying BPM11g applications



The overall structure and services provided by the BPM11g APIs

Further details about the HWF APIs can be found in the following chapters of the SOA Developer’s Guide: 

Building a Custom Worklist Client



Introduction to Human Workflow Services

Samples are provided as-is with no warranty

Page 4 of 10

2. Environment Requirements The samples require JDeveloper version 11.1.1.5, with the SOA Composite Editor and BPM Studio extensions installed. A standalone server with BPM Suite 11.1.1.5 and a domain configured with BPM Suite is required for deployment and running the samples. Note: the samples can be run on 11.1.1.5 Feature Pack (11.1.1.5-FP). When you open the project you’ll be notified that the project will be upgraded. The server must also be upgraded to 11.1.1.5FP. After the upgrades (JDeveloper and Server) are complete, you can run the samples using instructions in this document. There are no external configuration requirements (e.g. database connections). The BPM project is configured with swimlane roles mapped to the user “weblogic”. If your environment has a different user in the Administrators group then you’ll need to: 1.

Update the Organization definition in the project or add that user to the swimlane roles via BPM Workspace.

2.

Update the wf_client_config.xml configuration files to include that user name and password.

Samples are provided as-is with no warranty

Page 5 of 10

3. Installation and Configuration The samples are provided as a zipped JDeveloper application. The application can be unzipped into any location where the path name does not include spaces. To open the application, use the “Application Open” menu and locate the file: bpm-api-101-instance-query.jws. The application contains the following projects: 

BPM11gApiExamples – BPM project that includes processes and human tasks.



BPM11gClientApiExamples – Java project with samples of using the BPM11g APIs



CreditIncreaseRequestUI – Task form project for the initiator task used in the samples.



jdev-libraries – Library definitions needed to run samples as a standalone client



Resources – Contains this document

3.1 Updating Project Library Definitions The samples require two sets of libraries: 

WebLogic Full Client



BPM APIs

The WebLogic Full Client jar needs to be generated as described in the HWF Documentation. The HWF and BPM jars needed to support use of the BPM11g APIs are included in the JDeveloper installation. However those jars are not exposed through the default libraries. A set of project libraries to reference those jars is included in the “../jdev-libraries” folder (the paths to the library definitions are relative to the application). However the paths within each library need to be updated to point to the local JDeveloper installation. For each of the following files, open the file (from the operating system) and replace the path: C:/Oracle/jdev11.1.1.5with the path to your JDeveloper installation. In the case of the WebLogic Full Client, point to the location where the file wlfullclient.jar was created. 

bpm.standalone.client.library



wls.fullclient.library

Samples are provided as-is with no warranty

Page 6 of 10

3.2 Deploying the BPM and Task Form Projects From the Application Navigator deploy the BPM Project and (optionally) the Task Form Projects. Note: The Task Form Project is not needed to run the sample. The standalone clients will (separately) create and query the process instances.

3.3 Update wf_client_config.xml The properties for connecting to the SOA/BPM server are in the file: 

oracle/bpm/sample/config/wf_client_config.xml

The values for the serverURL, userName, and password must be updated (as needed) to match those of the target SOA/BPM server. The specified user must be a member of the Administrators group.

Samples are provided as-is with no warranty

Page 7 of 10

4. Samples Overview A simple BPM process is provided to illustrate features and usage of the BPM11g APIs. The process has an initiator task, an approval task, and includes business indicators and project data objects as part of the process state:

The API examples are organized into the following categories: 

Instance Creation and Navigation



Instance Query

The swimlane roles for Initiator and Reviewer include mappings to the “weblogic” user.

4.1 Java Project Contents The Java client project uses the package structure oracle.bpm.samples. Sub-packages include: 

config – the wf_client_config.xml file that holds server connection information



instance – sample of instance creation and navigation



query – sample of querying processes using values from project data objects



util – utility classes and helper functions

Samples are provided as-is with no warranty

Page 8 of 10

5. Sample Scenarios 5.1 InitiateCreditRequest.java The sample source file is oracle.bpm.sample.instance.InitiateCreditIncreaseRequest. This sample shows how to programmatically start a process via an “Initiator” Human Task. While there are other options for starting a process (e.g. defining a web service interface on the composite), this case is used when the process is launched from the Applications panel in BPM Workspace. The sample includes comments to describe how the BPM APIs are being used. The sample can be run multiple times, and the values can be changed. However the initial data provided in the sample creates the set of instances referenced in the instance query sample. So a recommendation would be to run this sample as a setup step for the instance query sample. This sample also includes examples of navigating from task to process and process to task(s).

5.2 ProcessQueryExamples.java The sample source file is oracle.bpm.sample.query.ProcessQueryExamples. This sample shows how process instances can be searched using a model very similar to the HWF query model. The notable differences are: 

Flex field mappings are automatically generated for Project Data Objects. So you don’t go to BPM Workspace to define the labels. Note that Business Indicators in BPM projects are Project Data Objects. So they also have flex field mappings.



Flex field values are retrieved from the IProcessInstance objects returned from the query.



Unlike tasks, there is no access to the process instance payload. So any data to be queried on or accessed via the BPM APIs must be mapped to a Project Data Object.

BPM Workspace… Protected Flex Fields are auto generated for Project Data Objects Note: the Attribute name is selected by the runtime at deployment time and may be different in your environment.

Samples are provided as-is with no warranty

Page 9 of 10

6. Running the Samples Both samples are provided as standalone Java classes with a main() method. However the samples are loosely related in that they share the same small set of sample data. The InitiateCreditRequest will create process instances with values and states as shown in the following table. The ProcessQueryExamples includes the following queries. 

Find All



brand = “VISA”



increaseAmount = 1000



brand = “VISA” and status “OPEN”

Note that you can use the “CreateIncreaseRequest” Initiator Task or Enterprise Manager to create additional instances, then modify the queries to test additional scenarios.

Queries

Samples are provided as-is with no warranty

approvalOutcome APPROVE REJCTED

X X X X

X

X

X

brand="VISA" and status="OPEN"

increaseAmount 1000 2000 3000 4000

increaseAmount=1000

brand VISA MC VISA AMEX

brand="VISA"

all

cardNumber 11111 22222 33333 44444

X

Page 10 of 10