PDA

View Full Version : Question about embedding Pentaho in a Java app



NWGesto
11-06-2015, 08:44 PM
Hi,
I have a custom .prpt (let's call it custom.prpt) and it works fine; however, my team is looking for a way to run the report automatically.
I am new to Pentaho and am looking for a way to achieve this.
I did some research and was able to get "org.pentaho.reporting.engine.classic.samples.Sample1.java" to work.
However, when I replaced "Sample1.prpt" with "custom.prpt" in "Sample1.java" (see the method below), I got errors left and right and "custom.prpt" is in the same directory as "Sample1.prpt". Am I even on the right track? I am sure there is more work to be done in order to make this work; however, I am not sure how to solve this problem.

public MasterReport getReportDefinition()
{
try
{
// Using the classloader, get the URL to the reportDefinition file
final ClassLoader classloader = this.getClass().getClassLoader();
final URL reportDefinitionURL = classloader.getResource("org/pentaho/reporting/engine/classic/samples/Sample1.prpt");


// Parse the report file
final ResourceManager resourceManager = new ResourceManager();
final Resource directly = resourceManager.createDirectly(reportDefinitionURL, MasterReport.class);
return (MasterReport) directly.getResource();
}
catch (ResourceException e)
{
e.printStackTrace();
}
return null;
}

please advise,

Neil