ADF for beginners

Sunday, 10 November 2013

Adding Execute,Upload,Delete action to my Excel using ADF Desktop integeration

Most of our clients are familiar with Excel. So what happens when our ADF communicates with Excel. Yes our ADF can also be used with Excel using ADF Desktop Integration.
This link helped me to have a basic understanding of our interactivity with Excel.

http://docs.oracle.com/cd/E37975_01/web.111240/e16180/interactiv_app.htm#sthref87

In this blog i will be adding upload,execute and Delete as a button which helps my users to upload their data to database,Delete the data,Execute and see the result.

First we will be creating a Fusion web app having Model and View Controller. Right click the view Controller in All Features Tab ----> Client tier -----> ADF Desktop Integration. Click the Excel workbook which creates a workbook.









This workbook will be added in the View Controller and Excel folder.
Before that create a page definition file as shown below.




I have used the employee table to be shown in my Excel. If you double click the Excel which we have created it will ask for the page definition to be added.




Choose the page Definition file it will be appeared on the left side of work book in Bindings tab.
Click the EmployyesView1(tree) and press Insert Binding a table format will be formed in the Excel workbook. In select component click an ADF Table and press ok.

As soon as Insert component dialog appears go to Batch options CommitBatchActionID should be commit.


Similarly we need to change the following properties as shown  below.

Now our table should like as below.

Click the execute action in the Binding and after pressing Insert Binding a popup will be appearing asking for ADF Button and ADF Ribbon Command.

After pressing ADF Button another insert component dialog will appear in that expand Click Action set within that expand Actions if we click the Actions(3) an button will be appearing when we click that Edit Actions dialog is opened. In the Add click the down arrow select component action an extra member is added. From the action of newly added member select download and annotation will be query.

Click ok to close all the dialog. Now the Execute button has been created in my Excel.
Insert a ADF Button from the component Dialog,insert component expand Click Action Set --> Actions--> Edit Action dialog will be open. From Add choose component action in the action field select upload.



Click ok to close the window and upload button has been created.

Select the delete action from binding click insert binding. As we did for Execute action we will providing action set for Delete. In the command action form action we will be selecting DeletFlaggedRows.

Click ok to close the window.
Now Run the Excel sheet. First click the Execute button it will populate the data's in your excel columns.

Right click and insert a new row a changed column will be populated with upper arrow symbol which defines the new row is ready as shown below.

Now insert the date and press upload button the data will be uploaded. Double click the flagged column a dot symbol will be appeared if we click the Delete button the row will get delete from the database.


This can also be achieved via ADF Ribbon command Button.

Saturday, 2 November 2013

Simple adf authorization by passing the parameter in task flows

This is the simple authorization for my jspx pages by passing the parameter to my task flows using adf security.

This demo have been developed using jdeveloper 11.1.1.6.0.

In this demo i will show how to provide adf authentication by using paramter in Task flow.

Create a simple login page and validate the credentials using adf security.
Refer the link for adf security enabled login page

http://docs.oracle.com/cd/E14571_01/web.1111/b31974/adding_security.htm#BABDEICH

I have created 2 users.

=> testuser1 ---> Manager Role
=> testuser2 ---> user Role.

In my adfc-config.xml has welcome.jspx which calls a bounded task flow.

The task flow definition contains EmpDept.jspx in which i have dragged and dropped EmployeeVO as af:form.






In which the salary attribute should be shown for Manager Role users (testuser1 in our case).



i have created a bounded task flow in which i will be residing employees.jspx page. I have passed a parameter for this task flow.

Here am having the variable mode in which i will get the role of my user.

<af:commandButton text="Validate" id="cb2" action="go">
        <af:setPropertyListener from="#{securityContext.userInRole['ManagerApplicationRole']==true}" to="#{pageFlowScope.mode}" type="action"/>
        </af:commandButton>

In my command button i have set property listener which store the users tole to the mode variable.

Set the salary field rendered property #{pageFlowScope.mode}.


Now if we run our page

For testuser1

The welcome.jspx page renders after clicking Validate button the EmpDept.jspx page renders in which we can see Salary attribute in af:form






For testuser2




Now the salary attribute is hidden since the testuser2 doesnt contain ManagerRole.

Note:

This scenario can also be done in better way by passing #{securityContext.userInRole['ManagerApplicationRole']==true} directly to the rendered property of the salary attribute in af:form.
I just tried them passing through parameter and thought to share in blog.