2 Replies Latest reply on Jul 1, 2011 6:51 AM by Jan Vervecken

    currently active task-flow in a dynamic region using EL

    Jan Vervecken
      hi

      Please consider the blog post by Luc Bors, "ADF 11g : What is the Currently Active Taskflow in a Dynamic Region ? "
      at http://technology.amis.nl/blog/12156/adf-11g-what-is-the-currently-active-taskflow-in-a-dynamic-region-2

      At some point it suggests the use of a class in an "internal package ", oracle.adf.controller.internal.binding.DCTaskFlowBinding,
      but also including a reference to a blog post from , ""Internal Package Import" errors and how to switch them off "
      at http://blogs.oracle.com/jdevotnharvest/entry/internal_package_import_errors_and_how_to_switch_them_off
      that asks "What should you do if you need to use internal classes in your current application?"
      and suggests "If you don't find a solution, use Expression language ..."

      For the sample workspace ADF-dynamicRegions.zip provided in the blog post by Luc Bors, re-implementing the getCurrent() method using an ELHelper class seems to keep things working the same way, but without a dependency on the (internal) DCTaskFlowBinding class.
           public String getCurrent()
           {
                TaskFlowId vTaskFlowId = (TaskFlowId)ELHelper.get("#{bindings.dynamicRegion1.taskFlowId}");
                System.out.println("regionMananager.getCurrent() : vTaskFlowId = " + vTaskFlowId);
                return vTaskFlowId.getFullyQualifiedName();
           }
      As the blog post starts with "There are use cases in which you need to determine what the currently active taskflow is. ", I wonder ...

      - (q1) What would be a really good use-case that requires DCTaskFlowBinding.getTaskFlowId() ?
      - (q2) Has an enhancement request been filed to create a public API for DCTaskFlowBinding.getTaskFlowId()? If so which is the bug/ER number?

      note : sometimes requests for a public API get picked-up, see e.g. forum thread "internal package import for ActiveDataEventUtil : which public API to use"

      regards
      Jan Vervecken
        • 1. Re: currently active task-flow in a dynamic region using EL
          Timo Hahn
          I can answer (q2)
          Also note Frank Nimphius has raised ER 10198616 to request a public API for the internal ADF libraries used in this solution.
          from Chris Muirs blog http://one-size-doesnt-fit-all.blogspot.com/2010/10/jdev-programmatically-capturing-task.html


          Timo
          • 2. Re: currently active task-flow in a dynamic region using EL
            Jan Vervecken
            Thanks for your reply Timo.
            Timo Hahn wrote:
            I can answer (q2)
            Also note Frank Nimphius has raised ER 10198616 to request a public API for the internal ADF libraries used in this solution.
            from Chris Muirs blog http://one-size-doesnt-fit-all.blogspot.com/2010/10/jdev-programmatically-capturing-task.html
            Well Chris' blog post does not seem to mention the class DCTaskFlowBinding, but it does suggest an alternative approach to get the current TaskFlowId.

            Trying to re-implement the getCurrent() method again (in the sample workspace ADF-dynamicRegions.zip provided in the blog post by Luc Bors), like this ...
                 public String getCurrent()
                 {
                      ControllerContext vControllerContext = ControllerContext.getInstance();
                      ViewPortContext vCurrentViewPort = vControllerContext.getCurrentViewPort();
                      TaskFlowContext vTaskFlowContext = vCurrentViewPort.getTaskFlowContext();
                      TaskFlowId vTaskFlowId = vTaskFlowContext.getTaskFlowId();
                      System.out.println("regionMananager.getCurrent() : vTaskFlowId = " + vTaskFlowId);
                      return vTaskFlowId.getFullyQualifiedName();
                 }
            ... does not depend on "internal classes" ...
            import oracle.adf.controller.ControllerContext;
            import oracle.adf.controller.TaskFlowContext;
            import oracle.adf.controller.TaskFlowId;
            import oracle.adf.controller.ViewPortContext;
            ... but doesn't behave as required, because of this NullPointerException ...
            Caused by: java.lang.NullPointerException
                 at nl.amis.technology.view.beans.regionMananager.getCurrent(regionMananager.java:54)
                 at nl.amis.technology.view.beans.regionMananager.tF2(regionMananager.java:58)
                 ...
            In this case "vTaskFlowId" being null.
            Not sure if this approach should work in this case.

            Yes, Chris' blog post does refer to some "internal classes" (in package oracle.adf.controller.internal.metadata ) but when I search for bug 10198616 on http://support.oracle.com I only get "No results found ". I wonder why bug 10198616 has not been (or should not be) published.

            regards
            Jan