Java 类net.sf.jasperreports.engine.JRRewindableDataSource 实例源码

项目:jasperreports    文件:FillDatasetRun.java   
public void rewind() throws JRException
{
    if (dataSource != null)
    {
        if (dataSource instanceof JRRewindableDataSource)
        {
            if (log.isDebugEnabled())
            {
                log.debug("Rewinding the list data source");
            }

            ((JRRewindableDataSource) dataSource).moveFirst();
        }
        else
        {
            log.warn("Cannot rewind list data source as it is not a JRRewindableDataSource");
        }
    }
}
项目:geomajas-project-server    文件:InternalFeatureDataSourceTest.java   
@Test
public void testManyToOneAttribute() throws Exception {
    List<InternalFeature> features = service.getFeatures(LAYER_BEANS, geoService.getCrs2("EPSG:4326"), null,
            null, GeomajasConstant.FEATURE_INCLUDE_ALL);
    JRRewindableDataSource data = new InternalFeatureDataSource(features);
    data.moveFirst();
    JRField stringAttribute = createField("stringAttr", String.class);
    JRField many2OneString = createField("manyToOneAttr.stringAttr", String.class);
    int index = 0;
    while (index < features.size()) {
        Assert.assertTrue(data.next());
        InternalFeature feature = features.get(index++);
        Assert.assertEquals(feature.getAttributes().get("stringAttr").getValue(),
                data.getFieldValue(stringAttribute));
        ManyToOneAttribute manyToOne = (ManyToOneAttribute) feature.getAttributes().get("manyToOneAttr");
        if (null != manyToOne.getValue()) {
            Assert.assertEquals(manyToOne.getValue().getAttributeValue("stringAttr"),
                    data.getFieldValue(many2OneString));
        } else {
            Assert.assertEquals(null, data.getFieldValue(many2OneString));
        }
    }
}
项目:dynamicreports-jasper    文件:JasperReportBuilder.java   
public JasperReportBuilder rebuild() throws DRException {
    builded = false;
    reportDesign = null;
    jasperDesign = null;
    jasperReport = null;
    parameters = null;
    jasperPrint = null;
    if (dataSource != null && dataSource instanceof JRRewindableDataSource) {
        try {
            ((JRRewindableDataSource) dataSource).moveFirst();
        } catch (JRException e) {
            throw new DRException(e);
        }
    }
    return this;
}
项目:jasperreports    文件:JRFillSubreport.java   
@Override
    public void rewind() throws JRException
    {
        if (subreportFiller == null)
        {
            return;
        }

        cancelSubreportFill();

        initSubreportFiller(null);//FIXME used cached evaluator

        if (getConnectionExpression() == null && dataSource != null)
        {
            if(dataSource instanceof JRRewindableDataSource)
            {
                ((JRRewindableDataSource) dataSource).moveFirst();
            }
            else
            {
//              if (log.isWarnEnabled())
//                  log.warn("The subreport is placed on a non-splitting band, but it does not have a rewindable data source.");
                throw 
                    new JRException(
                        EXCEPTION_MESSAGE_KEY_NO_REWINDABLE_DATA_SOURCE,  
                        (Object[])null 
                        );
            }
        }
    }
项目:com.opendoorlogistics    文件:SubreportDatasourceProviderImpl.java   
@Override
public JRRewindableDataSource getSubreportDatasource(String table, String[] matchfields, Object[] keyValues) {
    // find table
    ODLTableReadOnly tableObj= TableUtils.findTable(ds, table);
    if(tableObj==null){
        throw new RuntimeException("Cannot find table referenced in subreport: " + table);
    }

    return new FilteredReportDatasource(tableObj, matchfields, keyValues,continueCb);
}
项目:dynamicreports-jasper    文件:DataSourceExpression.java   
@Override
public JRDataSource evaluate(ReportParameters reportParameters) {
    if (moveFirst && dataSource != null && dataSource instanceof JRRewindableDataSource) {
        try {
            ((JRRewindableDataSource) dataSource).moveFirst();
        } catch (JRException e) {
        }
    }
    moveFirst = true;
    return dataSource;
}
项目:com.opendoorlogistics    文件:SubreportDatasourceProviderImpl.java   
@Override
public JRRewindableDataSource getSubreportDatasource(String table) {
    return getSubreportDatasource(table, new String[]{}, new Object[]{});
}
项目:com.opendoorlogistics    文件:SubreportDatasourceProviderImpl.java   
@Override
public JRRewindableDataSource getSubreportDatasource(String table, String matchfield, Object keyValue) {
    return getSubreportDatasource(table, new String[]{matchfield}, new Object[]{keyValue});
}
项目:com.opendoorlogistics    文件:SubreportDatasourceProvider.java   
JRRewindableDataSource getSubreportDatasource(String table);
项目:com.opendoorlogistics    文件:SubreportDatasourceProvider.java   
JRRewindableDataSource getSubreportDatasource(String table,String matchfield, Object keyValue);
项目:com.opendoorlogistics    文件:SubreportDatasourceProvider.java   
JRRewindableDataSource getSubreportDatasource(String table,String matchfields[], Object []keyValues);