This one took me way too long to figure out but the ADF documentation finally revealed that you should declare another iterator and use that iterator to go through the RowSet.
//Iterate Control Tests
DCBindingContainer iteratorBindings =
(DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding myIterator = iteratorBindings.findIteratorBinding(“dataControlBinding”);RowSetIterator rsi = myIterator.getRowSetIterator();
RowSet rowSet = rsi.getRowSet();
RowSetIterator secondaryIterator = rowSet.createRowSetIterator(null);
//Remove all Existing Objects in BPM
if (rsi.getRowCount() == 1) {
System.out.println(“EXECUTING IF EQUALS 1”);
Row oneRow = rsi.getCurrentRow();
oneRow.remove();
}if (rsi.getRowCount() > 1) {
System.out.println(“EXECUTING IF MORE THAN 1”);
Row cycledRow = secondaryIterator.getCurrentRow();rsi.setCurrentRow(cycledRow);
rsi.removeCurrentRow();myIterator.getDataControl().commitTransaction();
while (secondaryIterator.hasNext()) {
System.out.println(“EXECUTING WHILE LOOP”);
System.out.println(“Inside the While Loop for Iterator”);
cycledRow = secondaryIterator.next();
rsi.setCurrentRow(cycledRow);
rsi.removeCurrentRow();
myIterator.getDataControl().commitTransaction();
}
}