Sunday, November 24, 2013

Oracle ADF Save Point

Save point captures following informations:
  • User Interface status : Stores UI state 
  • Managed Bean : Stores the state information even in different scopes even session and pageflowscope . Managed bean must be serializable. Request scope not supported.
  • Naviagation state 
  • ADF Model state 

 


To setup save point 

1) Need to define a datasource in the controller 
2) Need to have the table ORADFCSAVPT
3) May need to execute the scripts : 

        Scripts : jdev-install\oracle_common\common\sql
o   Adfc_cleanup_save_point_table.sql
o   Adfc_create_save_point_table.sql

Make the jbo.locking mode optimist.

Use save-point initialize r to invoke application specif code :

There are two types of save points :Implicit and explicit

Explicit Save point

User action required here through a button click to create the save point.Explicit save point can be created to bounded or ubounded task flow 

package view.test;

import java.io.Serializable;

import oracle.adf.controller.ControllerContext;
import oracle.adf.controller.savepoint.SavePointManager;

public class SaveForLater implements Serializable {
    public SaveForLater() {
        super();
    }

    public void saveTaskFlow() {
        ControllerContext cc = ControllerContext.getInstance();
        if (cc != null) {
            SavePointManager mgr = cc.getSavePointManager();
            if (mgr != null) {
                String id = mgr.createSavePoint();
                System.out.println("save point being set " + id);
            }
        }
    }

Implicit Save point 

Implicit save point can create only with the bounded task flow.It occurs automatically with 
- Session Timeout 
- End user logs out without saving data 
- Closes the browser 
- Navigating away from the current application using control flow case

Time to live period for save point 

We can set the time to live period on the save point using setSavePointTimeToLive() method on ControllerContext.getInstance().getSavePointManager().The default value is 86400sec.
Also removeSavePoint() needs to call on even expired save point to remove or we can use the cleanup.sql mentioned above in the post.


No comments:

Post a Comment