Monday, April 26, 2010

Iterating a View Object using a secondary RowSetIterator

The recommended way to iterate a View Object is via a secondary RowSetIterator returned after calling createRowSetIterator() on the View Object. It is suggested to call reset() on the RowSetIterator before iterating it. This will move the currency to the slot before the first row. Iterate while calling hasNext() to check for next row availability and subsequently by calling next() to get the next row. When done, call closeRowSetIterator() to close the row set iterator. Failure to use a secondary RowSetIterator when directly iterating the View Object, could lead to end user confusion as the row set currency changes affecting the user interface.

Example:

         // in the context of the AppModuleImpl
       RowSetIterator iterator = viewObject.createRowSetIterator(null);

       iterator.reset();
       while (iterator.hasNext()) {
          Row row = iterator.next();
      
          // process the row here
       }

       iterator.closeRowSetIterator();


Context:

Application Module Implementation class
View Object Implementation class

 

 

Duplicate Row

Sunday, April 25, 2010

how to clear form and insert upon submit button

1)       cretae a commit button actionlistener  with the following backing bean clearForm

 

package bean2;

 

import javax.faces.application.FacesMessage;

import javax.faces.context.FacesContext;

import javax.faces.event.ActionEvent;

import oracle.adf.model.BindingContext;

import oracle.binding.BindingContainer;

import oracle.binding.OperationBinding;

import oracle.jbo.uicli.binding.JUCtrlAttrsBinding;

 

 

 

public class bean2 {

    public bean2() {

        super();

    }

    private BindingContainer bindings;

 

    public void clearForm(ActionEvent actionEvent) {

        // Add event code here...

        BindingContainer bindings = getBindings();

        OperationBinding commit;

        commit = bindings.getOperationBinding("Commit"); // for master view object

       

              

        OperationBinding createInsert;

        createInsert= bindings.getOperationBinding("CreateInsert"); // for master view object

 

       

        if(commit != null)  commit.execute();       

        if(createInsert != null)  createInsert.execute();

 

    }

    public BindingContainer getBindings() {

              return (BindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();

          }

        public void setBindings(BindingContainer bindings) {

              this.bindings = bindings;

          }

}

Thursday, April 22, 2010

current date time groovy for ADF

We mostly have created_date or updated_dated column in our data model. The value for these columns is mostly the currentt date (time truncated) or current date and time. To default such values every time you create a row in VO/EO there is excellent support for groovy expressions in ADF.

 

To do so go to your VO/EO .xml file. In overview mode select attributes tab. In that select the attribute you want to default with current system date-time or date. In the value box type one of the below and choose radio as expression.

 

Only date: adf.   currentDate   

Date with Time:  adf.currentDateTime

 

Wednesday, April 21, 2010

Difference between view link and association

In short, View links relates two view objects and associations relates two entity objects. There is no connection between both but view links can be created based on associations or independently without associations.