jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Jackrabbit: Mapping Collection Fields (page edited)
Date Wed, 20 Feb 2008 20:41:00 GMT
Mapping Collection Fields (JCR) edited by Jukka Zitting
      Page: http://cwiki.apache.org/confluence/display/JCR/Mapping+Collection+Fields
   Changes: http://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=75363&originalVersion=0&revisedVersion=1

Comment:
---------------------------------------------------------------------



Change summary:
---------------------------------------------------------------------



Change summary:
---------------------------------------------------------------------



Change summary:
---------------------------------------------------------------------



Change summary:
---------------------------------------------------------------------



Content:
---------------------------------------------------------------------

The collection-descriptor maps a collection attribute into JCR nodes or in a multivalue property.

Based on our model defined here, the following collection-descriptor is used to map the "paragraphs"
field into the JCR node called "paragraphs".

{code}
<class-descriptor
    className="org.apache.jackrabbit.ocm.testmodel.Page"
    jcrType="my:page">
  <collection-descriptor
      fieldName="paragraphs" jcrName="paragraphs"
      elementClassName="org.apache.jackrabbit.ocm.testmodel.Paragraph" />
  <!-- other field, bean and collection mapping here !-->
</class-descriptor>

<class-descriptor
    className="org.apache.jackrabbit.ocm.testmodel.Paragraph"
    jcrType="my:paragraph">
  <field-descriptor fieldName="path" path="true" />
  <field-descriptor fieldName="text" jcrName="my:text"/>
</class-descriptor>
{code}

The collection-descriptor contains the elementClassName attribute which specify the collection
element class. A class descriptor for the element class has also to be defined.

h2. The JCR Structure

Following our example, the resulting JCR structure is:

{code}
/mysite/page1
  /mysite/page1/paragraphs
    /mysite/page1/paragraphs/collection-element1
      my:text = "This is the content of para1"
    /mysite/page1/paragraphs/collection-element2
      my:text = "This is the content of para2"
  ... other subnodes for page1 ...
{code}

By default, the persistence manager will create a subnode (/mysite/page1/paragraphs). This
one will contains the different paragraphs.

As explained in the following sections, it is possible to map to another JCR structure. It
is also possible to use another name for the jcr node names (see above).

h2. Supported Collection and Map Types

The OCM framework is supporting the following java types:

* *Collections* Collection, List, Set, ArrayList, Vector, HashSet
* *Maps* Map, HashMap

h2. Using Another Collection or Map

It is possible to support other Collection or Map types with the ManageableCollection interface.

h2. Using Another Collection Converter

TODO

h2. Predefined Collection Converters

TODO

h2. Building your own Collection Converters

TODO


---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences
   http://cwiki.apache.org/confluence/users/viewnotifications.action

If you think it was sent incorrectly contact one of the administrators
   http://cwiki.apache.org/confluence/administrators.action

If you want more information on Confluence, or have a bug to report see
   http://www.atlassian.com/software/confluence



Mime
View raw message