JasperReport LocalDate question
JasperReport LocalDate question
- Subject: JasperReport LocalDate question
- From: Theodore Petrosky <email@hidden>
- Date: Sun, 30 Jan 2011 00:20:10 -0800 (PST)
I think I am almost there. Well maybe.
I have an EO with attributes that are dates in the postgresql db.
invoiceBookedDate is a date. It is modeled as a LocalDate. In my UI, I have an AjaxDatePicker which appears to only create NSTimestamps. So I create a cover methods (setter and getter) that accept the NSTimestamp and convert LocalDates.
invoiceList = Invoice.fetchInvoices(versionListEC, ERXQ.equals(Invoice.INVOICE_BOOKED_DATE_KEY, theLocalDate()), null);
works beautifully to get the list of all Invoices booked on the date from the AjaxDatePicker.
but when I try to populate the JasperReport using the WOWODC 2010 example, I get errors.
public static Callable<File> createSingleDateReportTask(NSTimestamp theDate) {
NSLog.out.appendln("NSTimestamp theDate = " + theDate);
String myDate = mainDateFormatter.format(theDate);
LocalDate reportLocalDate = new LocalDate(myDate);
ERXFetchSpecification<Invoice> fs = new ERXFetchSpecification<Invoice>(Invoice.ENTITY_NAME,
ERXQ.equals(Invoice.INVOICE_BOOKED_DATE_KEY, reportLocalDate), null);
NSLog.out.appendln("fs = " + fs);
String reportDescription = "A report on Invoices booked on: ";
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("reportDescription", reportDescription);
// Builder pattern for constructor since.
ERJRFetchSpecificationReportTask reportTask = new ERJRFetchSpecificationReportTask(fs, "BillingToday.jasper", parameters);
return reportTask;
}
I know the above qualifier works, as it is working to create the array that I use in the displayGroup.
Here is the error trace:
Jan 30 08:03:51 TheWorkTracker[56046] INFO NSLog - NSTimestamp theDate = 2010-12-06 00:00:00 Etc/GMT
Jan 30 08:03:51 TheWorkTracker[56046] INFO NSLog - fs = <class er.extensions.eof.ERXFetchSpecification(entityName=Invoice,
qualifier=(invoiceBookedDate = (org.joda.time.LocalDate)'2010-12-06'),
isDeep=true, usesDistinct=false,
sortOrdering=null,
hints=null,
_prefetchingRelationshipKeyPaths = null)>
Jan 30 08:03:51 TheWorkTracker[56046] INFO er.jrexample.controllers.AbstractPageController - Controller named 'er.jrexample.controllers.FileTaskDownloadController' just instantiated in page named 'com.eltek.components.TWTBilling_DailyReportComponent'
Jan 30 08:03:51 TheWorkTracker[56046] INFO NSLog - FileTaskDownloadController called
Jan 30 08:03:51 TheWorkTracker[56046] INFO NSLog - nextPageController called = Billing List
Jan 30 08:03:52 TheWorkTracker[56046] ERROR er.jasperreports.ERJRFetchSpecificationReportTask - Error in JR task
ClassCastException: com.eltek.utilities.LocalDate cannot be cast to java.util.Date
at BillingToday_1296250490999_974810.evaluate(BillingToday_1296250490999_974810:171)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillFrame.evaluate(JRFillFrame.java:147)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:325)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:261)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:860)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:540)
at net.sf.jasperreports.engine.JasperRunManager.runReportToPdfFile(JasperRunManager.java:351)
at er.jasperreports.ERJRUtilities.runCompiledReportToPDFFile(ERJRUtilities.java:54)
at er.jasperreports.ERJRFetchSpecificationReportTask._call(ERJRFetchSpecificationReportTask.java:131)
at er.jasperreports.ERJRFetchSpecificationReportTask.call(ERJRFetchSpecificationReportTask.java:98)
at er.jasperreports.ERJRFetchSpecificationReportTask.call(ERJRFetchSpecificationReportTask.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... skipped 1 stack elements
nextPage action fired
Jan 30 08:03:53 TheWorkTracker[56046] ERROR er.jrexample.components.GenericAjaxLongResponsePage - Long Response Error:
{}
ClassCastException: com.eltek.utilities.LocalDate cannot be cast to java.util.Date
at BillingToday_1296250490999_974810.evaluate(BillingToday_1296250490999_974810:171)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:182)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:589)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:557)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:929)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:383)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillFrame.evaluate(JRFillFrame.java:147)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:325)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:261)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:127)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:942)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:860)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:540)
at net.sf.jasperreports.engine.JasperRunManager.runReportToPdfFile(JasperRunManager.java:351)
at er.jasperreports.ERJRUtilities.runCompiledReportToPDFFile(ERJRUtilities.java:54)
at er.jasperreports.ERJRFetchSpecificationReportTask._call(ERJRFetchSpecificationReportTask.java:131)
at er.jasperreports.ERJRFetchSpecificationReportTask.call(ERJRFetchSpecificationReportTask.java:98)
at er.jasperreports.ERJRFetchSpecificationReportTask.call(ERJRFetchSpecificationReportTask.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... skipped 1 stack elements
Jan 30 08:03:54 TheWorkTracker[56046] ERROR er.jrexample.controllers.FileTaskDownloadController - Error
what can I do? I am lost.
Ted
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden