3 import mir.storage.*;
\r
6 public class EntityBrowser {
\r
8 private StorageObject storage;
\r
9 private String whereClause;
\r
10 private String orderByClause;
\r
11 private int batchSize;
\r
12 private int position=0;
\r
14 private EntityList currentBatch;
\r
16 public EntityBrowser(StorageObject aStorage,
\r
17 String aWhereClause, String anOrderByClause,
\r
18 int aBatchSize) throws StorageObjectException {
\r
21 whereClause=aWhereClause;
\r
22 orderByClause=anOrderByClause;
\r
23 batchSize=aBatchSize;
\r
28 private void rewind() throws StorageObjectException {
\r
29 currentBatch = storage.selectByWhereClause(whereClause, orderByClause,
\r
35 private void readNextBatch() throws StorageObjectException {
\r
36 if (currentBatch.hasNextBatch()) {
\r
37 currentBatch = storage.selectByWhereClause(whereClause, orderByClause,
\r
38 currentBatch.getNextBatch(), batchSize);
\r
43 public boolean hasNext() throws StorageObjectException {
\r
44 if (position>=currentBatch.size() && currentBatch.hasNextBatch()) {
\r
48 return (position<currentBatch.size());
\r
51 public Entity next() throws StorageObjectException {
\r
53 Entity result = currentBatch.elementAt(position);
\r
54 position=position+1;
\r