Wednesday, July 27, 2011

Custom ADF UIShell Application with Oracle BPM Workspace Task Flows

An Excerpt from Appendix A (Creating Custom ADF Applications with Oracle Business Process Management Workspace Task Flows) of the Oracle Fusion Middleware User's Guide for Oracle Business Process Management 11g Release 1 (11.1.1.5.0)
Different features available in Process Workspace are exposed as standalone reusable components, called task flows. You can embed task flows in any Oracle Application Development Framework (ADF) application. These standalone task flows provide many parameters that enable you to build customized applications.
All the task flows are bundled in an ADF library that you can include in the application in which you are embedding.

Below are the notable steps that I have done to incorporate the BPM Workspace task flows into this custom ADF UI Shell application:
  1. I Added the BPM Worklist component in the class path. This library includes the adflibTaskListTaskFlow.jar that contains the reusable taskflows related to the standard worklist application.
  2. I want to display the "Process Tracking" and "Standard Dashboards" tabs, so I acquired the oracle.bpm.workspace-adflib.jar from a process portal installation and added it into the libraries and classpath.
  3. Modified the weblogic-application.xml to add some soa and bpm related library references. Please see the weblogic-application.xml in the artifacts section below.
  4. Added weblogic.xml descriptor that includes a library ref to the "oracle.soa.worklist.webapp" library. Please see artifacts section for the complete weblogic.xml
  5. With the jars configures from the steps above, the application is already deploying fine, but I encountered ClassNotFoundExceptions during runtime. I exploded the OracleBPMWorkspace application that ships with the standard Oracle Suite 11g R1 installation and noticed 4 additonal jars as part of the WEB-INF/lib directory, namely: oracle.bpm.security.jar; oracle.bpm.jsfcomponents.jar; oracle.bpm.workspace.adf.jar; oracle.bpm.workspace.model.jar; and oracle.bpm.web-resources.jar. I added them all to the libraries and class path.
  6. I configured ADF Security and added resource grants to the corresponding task flows. Ensure to mark check the "Show task flows imported from ADF libraries" checkbox located in the jaz-data.xml Overview tab.
  7. Tested the application by deploying it to a soa enabled weblogic server.

User Experience

Figure 1: Workspace Tasks Tab

To display the BPM Applications/ Initiable tasks in the left panel above, you also need to set the "taskFlowMode" parameter of the "taskList-task-flow-definition" to "workspace" and add the taskFlow binding "processApplicationsTaskflow1" on the same page definition. Please the see the complete taskListPageDef.xml page definition on the artifacts section below.


Figure 2: Workspace Process Tracking Tab

The process instances table is displaying, except for ONE BIG FAIL, it does not expose anything, like sort of contextual events- for example, so that the processInstanceDetailTaskflow can sync with the current selection on the processInstancesTaskflow. I hope I'm just wrong but the documentation is empty about this.


Figure 3: Workspace Standard Dashboards Tab


Artifacts

weblogic-application.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd"
                      xmlns="http://www.bea.com/ns/weblogic/weblogic-application">
  <listener>
    <listener-class>oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener</listener-class>
  </listener>
  <listener>
    <listener-class>oracle.mds.lcm.weblogic.WLLifecycleListener</listener-class>
  </listener>
  <library-ref>
    <library-name>adf.oracle.domain</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.soa.bpel</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.soa.workflow</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.bpm.runtime</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.bpm.client</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.bpm.projectlib</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.bpm.workspace</library-name>
  </library-ref>
  <library-ref>
    <library-name>oracle.bpm.webapp.common</library-name>
  </library-ref>
</weblogic-application>


weblogic.xml
<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">

  <security-role-assignment>
    <role-name>valid-users</role-name>
    <principal-name>users</principal-name>
  </security-role-assignment>
  <session-descriptor>
    <persistent-store-type>replicated_if_clustered</persistent-store-type>
  </session-descriptor>
  <library-ref>
    <library-name>oracle.soa.worklist.webapp</library-name>
    <specification-version>11.1.1</specification-version>
  </library-ref>
</weblogic-web-app>

