org.apache.jackrabbit.ocm.manager.collectionconverter.impl
Class NTCollectionConverterImpl

java.lang.Object
  extended by org.apache.jackrabbit.ocm.manager.collectionconverter.impl.AbstractCollectionConverterImpl
      extended by org.apache.jackrabbit.ocm.manager.collectionconverter.impl.NTCollectionConverterImpl
All Implemented Interfaces:
CollectionConverter

public class NTCollectionConverterImpl
extends AbstractCollectionConverterImpl

Collection Mapping/convertion based on node type. This collection mapping strategy maps the collection elements into subnodes based on the same node types. There are 3 constraints in this collection converter : 1/ this is not possible to have 2 different collections in the main object which are used the same jcr node type for their elements. 2/ this is not possible to make a distinction between an empty collection and an null collection. 3/ Map are not supported. If the collection element class contains an id (see the FieldDescriptor definition), this id value is used to build the collection element node name. Otherwise, the element node name is a simple constant (collection-element) Example - without an id attribute: /test (Main object containing the collection field ) /collection-element (node used to store the first collection element) /item-prop .... /collection-element (node used to store the second collection element) ... Each "collection-element" nodes have the same jcr node type Example - with an id attribute: /test (Main object containing the collection field ) /aValue (id value assigned to the first element) /item-prop .... /anotherValue (id value assigned to the first element) ... Each collection element nodes have the same jcr node type

Author:
Christophe Lombart

Field Summary
protected static String COLLECTION_ELEMENT_NAME
           
 
Fields inherited from class org.apache.jackrabbit.ocm.manager.collectionconverter.impl.AbstractCollectionConverterImpl
atomicTypeConverters, mapper, objectConverter
 
Constructor Summary
NTCollectionConverterImpl(Map atomicTypeConverters, ObjectConverter objectConverter, Mapper mapper)
          Constructor
 
Method Summary
protected  ManageableObjects doGetCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
           
protected  void doInsertCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableObjects objects)
           
protected  boolean doIsNull(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
           
protected  void doUpdateCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableObjects objects)
           
 
Methods inherited from class org.apache.jackrabbit.ocm.manager.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
 

Field Detail

COLLECTION_ELEMENT_NAME

protected static final String COLLECTION_ELEMENT_NAME
See Also:
Constant Field Values
Constructor Detail

NTCollectionConverterImpl

public NTCollectionConverterImpl(Map atomicTypeConverters,
                                 ObjectConverter objectConverter,
                                 Mapper mapper)
Constructor

Parameters:
atomicTypeConverters -
objectConverter -
mapper -
Method Detail

doInsertCollection

protected void doInsertCollection(Session session,
                                  Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
                                  ManageableObjects objects)
Specified by:
doInsertCollection in class AbstractCollectionConverterImpl
See Also:
AbstractCollectionConverterImpl#doInsertCollection(Session, Node, CollectionDescriptor, ManageableCollection)

doUpdateCollection

protected void doUpdateCollection(Session session,
                                  Node parentNode,
                                  CollectionDescriptor collectionDescriptor,
                                  ManageableObjects objects)
                           throws RepositoryException
Specified by:
doUpdateCollection in class AbstractCollectionConverterImpl
Throws:
RepositoryException
See Also:
org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter#updateCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection)

doGetCollection

protected ManageableObjects doGetCollection(Session session,
                                            Node parentNode,
                                            CollectionDescriptor collectionDescriptor,
                                            Class collectionFieldClass)
                                     throws RepositoryException
Specified by:
doGetCollection in class AbstractCollectionConverterImpl
Throws:
RepositoryException
See Also:
CollectionConverter.getCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, java.lang.Class)

doIsNull

protected boolean doIsNull(Session session,
                           Node parentNode,
                           CollectionDescriptor collectionDescriptor,
                           Class collectionFieldClass)
                    throws RepositoryException
Specified by:
doIsNull in class AbstractCollectionConverterImpl
Throws:
RepositoryException
See Also:
return true If the parent node doesn't contains node based on the node type associated to the collection elements


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