Showing posts with label Parameter Passing. Show all posts
Showing posts with label Parameter Passing. Show all posts

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!