Tuesday, May 11, 2010

EntityObject:Creating your own History Attributes

ADF Entity Objects allows a functionality to define History Attributes for the Entity Objects.Such as "CreatedOn","ModfiedOn","CreatedBy","ModifiedBy" etc etc.

For your application, if you want you can introduce/extend these History Attributes from the JDev preference.

Steps To create a custom history type:

From the Tools menu, choose Preferences.
In the Preferences dialog, expand Business Components, and click History Types.
On the History Types page, click New.
In the Create History Type dialog, enter a string value for the name (spaces are allowed) and a numerical Id.
Open the EntityImpl.java file and add a definition for the numerical id such as
private static final byte MYCUSTOM_HISTORY_TYPE = 20;

Override the getHistoryContextForAttribute(AttributeDefImpl attr) method in the EntityImpl base class

protected Object getHistoryContextForAttribute(AttributeDefImpl attr) {
if (attr.getHistoryKind() == MYCUSTOM_HISTORY_TYPE) {
// Custom History type logic goes here
else {
return super.getHistoryContextForAttribute(attr);

1 comment:

Nannie Co Pam said...

Very much useful article. Kindly keep blogging

Java Training in Chennai

Java Online Training India