Flipkart Search

Sunday, 15 April 2012

Showing User Specific Table data in Adf - Part 1

This is a very normal use case where a user has to see his own data. We usually do it by saving userdata in DB according to some UserId{Like emailId } or some specific number or anything...For this tutorial you should have a table with user specific data....For this example I took Employee table of HR schema .....
There are two methods to do this.....
1. Execute with Params{With Bind Variables}
2. ViewObject Implementation Class
In Part 1. I will how to achieve this goal by Execute with Params{With Bind Variables}...
1. First create a desired VO and Bind a variable to it.{This should be the your userId which can be anything}
2. Now give a where clause to your VO which binds your bind Variable

3. Now create a task-flow{or a jspx page}......I prefer taskflow to ensure re usability...

4. Now add a view to it ..and make sure you select document tpye: JSP XML

5. Now go to datacontrol and expand your employee collection and go to operation section and drag and drop ExecuteWithParams to your page as an ADF parameter Form 
6. Now drag and drop your table on the same jsff page see above..
7. Now go to jsff page Bindings and then go to structure window{left below corner}and you can see Executables . Now right click on Executables->Insert Inside executables->invoke Action. Give any string as id and Binds as ExecuteWithParams . Go to its property and make refresh:always {Note: click on the image below for better visibility}

8. Now again go to binding tab of the jsff page{you must be there already }. See the cursor{Means edit the bindings->ExecuteWithParams

9. Now you will see the dialog as below...go to value -> show El  Expression Builder

10. Now delete the existing text and map it to security context user name...
11. Now you can delete the adf parameter form in the jsff page{So that user can't view it}.. or you can make the adf panel form layout render false which contains the ExecuteWithParams form field and Button

12. Now you have to give a login page to the user so that he can give his user name and password to login and see his data...In adf this is very simple...Go to Application->Secure->Configure ADF security...

Follow the next screens as it is--

13. Now click next-next or finish and open Application Resources->Descriptors->META-INF->jazn-data.xml and add your user and give userId as Name
14. Add an application role and add the existing user to this role...

15. Now go to resource Grants tab then Resource Type->Task Flow and give your task grant to application rule..

16. Now create a blank jspx page and drop adf page flow into it as region
17. Now grant this jspx to the same application role....
18. Now run your application and Enjoy
see the sample..earlier
 And now with ExecuteWithParams

Friday, 6 April 2012

Clean Adf Table filter without Managed Bean

When you have a Adf filterable table then you may have noticed that the text inside the filter don't clear itself when you navigate to other page . It remains there. There are two ways to clear the filters as far as I know.
1. Setting One of the output text column header true
2. A button with managed bean

Adf table's column property RowHeader is set to true then this column renders as a non filterable column with a Clear All icon which clears all filters and reloads the table

1. Setting a Column which is Output Text type to RowHeader=true

2. Earlier look   RowHeader=false
3. Now with  RowHeader=true

Best adf page layout

I have worked on different page layouts and found the below layout Best . Because this layout doesn't depends on screen size of the browser or Monitor. It is stretchable  all across except its top facet.
Here is the screen shot of the said layout...
To create this layout go to ViewController>New>Jsf>page>pagelayout>quickstart layout then
The exact layout is very much dependent on your requirement ...But this layout will help u most because it fixes only top facet ....

Monday, 2 April 2012

Precautions During ADF Fusion WebApplication project

If you are making a ADF webapplication then you must aware about some of the basic problems you can came around.
The most common problem is Screen Resolution. What I mean by screen resolution is that user may be on different screen resolution than your during development screen. An example may clear more:: 
For development you have resolution of 1280*1024 and every thing looks fine but even 1024*768 can ruin your application easily.
This happens usually when you try to fix the size of a stretchable component like table etc.In the following example I didn't set the size of table's width then it can accommodate any screen size because its a stretchable component.See below...
Now what I do is - I fix the size of table and see what happens...

Now see what happens when I decrease the browser's size ...
 Although I have scrolled horizontally till end but I can't see the columns after Salary
So don't try to set the width of  adf table ...