الأحد، 5 أبريل 2020

Iterate Over View ObjectIterate Over View Object

Iterate Over View Object-

Sometimes we need to iterate in the table to check for some validation like we have to check for the duplicate record or we want to delete all data of the table with one click then we have to get all rows of table– this is a very common use case in ADF, so you can use the following snippet of code to do this
1. Using AllRowInRange method to get rows available in the range
ViewObject vo=am.getViewObject();

// Get All Rows in range of ViewObject in an Array
Row[] rArray=vo.getAllRowsInRange();

//Loop over array of Rows
for(Row r:rArray){

/*your operation code*/

}
2. Using RowSetIterator-
ViewObject vo = this.getViewObject();

//Create RowSetIterator
RowSetIterator rsi = vo.createRowSetIterator(null);
//Iterate Over this to get all rows
while (rsi.hasNext()) {
Row nextRow = rsi.next();
//Put additional code here
}
rsi.closeRowSetIterator();

Get Value from the task flow parameter(Using pageFlow Scope)-

We can get value from Taskflow parameter using page flow scope and can use it in Our Bean.
Suppose we have defined a parameter in the page to pass Session_Id.
We can get it using pageflow scope
Integer sessionId = Integer.parseInt(resolvEl(“#{pageFlowScope.Session_Id}”));
 Code For resolvEl-
    public String resolvEl(String data) {
        FacesContext fc = FacesContext.getCurrentInstance();
        Application app = fc.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = fc.getELContext();
        ValueExpression valueExp = elFactory.createValueExpression(elContext, data, Object.class);
        String Message = valueExp.getValue(elContext).toString();
        return Message;
    }

ليست هناك تعليقات:

إرسال تعليق

ADF: Programmatic View Object Using Ref Cursor.

ADF: Programmatic View Object Using Ref Cursor. Posted by:  Manish Pandey   April 25, 2013   in  ADF   Leave a comment   3758 Views Sometime...