Wednesday, October 6, 2010

Create/Update Reusable TaskFlow With Transaction and Return Listener

New Row / Update Row using ADF Task Flow Transaction

Requirement: - I want to create reusable New / Update Transaction based Taskflow GUI for Create / Update Employee.

Approach: - I have used the approach of Task Flow that can be called by any page for Create / Update Employee.

Important point about task flow:

There are two type of task flow bounded and unbounded. Unbounded task flow can call bounded task flow; however unbounded task flow cannot be called by another task flow. Also, Bounded task flow can call bounded task flow at any dept.

1. First Create new fusion application



2. Create New Entity/ViewObject for Location Table




3.Create taskflow name AddUpdateLocation.xml and remember to uncheck page fragment.



4.Design the task flow as shown in figure by dropping router component and rename it as AddUpdateRoute , then drop CreateInsert operation and SetCurrentRowWithKey from DataControl pallete from LocationView Object.



5.Go to page binding of SetCurrentRowWitKey and set the rowKey value to #{pageFlowScope.locationKey} that we will pass during update operation to identify the row



6.Drag and Drop view from component pallete to taskflow and extend the control flow as shown in diagram



7.Double click the updateLogPG to create jspx file with backing bean



8.Drag and Drop two task flow return from component pallete on task flow.



9.Rename it as save and return and go to property of it and set End Transaction property as commit and rollback.



10. Also, go to task flow properties and set Transaction property as “Always begin new transaction”



11. After completely the reusable task flow , we need to call it. This is how task flow will look finally.



12. Drag and Drop Location view object from data control as ADF Form on updateLocPG.jspx



13. Drop two button , save and cancel and set the action to save and cancel.



14. Go to adf-config.xml and drop one view and task flow AddUpdateLocation and join it using control flow name addupdateloc



15. Double click listLocation and create listLocation.jspx file with backing bean.



16. Now drop two button new and update on listLocation.jspx



17. Click new button and set the action as addupdateloc , do same for update button and set action to addupdateloc



18. Go to taskflow and right click to properties and set the input parameter inputLocationKey to #{pageFlowScope.locationKey} , so this task flow should receive parameter inputLocationKey from list jspx page and set it to pageflowscope.locationKey because we will us that in route for decision making to route to add or update based on it value. So if it is blank that means there is no row key and it is create record , if it is not blank means it is update record.



19. Click the task flow in adf-config.xml and set the property Input Parameters to inputLocationKey to #{requestScope.currentloc}



20. So we are going to assign value to requestscope.currentloc when new or update button is press.



21. Go to new command button and set the following action listener



22. Similarity , for update do as in screen shot.



23. Also, we need to set the return listener because we have to refresh page when new ,update operation is over.







Run the list page and try new and update operation.

No comments:

Post a Comment