Tuesday, November 9, 2010

Access Security Context object from Model and View Layer

Requirement :- I want to bind the query with current login user id and filter the vo object based on roles.

Following context object is provided by oracle that can be
used on view controller


Following groovy object can be used to get username


Friday, October 8, 2010

Custom ADF Table Filter with Drop Down , Validation and case insensitive

Custom Select One Choice and Validation filter for ADF Table default filter.

Requirement: - I want have drop down in adf table column filter that does not comes out of box with filter table and also, I want validation of adf filter.

Add table filter as Drop down

1.Create simple ADF Fusion project with LocationVO and EO.

2.Create a view object call LocationLOV with following mapping for country id.

3.LocationLov will contain LocId and LocValue as two field

4.Drag and Drop ADF LocationVO as adf readonly table on new jspx file.

5.Open the designed view and go to structure window and expand column of country id

6.Insert blank select one choice in filter in column facet

7.Select table and see VarStatus object in common sub property that will be use to access binding

8.Set the select one choice value to #{vs.filterCriteria.CountryId} , this means we are going to use CountryId as filter criteria for table filter

9.Now we need to populate data in location table filter drop down , so create tree object in page bindings and add LocationLov to page definition. Remember to add location lov to application module.

10.Now go to source of jspx and selectone choice and bind the LocationLov that we added in page definitation to this object.

11.Run the application and we will see drop down in country id filter ,select value in drop down ,however we have to press enter when filtering.

Automatically filter when drop down selected

12.Now when user select drop down and if we want to filter the table immediately then we need to press enter from java script when value change event is fired of select one choice.

13.So insert client listener in select one choice that is present in filter.

14.Also , insert resource inside jspx page

15.Create java script file and change client listener property type=”valuechange” and method to method that we will write in javascript for enter.

16.Write this java script

17.Run the page , when you select the drop down now , you will see table get filtered automatically.

Validation of table filter

18.There is one more requirement where we need to validate adf table filter e.g. when somebody enter text to search location id , we need to prompt user that please enter number.

19.So insert inputtext inside filter tab and change value to #{vs.filterCriteria.LocationId}

20.Insert validator and converted inside inputtext as follow.

21.Run the application and you will see now adf table filter is validating table filter.

To ADF table filter Case Sensitive

22.Set this property filterFeatures="caseInsensitive" in

Thursday, October 7, 2010

TaskFlow as Dialog with return Listener

TaskFlow as Dialog with return Listener

Requirement: - I want to call task flow in dialog box with return listener.

Please continue or read through from here TaskFlow with transaction and return listener.

1.Please go to adf-config.xml file and right click task flow and go to properties
and change the following properties. i.e. set useWindow=true.

2.Also, now task flow will come in dialog when call , but calle need to set the property as below to make things work.i.e. set Behaviour->Run as Dialog=true and DisplayType=inline-popup.

After doing this 2 steps when new button is pressed , it will come in dialog popup and use can save row ,it will automatically return to parent window with new row created. same with update.

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.