01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/lib/TKDBResultIterator.java,v 1.6 2001/03/06 14:57:24 alex Exp $
03: *
04: */
05: package com.teamkonzept.lib;
06:
07: //--------------------------------------------------------------------------------//
08: //--------------------------CLASS TKDBResultIterator------------------------------//
09: //--------------------------------------------------------------------------------//
10:
11: public class TKDBResultIterator implements TKListIterator {
12:
13: protected TKListIterator oldIterator;
14: protected String listName;
15: protected TKDBResult result;
16:
17: public TKDBResultIterator(TKDBResult result,
18: TKListIterator oldIterator, String listName) {
19: this .oldIterator = oldIterator;
20: this .listName = listName;
21: this .result = result;
22: }
23:
24: public boolean apply(TKTemplate template, int i, String currListName) {
25: if (currListName.equalsIgnoreCase(listName)) {
26: if (i >= result.size())
27: return false;
28: boolean retVal = TKDBTemplate.prepareTemplate(
29: (TKDBResultRow) result.get(i), template);
30: if (oldIterator != null) {
31: oldIterator.apply(template, i, currListName);
32: }
33: return retVal;
34: } else if (oldIterator != null) {
35: return oldIterator.apply(template, i, currListName);
36: } else {
37: return false;
38: }
39: }
40:
41: }
|