For D2K Programmers that are transitioning towards OA Framework, it is so easy to get confused between EJB and Entity Objects. I do not wish to confuse you further, hence I will not touch the word EJB here. Lets see how Entity Objects fit into D2K world.
So what exactly is OA Framework Entity Object similar to in our D2K model?
There is nothing in d2k that fully corresponds to Entity Objects. But there are certain areas where analogy can be drawn(well to an extent).
|WHEN-VALIDATE-ITEM in D2K||setItemAttribute() in Entity Object|
|Ideally does not set a item value, simply validates ||Sets the value of the field that corresponds to the column. But we can also add field level validations in this method|
|Can fire immediately after navigating out of the field(assuming it was changed) ||Unless we implement PPR [partial page rendering]around that field, this will fire at page level by default. |
|Restricted trigger, but can indirectly influence navigation by setting enable off, or by setting navigation property of other items. ||No relationship to UserInterface, as controller manages the User Interface |
OA Framework Extension Tip:- If you wish to implement additional validation for an existing OA Framework screen, then you will extend the method setItemAttribute of Entity Object.
|WHEN-CREATE-RECORD in D2K||create() in Entity Object|
|As soon as a new record is created, values can be defaulted to fields via this trigger. ||Defaults values for the fields|
OA Framework Extension Tip:- If you wish to default values to a field in existing OA Framework screen, then you will override extend the method create() of Entity Object.
|WHEN-VALIDATE-RECORD in D2K||validateEntity() in Entity Object|
|Used to cross validating values in multiple fields for a record. This trigger fires as soon as you navigate out of a record[if any of its fields have been changed]||Ditto in OA Framework. For example if you wish to ensure that every CLERK must have a supervisorId attached, then write similar to below|
protected void validateEntity()
if(xxGetSupervisrId() == null
throw new OAAttrValException...
OA Framework Extension Tip :- If you wish to cross validate fields in a standard OA Framework screen, then you will extend validateEntity()
|PRE-COMMIT in D2K||postChanges() in Entity Object |
|Fires before Form issues a commit||This isn't exactly similar to the listed D2K counterpart, but comes close to it. Here you can assign values to Entity Attribute at the very last moment, prior to changes are posted.|
public void postChanges(TransactionEvent transactionevent)
Number docSeqNum = calculateDocSeqNum();
OA Framework Extension Tip :- If you wish to set any attribute with a sequence value, without loosing its sequence, then override this method.
Lets touch base on some other similarities & dis-similarities between D2K and Entity Objects in Framework
Buffering of records
In D2K Oracle Forms, a multi record block buffers the record data for each record. Oracle form provides no handle to that data. The only way you can access value of a field in other record is by navigating to that record[alternately maintain a record set]. However, in case of Entity Objects, you can iterate through the rows in the Entity cache.
You can get a handle to iterator using which you can programatically scroll through the records in that buffer. Framework maintains a cache for records being inserted/modified into EO via VO.
If the entity object that you are extending already extends OAPlsqlEntityImpl, then you can do custom operations before or after Oracle screen makes API calls. Your customization will fire before or after depending upon when you call super.insertRow().
I hope this article gives you an idea for moving from D2K Forms towards Entity Objects in OA Framework.
We havent't yet discussed entityExpert, which I will do in a latter article.