Friday, August 27, 2010

Bounded Task Flow In Popup and Resetting Field data in Popup using popupFetchListener

In my older post (Insert Into Multiple Tables using Bounded TaskFlow in ADF ) the use case I had shown is having a drawback like data from table got automatically populated (as Shown Below) as user navigates to the bounded taskflow region from main page for creating a new Employee. In this blog I am trying to make some modification in my ViewController project so that the issue got resolved.

Step1: Create a Bounded task flow and make sure that 'Create Train' is selected.

Step 2: Drag View from Component palate and rename it likes below. Please follow my previous post (Insert Into Multiple Tables using Bounded TaskFlow in ADF and refer Figure 2 to Figure 6 ) to create those pages. Make sure those page extension should be *.jsff instead of *.jspx.

Add train Button and Train Button Bar for all pages in Task Flow like below

After completing all jsff pages bounded task flow will look like below.

Add valid name for all View id in Task Flow document source (task-flow-definition.xml)

Step 3: Modify Employee.jspx page

In my previous post (Insert Into Multiple Tables using Bounded TaskFlow in ADF) we have used Command Links for creating Employees Please refer to Figure 1 for this post. Now we can make it more fancy by using images and user can click on it to navigate to taskflows.

I have used images like for (AddProfile.PNG) Adding Employee, for searching Employee, for editing Employee

We can use popupFetchListener and attach it to our managed Bean using a method so that the method will execute at the time the popup rendered

  1. public void fetchPopupListener( PopupFetchEvent popupFetchEvent) {
  2. System.out. println ("In Fetch PopUP Listener"); //Create Insert For Baisc Info
  3. BindingContainer bindingsbasic = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
  4. OperationBinding operationBindingbasic = bindingsbasic. getOperationBinding ("CreateInsertBasic");
  5. Object resultbasic = operationBindingbasic. execute() ; //Create Insert For Contact Info
  6. BindingContainer bindingscontact = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
  7. OperationBinding operationBindingcontact = bindingscontact. getOperationBinding ("CreateInsertContact");
  8. Object resultcontact = operationBindingcontact. execute() ; //Create Insert For Master Info
  9. BindingContainer bindingsmaster = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
  10. OperationBinding operationBindingmaster = bindingsmaster. getOperationBinding ("CreateInsertMaster");
  11. Object resultmaster = operationBindingmaster. execute() ; //Create Insert For Baisc Info
  12. BindingContainer bindingsedu = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
  13. OperationBinding operationBindingedu = bindingsedu. getOperationBinding ("CreateInsertEducation");
  14. Object resultedu = operationBindingedu. execute() ; //Create Insert For Job Info
  15. BindingContainer bindingsjob = BindingContext . getCurrent() . getCurrentBindingsEntry() ;
  16. OperationBinding operationBindingjob = bindingsjob. getOperationBinding ("CreateInsertJob");
  17. Object resultjob = operationBindingjob. execute() ;
  18. }

But Make sure that you are having below bindings created in

Drag newly created task-flow-definition to the dialog and it will display the dialog below

We can test the page and it comes like this

Sunday, August 15, 2010

ADF tree navigation to third level and Workaround for “ADF Tree Not Inside Container”

Step 1: Create view object based on Product table. Structure of this table is shown in Figure 1.

Figure: 1

Create view object "CategoryViewObj" based upon below query on above product table.

Figure: 2

Create view object "ProducerViewObj" based upon below query on above product table.

Figure: 3

Create view object "ProductViewObj" based upon below query on above product table.

Figure: 4

Step 2: Create view link between CategoryViewObj and ProducerViewObj using CategoryId and ProducerViewObj and ProductViewObj using ProducerCode

Figure: 5

Figure: 6

Step 3: Wrap all ViewObjects and ViewLinks in application module like below.

Drag "CategoryViewObj" under ProductAppModule and named it CategoryViewInstance. Drag the viewlink immediate below it and put it under CategoryViewInstance and renamed it to "ProducerInstance" and drag the view link immediate below of "ProducerViewObj" and put it under "ProducerInstance".

Figure: 7

Step 4: Create ADF tree table by dragging "CategoryViewInstance" from data control palate and add its two level of children by clicking green add button adjacent to it. We can select our own display attributes for each level like below.

Figure: 8

Figure: 9

Figure: 10

Modify nodestamp facet under ADF treetable component like below.

Figure: 11

Add columns like below

Figure: 12

While testing the page we face this error.

<RegistrationConfigurator><handleError> Server Exception during PPR, #1
java.lang.IllegalStateException: ADFv: Not inside a container.
at oracle.adfinternal.view.faces.model.binding.FacesCtrlHierBinding$FacesModel.exitContainer( at oracle.adfinternal.view.faces.model.FlattenedTreeCollectionModel.getRowIndex(

This will come because we did not set any key attribute in our view objects and ADF tree table is not able to find row index. So we need to set key attributes to our view objects like below.

Figure: 13

Figure: 14

Figure: 15

While testing we get our desired output.