incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Koci (JIRA)" <>
Subject [jira] Commented: (GRFT-72) Bug in org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.UtilDateTypeConverterImpl
Date Mon, 14 Nov 2005 13:39:28 GMT
    [ ] 

Martin Koci commented on GRFT-72:

I think with this solution following is not possible:

Custom node type with property of type Date:
        <propertyDefinition name="jcr:lastModified" requiredType="Date" autoCreated="false"
mandatory="true" onParentVersion="IGNORE" protected="false" multiple="false"/>

jcrmapping with that property:
		<field-descriptor fieldName="lastModified" jcrName="jcr:lastModified" />

Domain object with that property:
protected Date lastModified;

Jackrabbit throws exception because UtilDateTypeConverterImpl returns LongValue object but
property is declared as Date. 
This can be fixed with changing requiredType="Date" to requiredType="Long" but I want use
Date type with JCR. Jcrmapping can support saving/converting Date properties as Longs as optional

> Bug in org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.UtilDateTypeConverterImpl
> -----------------------------------------------------------------------------------------------------
>          Key: GRFT-72
>          URL:
>      Project: Graffito
>         Type: Bug
>   Components: JCR-Mapping
>     Reporter: Martin Koci
>     Assignee: Christophe Lombart
>  Attachments: UtilDateTypeConverterImpl.patch
> In this converter following line is used:
> return this.getValueFactory().createValue(((java.util.Date) propValue).getTime());
> but propValue must be converted to java.util.Calendar, not into long! ValueFactory than
converts to LongValue not DateValue as expected.
> Following code works OK:
> final long timeInMilis = ((java.util.Date) propValue).getTime();
> final Calendar calendar = Calendar.getInstance();
> calendar.setTimeInMillis(timeInMilis);
> return this.getValueFactory().createValue( calendar );
> but I dont know better Date-> Calendar conversion.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message