Showing posts with label BPM 11g. Show all posts
Showing posts with label BPM 11g. Show all posts

Wednesday, November 19, 2014

BPM Authentication On Behalf Business User from ADF

This is the next post in the series of ADF/BPM integration, check previous post available here - Dynamic ADF Buttons Solution for Oracle BPM Outcomes. Here I'm going to describe how you could authenticate with BPM from ADF through a proxy user, on top you could apply only business user name, password will not be required.

There is API method available - authenticateOnBehalf(context, userName), you must have a valid connection context created and with authenticateOnBehalf method you could set to use any valid user name, instead of proxy user. Here is the example for Workflow Context:


Similar example for BPM Context, same authenticateOnBehalf method:


As a proxy user I'm using weblogic. You could set to use any different user and consider it as a proxy user.

Tasks assigned for redsam1, connected through proxy user weblogic, are retrieved and displayed in the table:


This is how you could avoid using password for each business user and simply create initial connection through a proxy user. Download sample application - adfbpm11gr4.zip.

Thursday, November 13, 2014

Dynamic ADF Buttons Solution for Oracle BPM Outcomes

BPM Human Task activity is configured with outcomes. Based on these outcomes, buttons in ADF UI are constructed allowing user to perform different actions with the task. Auto generated ADF Human Task form contains a set of predefined buttons and this set is controller with rendered flag. My sample application is using different approach, it implements custom tasks table and dynamic ADF UI for the human task input form - Dynamic ADF Form Solution for Oracle BPM Process. Once user selects a task, action buttons are generated dynamically - using a set of outcomes configured for the particular task.

Here you can download complete sample application - adfbpm11gr4.zip. This application implements a method based on BPM API, where a list of outcomes by the currently selected Task ID is fetched from BPM engine:


Each outcome is represented by ActionType. I'm constructing a list of outcomes to be used on ADF UI. There is ADF UI iterator components on the fragment, this component is generating dynamic buttons, based on the constructed set of outcomes. Outcome name is used to set button name and outcome itself is used as attribute value for the generic action listener method:


Generic action listener method is responsible to parse outcome name, initialise a payload if needed, and execute BPM API to submit the outcome for further task processing:


We can check how this works. There is a human task AssignEmployee with SUBMIT outcome, in the sample application:


Task action button is generated accordingly - there is only one Submit action button for the selected task:


The next human task ApproveEmployee is set with two outcomes - APPROVE and REJECT:


Based on the set of the outcomes, two buttons are present now - Approve and Reject:

Friday, November 7, 2014

Dynamic ADF Form Solution for Oracle BPM Process

I was working recently on integrating ADF 11.1.2.4 and BPM 11.1.1.7 environments. This worked pretty well, all configuration was done based on my previous blog post for similar topic, only previous ADF and BPM versions - BPM 11g R1 Worklist Integration (Hacking Experiment) Into Non-SOA ADF 11g R2 Domain. Goal of this post is to describe dynamic ADF form approach associated with BPM process human task.

BPM payload contains additional element called voInstanceName. This element is supposed to contain ADF VO instance name, this instance will be used later to render dynamic ADF UI for the currently selected task:


Sample application - adfbpm11gr4.zip, is based on two separate applications. One implements simple BPM process with payload including ADF VO instance name and another implements standalone dynamic ADF application with BPM API.

There are two human tasks in BPM process. Each of these human tasks accepts a payload element with ADF VO instance name. This allows to control ADF UI from BPM process, by providing ADF VO instance name to be used in ADF. The first human task is set to work with EmployeesView1 instance:


Second human task is set to work with different ADF VO instance - EmployeesROView1:


I'm reading voInstanceName payload variable value in ADF application, to construct dynamic ADF UI accordingly. Accessing currently selected task by ID and retrieving payload information for voInstanceName. Later this information will be used to construct dynamic ADF iterator:


Value from voInstanceName payload is used as a parameter for the ADF task flow rendering dynamic ADF UI. Task flow is configured to refresh each time, when parameter value is changed - new UI will be rendered for each new task selected:


ADF task flow checks if parameter for voInstanceName is not empty (it could be empty, if there are no tasks from BPM or payload value was not set). If there is no value, user will be redirected to the empty fragment:


Dynamic ADF UI is constructed in the bindings, instead of using static ADF iterator - we are initialising iterator from task flow parameter value passed through voInstanceName. This is how we can switch between different VO's from the ADF BC, depending on BPM task selected:


ADF UI is rendered with dynamic ADF form component. There are several ways to implement dynamic ADF UI, it can be all custom or using out of the box ADF UI components (depends on use case requirements). Here I'm using out of the box dynamic component, because UI is fairly simple:


This is how it looks like. Initially there are no tasks, no dynamic ADF UI - blank screen:


Start a new task in BPM, task is started through BPM API from standalone ADF application:


ADF UI form is rendered for the task. User can select a task and then select Employee, by navigating with Next/Previous buttons. As soon as Employee is selected (ID: 103), task can be submitted for further processing:


Login with different user - redsam2 and you are going to see new task in the inbox. Employee data is rendered from different VO instance and is readonly now. Employee ID was taking from the payload, this is how a row with ID: 103 is selected (the same as selected in the previous step):


Employee data in the second step is rendered from different read-only VO, including Job Title attribute:


There are two human task activities in the process, both are rendered with different dynamic ADF UI:

Saturday, October 12, 2013

Integrating Custom BPM Worklist into WebCenter Portal (Same Domain for BPM and WebCenter)

