ADF Save Point Restore activity

Using ADF save point restore activity, we can create multiple save points throughout the fusion web application and restore the application to a particular save point instance later time. When a save point gets created, ADF  copies a snapshot of the application instance  into a database table or in a Java cache object. ADF requires a unique ID to create a SavePoint and uses the same ID to restore the Savepoint.

In this section, we have created a sample ADF application that explains this functionality.Download the project from SavePointApp.

IDE Used

JDeveloper 12.2.1

Database Used:

HR Schema

ADF save point restore example:

1. Create an ADF Fusion Web Application: Open JDeveloper, Click File, New, Gallery, ADF Fusion Web Application

2. It creates a Model and ViewController projects. Create an Entity and View object of Employee table. Click here for instruction to creating EO and VO object of Employee table

3. Create a bounded Task Flow: Expand the View Controller>> WEB-INF, Right click>> Click New>> Select ADF Task Flow (Enable the check-box ‘Create as Bounded Task Flow’)

4. Drop a View activity, Method Call activity, and ADF Save Point Restore activity from component window to the bounded task flow. We used the Method Call activity to create a save point and Save Point Restore activity to restore the save point

071116_0356_ADFSavePoin1 ADF Save Point Restore activity

5. Using the control flow case, create a navigation between the activities like below

071116_0356_ADFSavePoin2 ADF Save Point Restore activity

5. Now we need an ID to create and restore save point. We can use the task flow parameter to create  ID attribute. Click the Overview tab of the bounded task flow, Click the parameter tab. Using the green plus icon, create a parameter as shown below. Copy the Value attribute, It is the ID for the save point & restore

071116_0356_ADFSavePoin3 ADF Save Point Restore activity

5. Click on the Diagram tab of the bounded task flow, Right click on the Save Point and click go to property. In the property tab, select Parameters tab and paste the ID (parameter value) we just created

071116_0356_ADFSavePoin4 ADF Save Point Restore activity

6. Click on the General tab and do the following steps

A) Click on the Method Field, go to expression builder >> Choose All in the variables >> Expand ADF Controller Objects>> SavePointManager>> Select CreateSavePoint

B) In the Fixed Outcome Field, Choose the FinishSavePoint from the dropdown

071116_0356_ADFSavePoin5 ADF Save Point Restore activity

7. Right click on the savePointRestore activity and click Go to Property. In the property, window paste  the ID (parameter value) in the Save Point ID field

071116_0356_ADFSavePoin6 ADF Save Point Restore activity

8. Double click on the view activity in the bounded task flow to create a JSFF page

9. Drop the employee table from Data Controls to the JSFF page; Create an editable table from it

Using the command button from the component window create two buttons below the table. Name it as Create Save Point and Restore Save Point

071116_0356_ADFSavePoin7 ADF Save Point Restore activity

10. Right click on the button Create Save Point and go to properties, Choose CreateSaevPoint from application action.

071116_0356_ADFSavePoin8 ADF Save Point Restore activity

11. Right click on the button Restore Save Point and click go to properties. Choose the Application Action to ‘RestoreSavePoint.’

071116_0356_ADFSavePoin9 ADF Save Point Restore activity

12. Expand the Application Resources >> Description >> ADF META-INF.

Open the adf-config.xml. Click on the controller tab. Choose the data source and enable the checkbox in the SavePoints

071116_0356_ADFSavePoin10 ADF Save Point Restore activity

13. Create a JSF page (index.jsf) and drop the bounded task flow as a region component.

Deploy and Run the application

Deploy the application to the WebLogic server. The table opens in the browser as like below . Click the button ‘Create Save Point.’

071116_0356_ADFSavePoin11 ADF Save Point Restore activity

When the Create Save Point button is clicked. ADF creates a snapshot of the web application instance and inserts a record in PS_TXN table as a blob object. The PS_TXN table is created under the data source we mentioned in the adf-config.xml file

071116_0356_ADFSavePoin12 ADF Save Point Restore activity

Now make changes to the table. I have edited the FIrstname from  Lex to LexWIller , now onwards whatever changed occur in the application can be restorable

After some changes made to the table, click the button Restore Save Point

071116_0356_ADFSavePoin13 ADF Save Point Restore activity

The application now goes back to the place when the save point was created. If you see below the Lexwiller changed back to Lex again

071116_0356_ADFSavePoin14 ADF Save Point Restore activity

 

That’s all adf save point restore. 

govindan ADF Save Point Restore activity
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
govindan ADF Save Point Restore activity
Connect me
Like us on Facebook.
Connect!