If you are new to JDeveloper and ADF, then it is recommend to read the book, “Quick Start Guide to Oracle Fusion Development: Oracle JDeveloper and Oracle ADF” http://www.amazon.com/Quick-Start-Oracle-Fusion-Development/dp/0071744282. It covers all of the basic areas of JDeveloper and ADF including the topics discussed below.
While you can define a lot of application logic via JDeveloper/ADF declarative components, most logic that you need to add needs to be coded in Java. This is where AM, VO, and EO implementation classes and managed/backing beans come into play.
Every application has business logic and user interface logic. Web Development in general has fallen into a standard way of developing this logic. By which seperates application objects into four basic layers: Data Services, followed by Model, View, Controller (MVC).
- Data Services: Database, Web Services, XML Data, etc…
- Model: Place for queries, C.R.U.D. operations, and any additional business logic
- View: user interface objects
- Controller: Determines how user interface objects interact with one another.
Especially in an object oriented world that programming has become, separating your application logic and objects and making them reusable is key to a well structured and maintainable application. The MVC application architecture allows you to accomplish such a goal.
Before we talk about what and how you would use java implementation classes of each Model layer object (AM, EO, VO), you need to understand the use and significance behind each object.
Entity Objects (EO) are the source code representation of a database table. This is ultimately the layer that executes the insert, update, and delete commands against the database, however, an entity view object will need to present the EO.
View Objects (VO) are read-only database queries or updatable view objects that represent an EO. All VOs are what are ultimately exposed as data controls in your Application Module – so that you can generate tables, forms, and other data-bound objects in your JSF pages.
Application Module (AM) are what allow the ADF application to expose VOs and any other custom java business logic to a JSF page. For example, so you have a an employees database table, by which you have setup an EO and VO to work with that table. You can add the VO to your AM as a data control, so that you can generate an Employee insert or update form on your JSF pages. Basically Application Modules are the glue that allows your JSF Pages to view data of a view object.
You can generate implementation classes on all three of these objects (EO, VO, and AM). When it comes to implementation classes, AM and VO Implementation classes are used the most often. Keep in mind these are very basic examples, you can do so much more with these classes:
- EO: Unless you need to change how records are literally inserted, updated, or deleted, there is almost no need to use these. Once you start getting familiar with how the EO, VO, and AMs work, you’ll understand.
- ViewObjectImplementation Class: This gives you a comprehensive ability to change how your ViewObject is defined, how it queries an entity object or database, and how it functions in general.
For example, say you want to set a bind variable that is used in your View Object Query. ViewObjectImplementation classes give you the methods to set those bind variables.
- ViewObjectRowImplemtation Class: This gives you the ability to change how the data of your view object attributes are set and retrieved.
For example, say you have a Project Task table where you have a Start Date, End Date, and Task Duration column. You want Task Duration to be (Start Date – End Date). RowImplementation Classes allow you to calculate (Start Date – End Date) and set the Task Duration Column.
- Application Module [Implementation] Class: This gives you comprehensive access to all of the data controls (View Objects) that you added to your AM. In addition, if you need to add any custom business logic, this is the recommended place to “initiate” that logic.
For example, you can write a custom procedure to move data around or do advanced calculations in your Application Module Implementation class and expose them as a Data Control, so that you can use the data control on your JSF pages.
- There are additional classes like “Client Interface” and “Client Class”, however all you need to know about these, is that they allow you to expose custom methods written in your Application Module Implementation class as a data control.
This article was written to quickly address, on the high level, many questions surrounding the use of implementation classes. More in-depth and comprehensive examples will be written in the PITSS knowledge base in the days to come.