I would like to share sample application configured to run custom BPM Worklist and steps describing how to configure and access it from the WebCenter Portal. This post will be based on two other posts from my blog, I would recommend to go through them first. The one where is described how to extend WebCenter Portal 11.1.1.8 - Extending WebCenter Portal 11.1.1.8 Made Easy. Other one about deploying custom ADF shared libraries - Deploying ADF Applications as Shared Libraries on WLS. For this post, I assume BPM and WebCenter environment is running on the same domain. Ah, and there is one more - custom BPM Worklist access implementation through BPM Java API - ADF 11g PS5 Application with Customized BPM Worklist Task Flow (MDS Seeded Customization).

BPM and WebCenter Portal runs on the same domain - each of different WebLogic Managed Server. With such configuration, setup is quite straightforward, comparing to having separate domains:


As there is one domain, it is relatively easy to link WebCenter to BPM. You only need to define Foreign JNDI provider, it will alloow to access Worklist context from WebCenter Portal environment. Make sure BPM libraries are targeted to WebCenter Portal server.

Sample application - BPMWebCenterExtendApp.zip, contains a script to create required Foreign JNDI provider for WebCenter managed server. As BPM and WebCenter runs on the same domain, make sure to disable other properties of the script, except createJNDI:


Script may fail or produce errors, but JNDI link will be be created successfully anyway, most likely. Go to WebLogic console and verify it, you should see similar entry under Foreign JNDI providers:


All required links for this Foreign JNDI provider should be created by the script:


Script may fail to set proper target for created Foreign JNDI provider, you can do this manually. Make sure target points to WebCenter managed server:


Application where ADF task flow is implemented with custom BPM Worklist, imports several required BPM related libraries. You can see a list here:


ADF task flow is fetching list of tasks from BPM engine, tasks assigned to current user. In the next step, it displays assigned tasks in the table:


Sample application provides a method to access BPM Worklist context and fetched tasks assigned to the user:


ADF task flow with custom BPM Worklist access is deployed as ADF Library, this allows to integrate it into WebCenter portal through extending mechanism:


ADF Library will be deployed with provided SharedLib application, deployed as redsamurai.shared.lib library:


This shared library is referencing required BPM libraries, plus our ADF Library with custom ADF task flow for BPM Worklist:


Deploy shared library to WebCenter managed server:


Once shared library is deployed, restart WebCenter managed server and you should be able to add custom BPM Worklist ADF task flow to WebCenter Resource Catalog:


Through WebCenter page editor, we can add our custom ADF task flow from the catalog:


Task flow displays list of tasks assigned in BPM for current portal user:


We can open standard BPM Workspace environment and see same tasks available there:


This example displays list of tasks retrieved from BPM for the current user. Using BPM API we could create new task, process task, map task instance with UI form. This is the beauty of ADF, you are free to implement your own lightweight components to interact with BPM and consume in WebCenter Portal.

Sunday, June 23, 2013

Calling ADF BC Web Service from BPM Process

This post is about calling ADF BC Web Service from BPM Process. In order to keep track of the steps executed in the process I will be calling ADF BC Web Service, passing task outcome and updating database table. This is quite handy, especially when identifying and recovering failed BPM process instances. You could implement process instance replay, when process instance execution data is stored in the DB. For this purpose I will pass process instance ID to the ADF BC Web Service in order to identify and assign current process task.

Run sample application - adfbpmapp_ps6_v3.zip and start new process:


We can see from BPM log - first task is completed and call to ADF BC Web Service is executed:


Same can be visualized in the process flow:


Database is updated through ADF BC Web Service with current process instance ID, payload ID and task outcome - started:


Push task further by submitting it for approval:


This will be visualized in the process flow - invoking status update through ADF BC Web Service and arriving to approve employee task:


Database is updated for the current process with the task executed set to be assigned:


Let's reject this task now:


Process flow comes back to original assigning task:


This is logged in the DB - status reject:


Start new task and you will see that record with new process instance ID will be created, assigned with different status:


Finally if first process instance gets approved:


We can see this updated in the DB - status approve:


This was quick description about how such functionality works, now I will describe important things from technical perspective.

First issue you will encounter when calling ADF BC Web Service from BPM process - Data Source driver compatibility. By default ADF BC is using non-XA data source driver, however this should be changed when calling ADF BC from BPM process. If you would use default non-XA driver, there will be error generated related to transaction failure and driver type:


Go and declare second driver for your ADF application, now XA type driver:


Make sure you select it for the application module configuration serving ADF BC Web Service:


ADF BC Web Service method itself executes View Criteria to search for process instance ID. If such ID was already logged, it updates the record, if not - creates new record:


Here we can see custom method from Application Module Implementation class exposed as ADF BC Web Service method:


Make sure to set additional listener class in weblogic.xml of ADF BC Web Service application, otherwise ADF BC Web Service method will not be located from BPM process. Add this listener - oracle.jbo.client.svc.ADFApplicationLifecycleListener:


You need to copy ADF BC Web Service WSDL URL and use it in BPM process to define service call:


Here you can see ADF BC Web Service invocation service call defined in BPM process:


Very important is to set correct Registry property for the service call defined on top of ADF BC Web Service. Registry property must start with ADF BC Web Service deployment application name and end with JBOServiceRegistry system keyword (there must be _ between these two).

ADF BC Web Service payload values are initialized through data association. Process instance ID is set from predefined BPM process variable - ecid: