incubator-graffito-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christophe Lombart (JIRA)" <j...@apache.org>
Subject [jira] Commented: (GRFT-54) Add more flexibility in the mapping
Date Wed, 21 Jun 2006 14:24:31 GMT
    [ http://issues.apache.org/jira/browse/GRFT-54?page=comments#action_12417120 ] 

Christophe Lombart commented on GRFT-54:
----------------------------------------


The following mapping can solve this kind of issue : 

<class-descriptor className="org.apache.portals.graffito.jcr.testmodel.Image"  jcrNodeType="ram:file"
>
        <field-descriptor fieldName="path" path="true" />
        <field-descriptor fieldName="description" jcrName="ram:description" jcrType="String"
/>
        <subnode-descriptor jcrName="jcr:content" jcrType="jcr:resource">
                <field-descriptor fieldName="mimeType" jcrName="mimeType" jcrType="String"
/>
                 <!-- Add other attributes defined under the jcr:content node -->
        </subnode-descriptor>
</class-descriptor>

The element subnode-descriptor is used in the mapping descriptor to add a new jcr subnode.

There is also another kind of mapping which is already supported in the current code : 
A main object like the following class A contains an "bean" attribute (eg. propB) which is
mapped into the jcr node used to store the class A.

Class A
{
    String propA; 
    B propB; 
  
}


Class B
{
    String propb1;
    String propb2;
}


the resulting jcr structure can be : 
/nodeA
     [prop] propA
     [prop] propb1
     [prop] propb2

This mapping can be done by using a specific beanconverter class.

> Add more flexibility in the mapping
> -----------------------------------
>
>          Key: GRFT-54
>          URL: http://issues.apache.org/jira/browse/GRFT-54
>      Project: Graffito
>         Type: Improvement

>   Components: JCR-Mapping
>     Versions: 1.0-a1-dev
>     Reporter: Christophe Lombart
>      Fix For: 1.0-a1-dev

>
> Sometime, it should be interesting to map to a different jcr node structure. 
> Here is an example, for a class "File", we can have : 
> public class File
> {
>     private String mimeType;
>     private String encoding;
>     private InputStream data;
>     private Calendar lastModified;
>     // Add getters/setters
> }
> and in terms of JCR structure, we can have : 
> nt:file
>     jcr:content
>         jcr:mimeType
>         jcr:encoding
>         jcr:data
>         jcr:lastModified
> So, the jcr:content node is an extra node to specify in the mapping file.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message