Saturday, August 31, 2013

ADF Task Flow Template Improvements in 12c

There are great improvements in ADF task flow templates in 12c release. We can use ADF task flow template based on other template and what is even more amazing - JDeveloper 12c ADF task flow diagram window displays template contents when editing actual consuming task flow. There is option to substitute activity in the consuming ADF task flow for the generic activity from the template. I'm going to explain how you can do this.

Here is sample application for ADF task flow template in 12c - TaskFlowTemplateApp.zip. This application implements following ADF task flow template:


As you can see template contains generic router activity - it check how task flow should be loaded and if new row should be inserted. There are method calls for Commit and Rollback operations, meaning no need to add Commit and Rollback operations into Page Definition, will be called directly from the task flow. Activity - fragmentView is defined, but not created, we are going to substitute if the real fragment a bit later in the consuming task flow.

There are three page definitions created for activities in the template: create, commit and rollback operations:


We can create our task flow, based on available ADF task flow template:


Here you can see 12c new feature - task flow editor displays contents from the template. This is amazing and very useful feature:


All the activities can be reused from the template. Only page fragment is substituted with the real one, meaning every consuming task flow can have its own fragment. In order to substitute the fragment you need to go to the source code mode and override activity ID from the template (fragmentView in this example) pointing to fragment you want to load in this particular ADF task flow:


Fragment can be created in the same way as in ADF 11g:


Page is loaded and user can commit/rollback through generic activity methods implemented in the ADF task flow template:

7 comments:

  1. Sorry Andrejus, but your sample is not complete : missing the "create" way ...and furhermore your sample doesn't work in the complex enterprise project ...where all task flow template are positioning inside a Common View (to share) without data control.
    Regards, Henry64

    ReplyDelete
  2. This is just a sample, it is not supposed to be complete enterprise, but to give you idea. To provide enterprise solution, you should hire us into your project :)

    Please tell specifically what doesn't work. Sample works in 12c.

    Andrejus

    ReplyDelete
  3. Hi Andrejus,

    I would also like to add, we can override almost every component, not only View.
    I tried this in 12c, and I was able to override all task flow components, except control flows.

    Thanks,
    Cheena Malhotra

    ReplyDelete
  4. Hi Andrejus,

    Is it a way to get rid of warnings such as "Element not completed" in the taskflow template ? It seems that these warnings are generated because the taskflow template do not have any view associated...

    Nice article, but seems like the sample download link is broken.

    Thanks in advance.

    ReplyDelete
  5. You can download all old samples from Google Archive (search by date) - https://code.google.com/archive/p/jdevsamples/downloads. Here is sample for this blog - https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jdevsamples/TaskFlowTemplateApp.zip

    Andrejus

    ReplyDelete
  6. Thanks for the updated download link, notice that in this example there's also a

    Warning(17,36): : XML-24521: (Error) Element not completed: 'view'
    tf-template.xml

    So my guess is that we have to live with these kind of warnings when using taskflow templates.

    CQ

    ReplyDelete