Vous êtes sur la page 1sur 2

Common method in Entity/ViewObject Implementation classes:

Its always recommended to call super.<method> to let ADF do its job,before custo
m code gets executed.Unless one handles logic completely on one's own.
EntityImpl
protected void prepareForDML(int i, TransactionEvent transactionEvent) {
Method calls doDML at the end.
protected void doDML(int i, TransactionEvent transactionEvent) {}
Does the DML operation. This is where everything gets into the DB.All the INSERT
, UPDATE, and DELETE statements run here!
public void beforeCommit(TransactionEvent transactionEvent) {}
Invoked before commit is called. By this time the changes are already present in
the DB.So any logic that needs updated data in the DB can be writtern here.
public void afterCommit(TransactionEvent transactionEvent) {}
Similar to above method.
protected void validateEntity() {}
Call executes the entity level validations defined on the EO.Gets invoked when u
se moves from one row to another.
public void lock() {}
Executes a SELECT FOR UPDATE based on the DML operations, for eg like UPDATE or
DELETE
protected void create(AttributeList attributeList) {}
Apart from declarative defaulting override the method to have custom creation an
d defaulting logic for attributes.
public void remove() {}
Self explanatory
public void postChanges(TransactionEvent transactionEvent) {}
Calls prepareForDML and later doDML to post the changes to DB.Its only after the
method's execution data changes are available in the DB before being committed.
If apps need some PL/SQL or any procedure to be invoked with updated data they
can do it here after super or in doDML as needed.
public boolean isAttributeUpdateable(int i) {}
Returns true if the attribute is updateable. Override the method to define own l
ogic, to whether an attribute is updateable or not apart from default WHILE_NEW,
NEVER or ALWAYS.The super.isAttributeUpdateable returns the declarative setting
.
Eg: Lets say Commision is updateable only when Salary is greater than 5000.This
cannot be declaratively achieved. One can write that logic here.
<PseudoCode>
if(index==COMM)
return this.getSal()!=null && this.getSal().doubleValue()>5000
else
return super.isAttributeUpdateable(index) //Default setting for the rest
protected void setAttributeInternal(int p1, java.lang.Object p2) { }
Triggers attribute level validations. One can see that every attribute setter ha
s setAttributeInternal; It's because of this call the attribute level validation
s get fired.
protected void populateAttribute(int i, Object object) {}
Use it to set attribute value by skipping any attribute level validations. The d
efault setAttribute fires validation after value is set and does not update the
target value if any validation fails.
protected void populateAttributeAsChanged(int i, Object object) {}
Same as above but instructs ADF that the attributes value has changed.
ViewObjectImpl
protected ViewRowImpl createRowFromResultSet(Object object,ResultSet resultSet)
{}
Executed after the VO SQL query runs.Its here the query result set is iterated a

nd each result is split and pushed to respective entity cache.Override to run an


y logic to default attribute values based on PL/SQL functions or any other logic
after query is executed.One can also create SQL derived attributes for simple S
QL procedure or function invocation for an attribute.
public void beforeCommit(TransactionEvent transactionEvent) {}
Invoked before commit is called. By this time the changes are already present in
the DB.So any logic that needs updated data in the DB can be writtern here.
public void afterCommit(TransactionEvent transactionEvent) {}
Similar to above method.
public void postChanges(TransactionEvent transactionEvent) {}
Calls prepareForDML and later doDML to post the changes to DB.Its only after the
method's execution data changes are available in the DB before being committed.
If apps need some PL/SQL or any procedure to be invoked with updated data they
can do it here after super or in doDML as needed.
public boolean isAttributeUpdateable(int i) {}
Same as EO
public RowSet createRowSet(String string) {}
A rowset is a memory representation for the VO rows. One can create a row set to
iterate over rows and access row attributes. ADF has a default rowset and a def
ault rowset iterator. It's always recommended to create one's own rowset and row
set iterator to process rows than manipulating the default rowset. To avoid memo
ry leaks always close rowset and its iterator after processing.
public RowSetIterator createRowSetIterator(String string) {}
Creates a row set iterator. This iterator is created on the default row set. Alw
ays create a custom rowset and create iterator with the custom rowset. To avoid
memory leaks always close rowset and its iterator after processing.
public Row getCurrentRow() {}
The call is primarily routed to default rowset and returns the current selected
row. The default rowset is used for UI row currency (meaning current selected ro
w).
protected void create() {}
Call to create a new row.
public Row createRow() {}
Call to create a new row in the vo.
ViewRowImpl
public void validate() {}
Internally invokes validate for corresponding entities.
protected void setAttributeInternal(int p1, java.lang.Object p2) { }
Same behavior as EO
public boolean isAttributeUpdateable(int i) {}
Same behavior as EO

Vous aimerez peut-être aussi