• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: JasperReport LocalDate question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JasperReport LocalDate question


  • Subject: Re: JasperReport LocalDate question
  • From: John Huss <email@hidden>
  • Date: Sun, 30 Jan 2011 14:33:49 -0600

With this level of java knowledge, you really should consider pausing with these particular issues and spending some time getting a thorough understanding of Java.  You have to walk before you can run.  You'll be doing yourself a favor (and save time) by pursuing learning first and then coding, rather than just hacking on this until it works.  Don't beat your head into the wall.

But about the date stuff.  Joda is cool and useful, but it is not really necessary.  People have been doing WO apps with Joda for a long time and the Joda integration with WO is not in any way complete or standardized or commonly used.  You would probably have less trouble if you stuck to the standard, core classes instead and then in the future maybe revisit this idea.

John

On Sun, Jan 30, 2011 at 7:31 AM, Theodore Petrosky <email@hidden> wrote:
I did read the errors. The problem was understanding what the errors were telling me. And the next issue is determining what I can do about it with my limited knowledge.

I am using the Joda example that was discussed before (from the Henrique Prange example).

With the information you gave me, this is what I did.

googled java class inheritance to learn what this is:

The syntax for creating a subclass is simple. At the beginning of your class declaration, use the extends keyword, followed by the name of the class to inherit from:

class MountainBike extends Bicycle {

    // new fields and methods defining a mountain bike would go here

}

so what do I have in LocalTime:

/**
 * LocalDate custom type.
 *
 * @author <a href="" href="mailto:email@hidden">email@hidden">Henrique Prange</a>
 */
public class LocalDate implements ReadablePartial, Comparable<Object>
{

}

great the example never mentions implements. so googling "java class extends implements" gives a tutorial:

class MyClass extends MySuperClass implements YourInterface {
   //field, constructor, and method declarations
}

So my attempt is to add into LocalDate the extends like this:

public class LocalDate  extends java.util.Date implements ReadablePartial, Comparable<Object>
{

}

but then there is an error:

- The interface Comparable cannot be implemented more than once with different arguments: Comparable<Date> and
        Comparable<Object>

so I checked the docs on java.util.Date:

public class Date
extends Object
implements Serializable, Cloneable, Comparable<Date>

so he implements Comparable<Date> but LocalDate had Comparable<Object>.

I hate this stuff. So I deleted Comparable from LocalDate and now there is an error with a method:

Name clash: The method compareTo(Object) of type LocalDate has the same erasure as compareTo(T) of type Comparable<T> but does
 not override it

I made the executive decision to comment out the compareTo() method in LocalDate.

And to my complete surprise, it works.

But without your help reading the error log, I didn't even have an idea where to start looking.

Of course, maybe my hacking is actually making things worse. I guess I will have to keep my fingers crossed and hope youse guys don't get too tired helping people like me.

Thank you,

Ted

--- On Sun, 1/30/11, Pascal Robert <email@hidden> wrote:

> From: Pascal Robert <email@hidden>
> Subject: Re: JasperReport LocalDate question
> To: "Theodore Petrosky" <email@hidden>
> Cc: email@hidden
> Date: Sunday, January 30, 2011, 4:31 AM
> You just have to read the errors:
>
> > 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
>
> From what class com.eltek.utilities.LocalDate inherits? If
> it's from JodaTime's LocalDate, well that class don't
> inherits from java.util.Date!
>
> > 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
>
>



 _______________________________________________
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

 _______________________________________________
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

  • Follow-Ups:
    • Re: JasperReport LocalDate question
      • From: Kieran Kelleher <email@hidden>
References: 
 >Re: JasperReport LocalDate question (From: Pascal Robert <email@hidden>)
 >Re: JasperReport LocalDate question (From: Theodore Petrosky <email@hidden>)

  • Prev by Date: Re: JasperReport LocalDate question
  • Next by Date: Re: JasperReport LocalDate question
  • Previous by thread: Re: JasperReport LocalDate question
  • Next by thread: Re: JasperReport LocalDate question
  • Index(es):
    • Date
    • Thread