I got interesting comment for my previous blog post - ADF Regions and Nested Application Modules to Improve Performance. Nicolas is asking, how he can reuse ViewController layer and still keep open database connections at minimum level. I was describing how we can implement nested Application Modules for ADF BC libraries, however it was only ADF BC Model reusability. Today I will show, how we can develop reusable ViewController and still use nested Application Modules.
You can download complete set of sample applications for this scenario - IntegrationDashboard.zip.
The main idea of this example - we split each reusable application into two parts (Model and ViewController). This allows us to group reusable ADF BC Model applications into one central master Application Module and create nested Application Module group. This will allow to minimize opened database connections and still we will be able to use separate Data Controls for ADF Regions in ViewController.
Sample package contains four libraries (two applications) - ADF BC Model and ViewController implementations. There is separate library for central nested Application Module as well:
There is Model part for Employees use case - one separate application:
There is Model part for Jobs use case - one separate application:
There is application with single Application Module - this module will nest Application Modules from reusable Model libraries and will expose them to ViewController applications:
If you open NestedModule project properties, you can see two ADF Libraries with ADF BC are imported:
Two Application Module instances from Jobs and Employees Model libraries are declared under the nested group:
We have completely separate application to implement ViewController functionality for Employees use case. This application imports ADF Library with nested Application Module, you can see this from Data Control:
ADF Library with nested Application Module is declared under project properties. You should pay attention, its only one single library imported:
Same thing for Jobs use case - Data Control from nested Application Module ADF Library is imported:
Only nested Application Module ADF Library is added:
Finally we have main application, it will include ViewController libraries and bring ADF Task Flows through ADF Regions to the user:
Main application includes only ADF Libraries with ViewController functionality:
Let's see how it works. Both use cases - Employees and Jobs are rendered through ADF Regions in a dashboard:
If you would consume these ADF Regions from ADF Libraries with separate Application Modules, two database connections would be opened. However, in our case - because we are using central nested Application Module, only one database connection is opened:
Now we test how transaction will work. LastName and JobTitle fields are modified from both ADF Regions. Save button is pressed from Employees region:
Employees modified data was saved, what about Jobs? We press Undo for Jobs:
Jobs changes are reverted back:
Employees changes are not reverted back, because changed were saved:
This means we can use nested Application Module to minimize opened database connections, same time database transaction is not shared across nested group, when we are using ADF Region in ViewController.
Andrejus,
ReplyDeleteThanks you very much for this great post.
It will definitely help me a lot.
Best Regards
Nicolas Pilot
JDev 11g R2 seems is not able to get AM Data Control from imported ADF library (Following error occurred for Iterator “” Error : null).
ReplyDeleteYou would need to create local AM and extend it from that AM coming from ADF library:
Workaround:
1. Go to EmployeesViewControllerApp application.
2. Remove ADF Model Jar from View Controller
3. Add same ADF Model Jar into Model project
4. Create new Application Model inside Model and make it extended from that Application Module that comes from ADF Model Jar
5. Change DataBindings and Page Defs to point to right AM
Andrejus
JDev 11g R2 issue with imported AM's is JDev IDE bug, not ADF runtime bug.
ReplyDeleteOn runtime, it works as expected. Only JDev IDE is not able to pick up AM from imported library.
Andrejus
Great post but I have 3 questions
ReplyDelete1.
in PortalApp
After I have imported the two jars (adflibEmployeesViewControllerApp.jar,adflibJobsViewControllerApp.jar)
to my application manually from Libraries and ClassPath
How can I get the task flows to add them to the main.jspx in adfc-config.
can you explain.
2.
and I want to know If I want to deploy this application is there any configuration that I have to take care about before I start building something like this.
3.
I have ADF fusion web application
consist of model and viewController
and I want to export all this application like a jar to use it in another application is this possible
and how can I make this.
many thanks for the great post
Hello Andrejus,
ReplyDeleteA crutial point is described in this post, thank you.
I have a production application devided into several modules, each containing own Model and a taskflow to be used in a main application. The modules are developed separately.
At the moment each module holds its own connection and it's really not the way I want it to work.
But the described way is quite tedious. I need to break each working application into two parts and perform some magic, importing ADF Libs here and there. JobsModule datacontrol available in Emp applicatio also seems wierd.
And IDE bug wouldn't let me work normally?
Is this the way real production applications are developed?
Is there any less painful way to archieve this now (JDev 11.1.2.1)?
Thanks.
hi Andrejus
ReplyDeletegood article
in my case , EO separated in another common Model project and imported as JAR to every am (jobsModuleApps) in your example
can you give me suggestion about right architecture in my case
Hi Andrejus,
ReplyDeleteI have downloaded your sample application, now when I change in both emp region and job region and click on save of job region.Emp changes are also getting saved.Is there any option available to avoid that.