Monday, March 1, 2010

Integration in Oracle ADF with ADF Task Flows and Dynamic Regions Pending Changes

From my previous post - Integration in Oracle ADF with ADF Task Flows and Dynamic Regions, you can learn how to integrate separate Oracle ADF applications using dynamic regions. I'm sure, you will want to prevent user navigation from one region to another, when there are unsaved pending changes available. Its pretty simple in ADF 11g, I will describe today.

I have updated sample application from my previous post, download updated archive - ADFIntegrationRegions2.zip.

So, how to prevent user navigation if there are unsaved changes? Key thing - from main application we can see Data Controls of imported applications. Even when main application Model project doesn't contain any ADF BC, still we can see Data Controls from imported ADF libraries:


And that is great, because we can access Data Control and check it for any existing uncommitted data.

I have implemented pending changes check inside Managed Bean, where Dynamic Regions are activated. In case of unsaved data, user is prevented from navigation and forced to stay in current region:


Pending changes are validated simply by accessing Data Control transaction and checking if it is dirty:


If there will be no pending changes, next dynamic region will be opened:


But, if user will type data and without saving will try to open another dynamic region, system will prevent him and inform about unsaved data:


Same rule works with form component:


Update 2011/03/06: Check out updated sample application from Anything About ADF blog - Using Popup to Confront user to Save/Forget Changes.

10 comments:

  1. This is a very interesting approach to build. We are also trying to implement the same approach for its nature of reusability & modularization.

    Since this is a new concept, are there any drawbacks/limitations to this approach?

    ReplyDelete
  2. I'm using this architecture for my projects, it works well. Also, Oracle is using something similar for their Oracle Applications. So far, I didn't noticed specific limitations.

    Only one thing - you should be careful with jazn-data.xml, it should be replicated across your applications.

    Andrejus

    ReplyDelete
  3. Hi. I am trying to port a forms application onto the Oracle ADF. Some of the problems I ve encountered are :
    1.) No idea how to write a code for WHEN NEW FORM INSTANCE in ADF
    2.) No idea how to use a database trigger that assigns a sequence to a primary key column of the table.
    3.) If I add a CreateInsert button and say Commit, the backend triggers dont seem to fire at all. ALso new records are not created. Say there is a column for Moddate where the sysdate is assigned in the backend trigger. The app gives an error saying field has no values.

    Please help me out. Thanks. You could provide me a link with some details if its not of much trouble.

    ReplyDelete
  4. Hi,

    1.) In ADF, you should implement form interaction using ADF Task Flows. You should read about transaction management in ADF Task Flows

    2.) Just use DBSequence type for primary key attribute in Entity Object. It will use DB trigger automatically then.

    3.) You should enable Update After Insert for that specific attribute. You can do this in Entity Object, just double click on attribute - you will see checkbox then under Refresh After group.

    Regards,
    Andrejus

    ReplyDelete
  5. Andrejus,

    With this architecture of only using page fragments we won't be able to use taskflows as dialogs since dialogs should contain jspx only.

    Is there any known workaround for this? We really want to use the capabilities of dialogs as it loosely couples with our pages without writing much code.

    thanks
    maniesh (sid)

    ReplyDelete
  6. Ignore my last comment about taskflow as dialog. My question is no longer valid as it is supported.

    ReplyDelete
  7. is it possible to do "save and continue", "ignore and continue" and "cancel and stay on page"?

    ReplyDelete
  8. Yes, you would need to implement custom dialog.

    Andrejus

    ReplyDelete
  9. Hi, here is a strange problem.
    When a clob data field is read from tables and rendered on the page, later if the user doesn't change anything on the page, the data model layer is marked as dirty.

    The problem is, if that clob field has more than 31744 characters, even you didn't change anything, it will tell you you have uncommitted data. With less than 31744 chars, it works correctly.
    Please help me out!!

    ReplyDelete
  10. Hi Andrejus

    I am not able to download the application .can u please help me.

    ReplyDelete