JasperReports - More more of one query

I' ve implemented the interface JRDATASOURCE in this way (the Vector is te result of my query):

package report;

import net.sf.jasperreports.engine.JRDataSource;

import net.sf.jasperreports.engine.JRException;

import net.sf.jasperreports.engine.JRField;

import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import java.util.Iterator;

import java.util.Vector;

class JrVectorDataSource implements JRDataSource {

static Log log = LogFactory.getLog(JrVectorDataSource.class);

private Vector resultset = null;

private Iterator iterator = null;

private Object[] row = null;

private String[] columns = null;

protected JrVectorDataSource(Query_Contenitore contenitore) {

this.resultset = contenitore.getVector();

this.iterator = this.resultset.iterator();

this.columns = contenitore.getColumns_Label();

}

public Object getFieldValue(JRField jrField) throws JRException {

String name = jrField.getName();

int column = getColumn(name);

return row[column];

}

public boolean next() throws JRException {

if (iterator.hasNext()) {

row = (Object[]) iterator.next();

//log.warn("row:"+row[0]);

return true;

}

return false;

}

private int getColumn(String name) {

//log.error("row0:"+row[0]+" column name "+name);

int idx = -1;

for (int i = 0; i < columns.length; i++) {

if (columns.equalsIgnoreCase(name)) {

idx = i;

break;

}

}

if (idx < 0) {

log.error("column name " + name + " not found.");

throw new RuntimeException("column name " + name + " not found.");

}

return idx;

}

}

--

NOW MY PROBLEM IS......That in the method JAsperFillManager.fillReport(JasperReport istance_jasperreport,HashMap istance_hashmap,JRDataSource istance_jrdatasource) I can only pass an istance of JRDataSource an so only one query.

some suggestion ?

I had thought to extend the JAsperFillManager class or to merge the Vectors that are the results of mine queries

[2188 byte] By [NeO_GeOa] at [2007-10-3 6:41:16]
# 1
up !
NeO_GeOa at 2007-7-15 1:30:19 > top of Java-index,Java Essentials,Java Programming...
# 2
I don't suppose the fact that you posted unformatted code and hence turned [ i ] stuff into an italicized mess, makes you think perhaps nobody wants to read that mess?Hmmm, I wonder what that "Code" button is for, you might ask yourself.
warnerjaa at 2007-7-15 1:30:19 > top of Java-index,Java Essentials,Java Programming...