Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to access default row set iterator from Application Module ? (JDev 12.2.1.2)

Mehdi EsteghamatianMay 22 2017 — edited Jul 24 2017

hi All,

I have the below code for a view object shown as af:table. It is supposed to show what rows I have in the table.

I can see data in the table but I can't access them via the below snippet in the application module java class.

What is wrong? Event if we assume that getRowSetIterator gets data from cache (which I really don't what cash is in the class diagram here)

public void updateAssetOwner2(){
RowSetIterator rs = getAstExchangeItemsVO().getRowSetIterator();
System.out.println("Hello there");
rs.reset();
while (rs.hasNext()){
System.out.println("Id: " + rs.getCurrentRow().getAttribute("Id"));
rs.next();
}

}

The rows are created with the below code:

public String addNewEchangeItemRow(Object newExchangeId, String Id, String OwnerId) {
_logger.info("addNewEchangeItemRow start");
DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
ViewObjectImpl astExchangeItemsVO = getAstExchangeItemsVO();         
RowSetIterator rsi = astExchangeItemsVO.findRowSetIterator("AstExchangeItemsVOIterator");
if (rsi == null)
rsi = astExchangeItemsVO.findRowSetIterator(null);
//get handle to the last row
Row lastRow = rsi.last();
//obtain the index of the last row
int lastRowIndex = rsi.getRangeIndexOf(lastRow);
//create a new row
Row newRow = rsi.createRow();
//initialize the row
newRow.setNewRowState(Row.STATUS_INITIALIZED);
// setup new attributes
newRow.setAttribute("AsetId", Id);
newRow.setAttribute("PrsnId", OwnerId);
newRow.setAttribute("Id", newExchangeId);
//add row to last index + 1 so it becomes last in the range set
rsi.insertRowAtRangeIndex(lastRowIndex +1, newRow);
//make row the current row so it is displayed correctly
rsi.setCurrentRow(newRow);                   

_logger.info("addNewEchangeItemRow end");
return null;

}

By the time I call the first snippet, the new rows haven't been committed yet. So, I am curious to find out why I can't access the UI component's data using getRowSetIterator.

Please let me know if you have any clue.

Thanks in advance,

Jake

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 21 2017
Added on May 22 2017
4 comments
790 views