Friday, March 19, 2010

ADF UI Shell: Extending the UI Shell to Allow Passing of Parameters to Bounded Task Flows

I am trying to create a blog-post demonstrating a pattern of having a list, show details, edit, and create activities based on the HR Schema. But upon testing, I was stacked on the issue of parameter passing to bounded task flows of the UI Shell which was discussed on this thread. Since in the previous post, I had just demonstrated how to make minor modification to the layout of the Dynamic Tab Shell template, so I thought that it would be better to consolidate the information and post here the step-by-step guide on how to support parameter passing while the fix is not yet available.

To allow parameter passing to the bounded task flows that will be launched on a separated tab, we need to modify the dynamicTabShellDefinition.xml file in the oracle-page-templates-ext.jar. Below is the step by step procedure to do this:
  1. Copy the oracle-page-templates-ext.jar from %MiddlewareHome%\jdeveloper\adfv\jlib\ folder
  2. Create a new folder in drive C like C:\temp and paste the copied jar.
  3. Extract the contents of the jar.
    1. Open command prompt and navigate to the C:\temp folder.
    2. Enter the following command:
      jar xf oracle-page-templates-ext.jar
          
    3. If the jar command cannot be recognized, then you need to add the java bin folder path into the "Path" system variables. Ex. "C:\Oracle\Middleware\jdk160_14_R27.6.5-32\bin;"
  4. Delete the jar that we have copied into the temp directory. We do this so that we can easily repack a jar later.
  5. In windows explorer, browse the "dynamicTabShellDefinition.xml" file in "C:\temp\oracle\ui\pattern\dynamicShell\model" directory
  6. Right click the file and click "open with...". Open it with JDeveloper.
  7. Modify the parameter definition to as follows:
    <parameters>
        <parameter id="tabContext" value="${viewScope.tabContext}"/>
        <parameter id="parameterMap" value="${requestScope.parameterMap}"/>
    </parameters>
    
  8. Redefine all the taskFlow/region bindings to define the "parametersMap" attribute value to "#{bindings.parameterMap}".
    <taskFlow id="r0"
                  taskFlowId="${viewScope.tabContext.taskflowIds[0]}"
                  activation="deferred"
                  xmlns="http://xmlns.oracle.com/adf/controller/binding"
                  parametersMap="#{bindings.parameterMap}">
          <parameters>
            <parameter id="tabContext" value="${bindings.tabContext}"
                       xmlns="http://xmlns.oracle.com/adfm/uimodel"/>
          </parameters>
    </taskFlow>
    
    You need to do this to all the 15 region definition.
  9. Save your modification.
  10. Repackage the file in a jar. Open a command prompt navigate to the temp folder we created earlier then run the following command:
    jar cfM0 oracle-page-templates.jar *
    
    0 (Zero)
    You can give the jar a different name if you like.
  11. Modify libraries and classpath.
    1. Open your application in JDeveloper.
    2. Right-click your ViewController project and click project properties.
    3. Remove the Oracle Extended Page Templates in the classpath entries.
    4. Add the jar file that we created in the step above.

If you wanted to see a sample test case using the ADF UI Shell that connects to HR Schema, see the following post:
UI Shell in Action

Cheers!

5 comments:

  1. Hi Pino,

    I have used similar approach, but with just one dynamic task flow definition in my page definition with paramMap, when there is a need to switch several task flows dynamically within a single region which have different number of parameters (names, data types).

    You can check my blog at http://tiahbb.blogspot.com

    Regards,
    Tiah

    ReplyDelete
  2. I have read your post but it seems that it is not in any way related to the ADF UI Shell. This post is specific to the Oracle Dynamic Tabs template.

    regards,

    Pino

    ReplyDelete
  3. Update to this post: The new UI Shell with fixes and support for parameter passing has already been released. Check it out through JDeveloper "Check for Updates".

    ReplyDelete
  4. Hi Pino,
    I have a question relating to UI shell but unrelated to the current blog post

    How can I customize the UI shell close tab behaviour? By default, the TabContext does provide the service of checking whether a tab is dirty or not. But I want a layer of abstraction above the tabContext where I could do custom actions while closing a tab. However UI shell doesn't seem to provide a handle on the TAB CLOSE icon. Could you suggest me a direction to head into?

    ReplyDelete
  5. Hi Vinit,

    You are right that the UI Shell does not provide a handle on the TAB CLOSE icon, but you could modify the UI Shell to support it. I suggest that you read this post: http://soadev.blogspot.com/2010/08/loosely-coupled-bounded-task-flows.html

    Regards,
    Pino

    ReplyDelete