1 28 package net.sf.jasperreports.engine.data; 29 30 import java.util.Iterator ; 31 32 import net.sf.jasperreports.engine.JRException; 33 import net.sf.jasperreports.engine.JRRewindableDataSource; 34 import net.sf.jasperreports.engine.query.JRHibernateQueryExecuter; 35 36 42 public class JRHibernateIterateDataSource extends JRHibernateAbstractDataSource implements JRRewindableDataSource 43 { 44 private Iterator iterator; 45 46 public JRHibernateIterateDataSource(JRHibernateQueryExecuter queryExecuter, boolean useFieldDescription) 47 { 48 super(queryExecuter, useFieldDescription, false); 49 50 moveFirst(); 51 } 52 53 public boolean next() throws JRException 54 { 55 if (iterator != null && iterator.hasNext()) 56 { 57 setCurrentRowValue(iterator.next()); 58 return true; 59 } 60 61 return false; 62 } 63 64 public void moveFirst() 65 { 66 iterator = queryExecuter.iterate(); 67 } 68 } 69 | Popular Tags |