Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Data Control. Show all posts
Showing posts with label Data Control. Show all posts

Friday 12 May 2017

Understanding Nested Application Modules in Oracle ADF


Application Module acts as a container for view Object and view Link business components that are used in a specific task. It provides data model and data control to show required information and perform action for the client
An application module represents a single transaction and owns one database connection that's why commit and rollback works for all view Objects inside an application module

Tuesday 9 May 2017

Check for dirty (Uncommitted) data of current view port (page) on a button click or any event in ADF


Sometimes we need to check for uncommitted data on page and perform actions according to that, Suppose there is a button to navigate to another page but only if there is no uncommitted data in current page
We can use uncommitted data warning property of af:document to show an alert dialog but in that way, we can't execute our custom logic

Previously I have posted about checking dirty data of a transactional data control but in that, we need to check that for each data control separately that is rendering on page

Monday 16 December 2013

Checking Transaction Status of DataControl for Dirty/Modified transaction in ADF


Sometimes we need to check status of data control's transaction, when we have any form or table on page ,initially transaction is not dirty (it means there is no pending changes in binding layer)

If user changes any data set on page that is populated from ADF binding layer, status of transaction is modified as now there is pending changes on page .


When user perform commit or rollback operation then again transaction status changes.

So it is necessary to have basic understanding of Transaction Status and using this we can write some better piece of codes.
Example- suppose we have a save button in our Application that performs commit operation, when user clicks on that button, every time commit gets executed but logically if there is no change in binding layer then commit must not be executed.
So we can check transaction status on this button and if there is any pending changes in ADFm binding layer or transaction is dirty only then commit will be executed

  • I have created a sample application to check this , there is departments and location ViewObjects are on page and a button to check transaction status
  • Code to check transaction status-

  • public BindingContainer getBindings(){
            return BindingContext.getCurrent().getCurrentBindingsEntry();
        }
    
    DCBindingContainer dcbind =(DCBindingContainer)getBindings();
    dcbind.getDataControl().isTransactionModified()
    

    OR



    amObject.getDBTransaction().isDirty()
    

  • Initially see page status there is no pending changes so transaction is not dirty


  • Now i have changed DepartmentName attribute , then clicked on Check Transaction button


  • Now when data is committed again status got changed

Tuesday 14 May 2013

Using Contextual Event in Oracle ADF (Region Communication)

Contextual event ,in simple terms is a way to communicate between taskflows.
Sometimes we have taskflow open in a region and have to get some values from that taskflow .
This scenario can be achieved by contextual event.

 
Contextual Event have two parts-
  1. Publisher Event (Producer)- As button or any component that can raise event 
  2. Handler Event (Customer)- that listens and process event published by producer
This tutorial is based on example developed on default HR schema of Oracle DB 11g
I have created two application and called first one in secod application as region.
  • Create first application using Department table of HR schema and drag Department Name on page fragment, now create publisher event (follow steps) for Department Name .
  • Select Department Name field in structure window and go to property Inspector select ContextualEvent
    click on green add icon and select event type and name for publisher event

  • Select field value from Iterator Binding
  • here you are done with publisher event or producer create a jar of this application in order to use it in second application.
  • Now start Second Application that will handle and process this event, create a page and put an output text and set its value from managed bean


  • Now create a event handler class to process published event and to make it available to page binding level , we have to create DataControl for this class.





  • Right click on event class and Click on CreateDataControl.
  • Now add this method binding to page so that it can be accessible from page binding
  • Now drag and drop taskflow from jar library on page as region by this published event will also be available to page
  • Now go to page binding and goto ContextualEvents tab ,click on subscribers tab and click on add icon this will open a popup window ,click on search button , it will show available publisher event, now select event and goto handler search option and select function that you have previously added in page binding
  • Give consumer parameter name same as event handler function

Now Run your Application - Download ADF Sample Application