Java Reference
In-Depth Information
Once the configuration is complete, you can create a report task class, which is a class that implements Runnable
and is responsible for running the actual reports. The following class, org.javaee7.chapter11.ReporterTask , is an
example of such as class.
package org.javaee7.chapter11;
import java.io.BufferedWriter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import javax.ejb.EJB;
import org.javaee7.entity.Jobs;
import org.javaee7.entity.Product;
import org.javaee7.jpa.session.JobsSession;
import org.javaee7.jpa.session.ProductSession;
/**
*
* @author Juneau
*/
public class ReporterTask implements Runnable {
String reportName;
@EJB
private JobsSession jobsFacade;
@EJB
private ProductSession productFacade;
public ReporterTask(String reportName) {
this.reportName = reportName;
}
public void run() {
// Run the named report
if ("JobsReport".equals(reportName)) {
runJobReport();
} else if ("ProductReport".equals(reportName)) {
runProductReport();
}
}
 
Search WWH ::




Custom Search