Saturday, 5 January 2013

Making a MDI Application by using the MultiTaskFlow

Multiple Document Interface (MDI) is an application style you can use to open multiple windows (called sheets/tabs) in a single window and move among the sheets. It is a most common thing and used desktop applications. Now we can achieve same by using multi task-flow concept of ADF and customize as per our business requirement.

In ADF Application, we can achieve by using multi task-flow concept and making the Java class with Collections to handle the multiple sheet adding, removing, selection and closing. Please follow the below steps,

  • Create a Java Class of MDI.java & Sheet.java and use the property by using the Collection with wrapper of TaskFlowBindingAttributes and Sheet classes.


  • Create a Page by using the ADF Page Template and include a af:panelTabbed with af:showDetailItem dynamically by using the af:forEach looping.


  • Create a PageDef for Template and include a ‘multiTaskFlow’ tag under the <executables>



  • Include a <definitionFactories> for TaskFlowBindingDefFactoryImpl under the DataBindings.cpx file.



For more details check with sample.

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R2 Update 3 + HR Schema]


How to run this sample?
  1. Create Data Source of ‘HrDS’ under Weblogic Server.
  2. Open an Application and deploy jar for MDIApplication & HrModel projects.
  3. Expand a HrUI and run using the Run.jspx.

Friday, 4 January 2013

Generic way of Data Passing between UI Layer and Model Layer


Requirement is used to access the User Login HTTP Session Data from UI Layer to Model Layer for doing some Business Validation like checking the user is Already logged in or not, Passing the Login Date as default for all ViewObjects and etc.,.

In general, if want to pass the data from UI Layer to Model Layer then need to use the 'Action' bindings. From 'Action' bindings we need to pass the data and store it in AM, from that can access across the View Objects for the business requirements. If we are doing in this way then need to add the action bindings entry in each pageDef files. In case it is Task-flow with Begin New transactions then each task-flow will has its own transaction and it has many pageDef then need to take care all places.

For avoiding all, If we are using the DataControlFactoryImpl then no need of any pageDef entry. Only one included entry on the BC4JDataControl tag of DataBindings.cpx itself enough.

Need to follow the below steps for achieve the Generic way of Data Passing,

  • Need to create custom class by extends DataControlFactoryImpl and override the method of getDataControlClassName() and need to return the class name of custom class by extends JUApplication.


  • Need to create custom class by extends JUApplication and override the method of beginRequest() and write a logic of passes all the session scoped attributes to the underlying Application Module.


  • Open the DataBindings.cpx file and added the entry against the property of ‘FactoryClass’ underlying the tag BC4JDataControl


For more details check with sample.

[Runs with Oracle JDeveloper 11g R2 Update 3 + HR Schema]

How to run this sample?
Run using the Run.jsf and check the Generic Data Passing by followed a below steps,
  1. In Main Page click the Store on session button and see the console (it shows the actual value stored in the session with Key/Value pair).
  2. Press the ‘Employee’ Button then it will load an Employee Page. At the time of loading it will pass the UI Layer data into Model Layer via CustomDataControlFactoryImpl
  3. Now click the ‘Print UI Session Data’ Button and see the console, it will print the actual UI Layer Data into Model Layer