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.