org.apache.portals.graffito.jcr.persistence.collectionconverter.impl
Class DefaultCollectionConverterImpl

java.lang.Object
  extended by org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.AbstractCollectionConverterImpl
      extended by org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.DefaultCollectionConverterImpl
All Implemented Interfaces:
CollectionConverter

public class DefaultCollectionConverterImpl
extends AbstractCollectionConverterImpl

Default Collection Mapping/convertion implementation. This collection mapping strategy maps a collection under an extra JCR node (specify by the jcrName in the CollectionDescriptor). It is usefull when the node type "nt:unstructured" is applied to the collection elements. By this way, it is possible to distinguish the collection elements from the other main object fields. If the collection element class contains an id (see the FieldDescriptor definition), this id value is used to build the collection element node. Otherwise, the element node name is a simple indexed constant. Example - without an id attribute: /test (Main object containing the collection field ) /mycollection (extra node used to store the entire collection) /collection-element (node used to store the first collection element) /item-prop .... /collection-element (node used to store the second collection element) ... Example - with an id attribute: /test (Main object containing the collection field ) /mycollection (extra node used to store the entire collection) /aValue (id value assigned to the first element) /item-prop .... /anotherValue (id value assigned to the first element) ...

Author:
Christophe Lombart, Alexandru Popescu

Field Summary
 
Fields inherited from class org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.AbstractCollectionConverterImpl
atomicTypeConverters, mapper, objectConverter
 
Constructor Summary
DefaultCollectionConverterImpl(java.util.Map atomicTypeConverters, ObjectConverter objectConverter, Mapper mapper)
          Constructor
 
Method Summary
protected  ManageableCollection doGetCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, java.lang.Class collectionFieldClass)
           
protected  void doInsertCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection)
           
protected  boolean doIsNull(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, java.lang.Class collectionFieldClass)
           
protected  void doUpdateCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection)
           
 
Methods inherited from class org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.AbstractCollectionConverterImpl
getCollection, getCollectionJcrName, insertCollection, isNull, updateCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultCollectionConverterImpl

public DefaultCollectionConverterImpl(java.util.Map atomicTypeConverters,
                                      ObjectConverter objectConverter,
                                      Mapper mapper)
Constructor

Parameters:
atomicTypeConverters -
objectConverter -
mapper -
Method Detail

doInsertCollection

protected void doInsertCollection(javax.jcr.Session session,
                                  javax.jcr.Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
                                  ManageableCollection collection)
                           throws javax.jcr.RepositoryException
Specified by:
doInsertCollection in class AbstractCollectionConverterImpl
Throws:
javax.jcr.RepositoryException
See Also:
AbstractCollectionConverterImpl.doInsertCollection(Session, Node, CollectionDescriptor, ManageableCollection)

doUpdateCollection

protected void doUpdateCollection(javax.jcr.Session session,
                                  javax.jcr.Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
                                  ManageableCollection collection)
                           throws javax.jcr.RepositoryException
Specified by:
doUpdateCollection in class AbstractCollectionConverterImpl
Throws:
javax.jcr.RepositoryException
See Also:
AbstractCollectionConverterImpl.doUpdateCollection(Session, Node, CollectionDescriptor, ManageableCollection)

doGetCollection

protected ManageableCollection doGetCollection(javax.jcr.Session session,
                                               javax.jcr.Node parentNode,
                                               CollectionDescriptor collectionDescriptor,
                                               java.lang.Class collectionFieldClass)
                                        throws javax.jcr.RepositoryException
Specified by:
doGetCollection in class AbstractCollectionConverterImpl
Throws:
javax.jcr.RepositoryException
See Also:
AbstractCollectionConverterImpl.doGetCollection(Session, Node, CollectionDescriptor, Class)

doIsNull

protected boolean doIsNull(javax.jcr.Session session,
                           javax.jcr.Node parentNode,
                           CollectionDescriptor collectionDescriptor,
                           java.lang.Class collectionFieldClass)
                    throws javax.jcr.RepositoryException
Specified by:
doIsNull in class AbstractCollectionConverterImpl
Throws:
javax.jcr.RepositoryException
See Also:
AbstractCollectionConverterImpl.doIsNull(Session, Node, CollectionDescriptor, Class)


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.