ADF : How ViewObjects (VO) get executed ? View Object Life Cycle

Aman Junaid
2 min readApr 19, 2021

View Objects are essential part of ADF Business Components . These are associated with representation of DataSet.

Photo by Carlos Muza on Unsplash

View Objects contains a Query which when executed returns a set of results in form of rows. Then the view Object convert the rows returned from the query to ADF understandably form i.e. ViewObjectRowImpl form.

So, the question is what happens when a view Object gets a call?

View Object goes through a series of methods before representing a datasets. In other words we can name it View Object LifeCycle .

View Object Life Cycle

When a View Object is called the following methods are executed in the given sequence.

  • At first when the viewObject is first executed the method first called in the ViewObjectImpl is
    executeQueryForCollection(Object qc, Object[] params, int noUserParams)
    This method executes theDatabase Query in the viewObject and then calls the next method.
  • After executeQueryForCollection is executed then method hasNextForCollection(Object qc) is called. This method checks if the collection returned have a row or not. If hasNextForCollection(Object qc) returns true then the next method of the lifeCycle is called which converts the row to ADF understandable form i.e. into ViewObjectRowImpl from.
  • So when method hasNextForCollection returns true then method createRowFromResultSet(Object qc, ResultSet resultSet) is called and this method converts the row into ADF understandable form.
  • This goes on until all the rows are covered and there is no rows left in collection. When there are no rows in the collection then the method hasNextForCollection returns false .
  • Then method setFetchCompleteForCollection(java.lang.Object qc,boolean val) is called and it sets the flag for fetch completion. This indicates that the rows from the collection are fetched.

Here is a diagrammatic representation of ViewObject LifeCycle .

ViewObject Lifecycle

Originally published at https://adfjavacodes.blogspot.com.

--

--