You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marc O'Morain <ma...@swrve.com> on 2011/10/04 19:51:49 UTC

Re: Adding a custom type for Joda Time DateTime

Hi Andrus,

The code is attached here: https://issues.apache.org/jira/browse/CAY-1626

Thanks.

Marc

On Wed, Aug 10, 2011 at 7:45 AM, Andrus Adamchik <an...@objectstyle.org>wrote:

> Hi Marc,
>
> Very cool. Haven't used Joda Time myself yet, but heard a lot of good
> things about it.
>
> This list strips attachments (so we didn't get it), and also would be cool
> if could cover some legal bases and later include your ExtendedType in
> Cayenne base. So would it be possible for you to open a Jira at
> https://issues.apache.org/jira/browse/CAY and attach your code file,
> checking "Grant license to ASF for inclusion in ASF works" in the attachment
> dialog?
>
>
> > What is the purpose of the ExtendedType.validateProperty() function?
> > I was forced to implement it, but the docs say that it is deprecated?
> > My version is never called in my app for some reason, and I just
> > return true.
>
> Yep, that's all you need to do. ExtendedType.validateProperty is deprecated
> in 3.0 and is removed in 3.1
>
> Cheers,
> Andrus
>
>
> On Aug 9, 2011, at 1:55 AM, Marc O'Morain wrote:
> > Hi all,
> >
> > I have just created a custom ExtendedType to allow Cayenne to
> > load/save DateTime object created with the Joda Time API. I find the
> > Joda Time solves many problems that I have with Java's built-in Date
> > and Calendar classes, so I have just moved our codebase over to use
> > Joda Time.
> >
> > The file is attached incase anyone else would like to use it. To hook
> > it up you need to call this code at the start of your application.
> >
> > DataDomain domain = Configuration.getSharedConfiguration().getDomain();
> > ExtendedTypeMap extendedTypes =
> >
> domain.getNode("putYourDateNodeNameHere").getAdapter().getExtendedTypes();
> > extendedTypes.registerType(new DateTimeType());
> >
> > I do have one question however:
> >
> > What is the purpose of the ExtendedType.validateProperty() function?
> > I was forced to implement it, but the docs say that it is deprecated?
> > My version is never called in my app for some reason, and I just
> > return true.
> >
> > Here are the docs:
> > Deprecated. since 3.0 as validation should not be done at the DataNode
> level.
> > Performs validation of an object property. Property is considered
> > valid if this it satisfies the database constraints known to this
> > ExtendedType. In case of validation failure, failures are appended to
> > the ValidationResult object and false is returned.
> >
> > And here is the issue:
> > https://issues.apache.org/jira/browse/CAY-657
> >
> > Do I need to worry about this function?
> >
> > Marc
>
>