
JDO Report provides JDO support in JasperReports.
Here you will find the links for the download.
I strongly believe that JDO is really a superior specification about Java persistence, with a wide number of
implementations available.
Nevertheless, I think that the best way to promote JDO technology, at this point in time, is to provide packages/products/solutions
built on JDO.
At this time, JDO has no reporting capabilities. If you use an implmentation based on a RDBMS backend it is possible to use several
reporting products, both commercial and open source.
You have the products, but also the drawbacks: the object-relational impedence mismatch is back again !
JasperReports has a nice model for building data source providers that fits well in JDO model.
More, JasperReports supports query executer plug-in, so that data sources can be created by the engine itself.
Well, I am not a big fan of this model because I like to think to reports as templates for rendering of different data sources.
I mean that you could use the same report layout for the output of data produced with different queries.
The following example is extracted from the ditribution
<extractors> <feature-extractor-factory name="jedi" java-class="org.omj.core.reflect.xml.JDOMJediFeatureExtractorFactory"/> <feature-extractor name="REGION_NAME" description="Name of region" factory="jedi" path-expr="region.getName()" arg-name="region"/> <feature-extractor name="CITY_NAME" description="Lastname" factory="jedi" path-expr="city.getName()" arg-name="city"/> <feature-extractor name="CITIES" description="Work Date" factory="jedi" path-expr="region.getCities()" arg-name="region"/> </extractors>You can see the definition of 3 fields. The names corresponds the the ones used in the report. A sample data source can be created and used in a report as follows
JRDataSource jrds;
JRFieldFetcher jrff = createJRFieldFetcher();
Collection c = new ArrayList();
//add some objects to the collection
jrds = new JRDelegateFetchDataSource(c, jrff);
Map parameters = new HashMap();
parameters.put("ReportTitle", "The First Jasper Report Ever");
JRDataSource jrds = createDataSource();
JRDelegateFetchDataSource jrdfds = (JRDelegateFetchDataSource) jrds;
JasperRunManager.runReportToPdfFile(fileName, parameters, jrds);
The field fetcher is loaded from file as follows
JRFeatureExtractorFieldFetcher jrff = null;
String xmlconf = "/META-INF/feature-extractor.xml";
// This is a map of names to FeatureExtractor
FeatureExtractorRegistry registry = new DefaultFeatureExtractorRegistry("main");
JDOMFeatureExtractorRegistryLoader jdoml = new JDOMFeatureExtractorRegistryLoader();
jdoml.load(xmlconf, registry);
// This is an NamedFeatureExtractor backed on a FeatureExtractorRegistry
NamedFeatureExtractor fx = new DelegatingNamedFeatureExtractor(registry);
jrff = new JRFeatureExtractorFieldFetcher(fx);
<jdo-queries> <jdo-query name="jpmquery" candidate-class="org.omj.jpm.domain.impl.WorkUnitImpl"> <jdoql-import>org.omj.jpm.domain.spec.*</jdoql-import> <jdoql-param name="lastname" java-class="java.lang.String"/> <jdoql>((org.omj.jpm.domain.impl.WorkerImpl) worker).lastName == lastname</jdoql> </jdo-query> </jdo-queries>The JDO Query Executer needs 3 builtin parameters to be passed (see org.omj.report.jasper.jdo.JRJdoQueryExecuterFactory for the relevant constants for the parameters names):
For any comment on this site, drop a mail to webmaster
For any comment, question, suggestion on the various packages contact voodoo@objectmagic.org (Yes, even for bug report)