taskListPageDef.xml
<?xml version="1.0" encoding="UTF-8" ?>
<pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
                version="11.1.1.60.13" id="taskListPageDef"
                Package="fragments.workspace">
  <parameters/>
  <executables>
    <variableIterator id="variables"/>
    <taskFlow id="taskListtaskflowdefinition1"
              taskFlowId="/WEB-INF/taskList-task-flow-definition.xml#taskList-task-flow-definition"
              activation="deferred"
              xmlns="http://xmlns.oracle.com/adf/controller/binding">
      <parameters>
        <parameter id="taskFlowMode" value="workspace"/>
        <parameter id="showViewsPanel" value="true"/>
        <parameter id="showTaskDetailsPanel" value="true"/>
      </parameters>
    </taskFlow>
    <taskFlow id="processApplicationsTaskflow1"
              taskFlowId="/WEB-INF/processApplicationsTaskflow.xml#processApplicationsTaskflow"
              activation="deferred"
              xmlns="http://xmlns.oracle.com/adf/controller/binding"/>
  </executables>
  <bindings/>
</pageDefinition>

Sample Application

You can download the sample sample application from here.
To test the sample application after deployment, open in browser "http://host:port/myworkspace/faces/main".

16 comments:

  1. Hi Pino,

    This is Subba again. Sorry to BUG you again and again. Actually i am stuck with this.

    I followed the same steps and deployed the sample app With ADF security to SOA server. It is working absolutely fine. I am able to see task and details for a logged in user.

    Now the sam application I have to integrate with a ADF Dashboard which is deployed in ADF domain(separate from SOA server). I followed the steps mentioned in http://download.oracle.com/docs/cd/E17904_01/integration.1111/e10224/bp_designtf.htm#SOASE85258

    I am able to deploy the ADF app to ADF server(non-SOA). but when i launch the task-flow I am getting Error page which says,

    Possible reasons could be 1) SOA server configuration might be in-correct 2) If you are running in "federatedMode" default server might be down.

    I have used same wf_client_config.xml which i used for SOA server deployment. Is there any steps missing? Did you try deploying this app to non-SOA server?

    Pls help in this regard!!

    Thanks!!
    Subba.

    ReplyDelete
  2. Hi Subba,
    Please see the following post for your perusal.
    http://soadev.blogspot.com/2011/07/bpm-workspace-deployed-non-soa-server.html
    The post will deploy same application present in this post but with additional configuration.
    If you are not using ADF security, then for testing, you can try to run the application but add additional principal and credential information in your wf_client_config.xml.

    Regards,
    Pino

    ReplyDelete
  3. Hi Rommel,

    Thanks alot for your clarifications. I appreciate it.

    Can you help me in getting this done for a non-ADF secure application, I mean how to pass user/principal and credential inwf_client_config.xml? Is there away that we can dynamically pass the user credential,i mean,in case we have logged in user populated in some session variable, how to pass that in wf_client_config.xml file?

    Pls help!!

    ReplyDelete
  4. Hi Pino,

    Any updates on this pls?

    Basically, We need to use this ADF BPM task list region from a non ADF secure application which is deployed into a adf_domain which is a non SOA server.

    Alos, is there any documentation/links on how to use global task felx fields to populate custom values from payload? that we can show on task list region table ?

    Pls help!!

    Thanks!!
    Subba.

    ReplyDelete
  5. Hi Subba,

    You can find the documentation on the custom views and flex field from the Oracle SOA Suite Developers Guide as follows:
    http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10224/bp_worklist.htm#CIHEAFBC

    With regards to running the server on the non-ADF Secure application, What I have tried is just setting the credentials in the wf_client_config.xml as follows:
    <remoteClient> <serverURL>t3://hostname.domain_name:8001</serverURL>
    <userName>weblogic</userName>
    <password>weblogic</password>
    <initialContextFactory>weblogic.jndi.WLInitialContextFactory
    </initialContextFactory>
    <participateInClientTransaction>false</participateInClientTransaction>
    </remoteClient>

    But I was not able to dynamically assign credetials yet.
    My question now- what preculeds you from using ADF Security for Authentication?

    Regards,
    Pino

    ReplyDelete
  6. Hi Pino,

    We have a already built ADF applications deployed as shared libs and accessed from Dashboard application which is a UISHell dynamic tab UI.

    Now we dont have ADF security enabled for all these, instead we have another route to authorize the user, where we are suing DB custom API's according to the business and authenticate user from AD(through SSO enabled on AD)

    Now, the credentials we pass in wf_client_config.xml are generic credentials rt( weblogic/weblogic) looks like they are WLS domain credentials. But how can we pull in and display the task list related to a currently logged in user?

    How could applications deployed with non-ADF security can utilize this ADF tasklist region?

    Thanks for your help!!

    ReplyDelete
  7. Hi Pino,

    I started building custom BPM worklist task-flow by using the BPM API's thorugh managed bean code and building ADF table to show task list on jsff.

    I am able to render the ADF table fine, now want to display the corresponding task details on a row selction in ADF table.

    I saw your previous post where you have used modal-dialog-task-flow from adfLibTaskListTaskflow.jar. But it opens as a dialog or a new window.

    Is there a way that we can render the task details right below to the table? I know, the task flows they exposed uses JSPX pages and we can not include as a region in page fragments.

    But actaully our requirement is to render the details with in same page when user selects a task in the above table. The same behaviour how it exists in standard BPM worklist.

    I also see another task-flow in same adfLibTaskListTaskflow.jsr file, which is taskdetail-task-flow-definition. Looks like this also built with JSPX pages.

    Pls help me, if there is a way that we can render the human task notification details with in the same jsff as a region. We also need to capture the return values to do further processing on "Approve/Reject" on a particular notification. In standard BPM they are just refreshing the page once user click on "APPROVE/REJECT".

    Pls help me in getting this done.

    Thanks alot for your help!!

    Regards!!
    Subba.

    ReplyDelete
  8. Hi Subba,

    If you wanted to display the deatisl on same page fragment just like the standard worklist, drop a panel splitter on your fragement, and on the second facet, put an <af:inlineFrame>. The inline frame should have a proper destination URL to point to the standard BPM Task Form. Use the getTaskDisplayURL() method that I have in my previous post:
    http://soadev.blogspot.com/2011/07/custom-bpm-applicationsinitiabletasks.html
    As to catching a return value, I dont think it is possible with inlineFrame, but maybe I'm wrong.
    Regards,
    Pino

    ReplyDelete
  9. Hi Pino,

    af:inlineFrame worked and we are able to render the task-details below to task table. And we are handling refreshing the parentURL after user performs Approve/Reject on a task.

    I have one final question on maintaining we_client_config.xml for different Environment. For us we have code deployed to different Environments like Dev, UAT and Prod. For all these three we have different SOA server URL's to be specified in wf_client_config.xml.

    Can we provide all three SOA server URL's with only one as "Default" "Remote_Client"? Will that work or do we need to have 3 different wf_client_config.xml files?

    The reason behind this question is, we are placing wf_client_config.xml as part of WEB-INF/classes rt? if we maintain 3 different files we need to change the files according to a particular Environment. SO is there way that we can maintain this config file easily?

    Thanks alot for your help!!

    ReplyDelete
  10. Hi Subba,

    Its good to know that you finally made it work.

    "...is there way that we can maintain this config file easily?" - if you are using ANT for automated deployments then you can just maintain 3 files in a resource folder and get the appropriate one to put in /WEB-INF upon deployment.

    Cheers!

    ReplyDelete
  11. Hi Pino,

    Need help again!!
    Other day I deployed my sample worklist in Integrated server and it was working perfectly fine.

    Now, today i deployed the same EAR to another hosted WLS server, and it is failing with the below exception.

    oracle.adf.model.adapter.AdapterException: DCA-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-29000: Unexpected exception caught: java.lang.ClassCastException, msg=oracle.bpel.services.workflow.query.ejb.TaskQueryService_oz1ipg_HomeImpl_1034_WLStub
    at oracle.adf.model.adapter.bean.BeanDataControl.loadProvider(BeanDataControl.java:152)
    at oracle.adf.model.adapter.bean.BeanDataControl.(BeanDataControl.java:70)
    at oracle.adf.model.adapter.bean.BeanDefinition.createDataControl(BeanDefinition.java:103)
    at oracle.adf.model.adapter.DataControlFactoryImpl.createSession(DataControlFactoryImpl.java:174)
    at oracle.adf.model.binding.DCDataControlReference.getDataControl(DCDataControlReference.java:167)

    When i search forums, I find similar post, http://forums.oracle.com/forums/thread.jspa?threadID=2233842&tstart=15

    I compared both WLS server library deployments, both are exactly same. What might be missing? the same application EAR working in Integrated but not in hosted DEV WLS instance.

    Pls help me on how to solve this.

    Thanks for your help!!
    Subba.

    ReplyDelete
  12. Rommel,
    Not sure if you have used process spaces. The tasklist exposes the HWFSelect event. Have you tried consuming them in this ADF app with bpm taskflows?

    thanks
    Vivek

    ReplyDelete
  13. Hi how can i access the behind java code used in the workspace development.i need to writ a report for my bpm application need to add code

    ReplyDelete
  14. Good morning:

    Has anyone achieved run the taskflow "processInstanceDetailTaskflow" contained in the library "oracle.bpm.workspace-adflib.jar" (which you can get from a process portal installation) in an ADF Application with the PS5?

    I have included the library "oracle.bpm.workspace-adflib.jar" in my "Libraries and Classpath" in my ViewController.
    I drag and drop the taskflow "processInstanceDetailTaskflow.xml" in an Test.jspx
    I have created a commandButton" and an "InputText" in the same page to write the "instanceId" that I would like to put in the param "instanceId" of the taskflow "processInstanceDetailTaskflow".
    With a ManagedBean I managed the "instanceId" with: #{pageFlowScope.MyBean.idInstance} in the value of the inputText and in the param instanceId of the taskflow (in the taskflow in the pagedefinition I included refresh=ifNeeded)

    I deploy my application, and I have these errors:

    Caused by: oracle.mds.core.MetadataNotFoundException: MDS-00013: no se han encontrado los metadatos para el objeto de metadatos "/META-INF/adf-config.xml"
    at oracle.mds.core.MetadataObject.getBaseMO(MetadataObject.java:1331)
    at oracle.mds.core.MDSSession.getBaseMO(MDSSession.java:3200)
    at oracle.mds.core.MDSSession.getMetadataObject(MDSSession.java:1190)
    at oracle.adf.share.jndi.MDSBackingStore.getMetadataObject(MDSBackingStore.java:395)
    at oracle.adf.share.jndi.MDSBackingStore.obtainMetadataObject(MDSBackingStore.java:516)
    ... 43 more
    ADFc: /WEB-INF/adfc-config.xml:
    ADFc: Se ha detectado una definiciĆ³n de bean gestionado duplicada para 'ImagenBean'.


    Attempt to validate an already invalid RegionSite:
    <_handleException> ADF_FACES-60098:El ciclo de vida de Faces recibe excepciones no tratadas en la fase RENDER_RESPONSE 6
    java.lang.IllegalStateException: Attempt to validate an already invalid RegionSite:

    The error shows that the region of the taskflow seems not valid.

    Can you help me?

    Thak you very much.

    Greetings.
    Raquel.

    ReplyDelete
  15. Hi Romel Pino,

    I hope you are doing great. We are developing custom inbox to display in webcenter portal. We are able to integrate and able to see the bpm inbox in portal. We wanted to display the task details in the next ppage instead of displaying inline (in second panel splitter ) or as modal dialog. Please suggest is there is any way to display task details page in another page .

    Regards
    Babu

    ReplyDelete
  16. Pino,
    Thanks for your blog post.
    I used this technique and integrated audit trail in my application in 11.1.1.6 version. Everything was fine.
    Recently we upgraded to 11.1.1.7. (I replaced 11.1.1.6 jars with 11.1.1.7 jars.)
    But audit trail functionality broke.

    I'm getting the following exception....
    Can't find bundle for base name oracle.bpm.workspace.resource.WorkspaceResourceBundle, locale en

    can you help me?

    ReplyDelete