4 total views, 1 views today
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.
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
5. Using the control flow case, create a navigation between the activities like below
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
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
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
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
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
10. Right click on the button Create Save Point and go to properties, Choose CreateSaevPoint from application action.
11. Right click on the button Restore Save Point and click go to properties. Choose the Application Action to ‘RestoreSavePoint.’
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
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.’
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
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
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
That’s all adf save point restore.
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 🙂
Latest posts by Govind
- JSF Login Logout Form Authentication Example - October 16, 2017
- How to Bookmark URL in JSF using GET method and ViewParam – example - October 14, 2017
- JSF Dynamic Navigation and how to use wildcard in navigation - October 12, 2017