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

java.lang.Object
  extended by org.apache.jackrabbit.ocm.manager.collectionconverter.impl.AbstractCollectionConverterImpl
All Implemented Interfaces:
CollectionConverter
Direct Known Subclasses:
BeanReferenceCollectionConverterImpl, BeanReferenceMapConverterImpl, DefaultCollectionConverterImpl, MultiValueCollectionConverterImpl, NTCollectionConverterImpl, ReferenceCollectionConverterImpl, ResidualNodesCollectionConverterImpl, ResidualPropertiesCollectionConverterImpl

public abstract class AbstractCollectionConverterImpl
extends Object
implements CollectionConverter

Abstract class used for all CollectionConverter

Author:
Christophe Lombart, Alexandru Popescu

Field Summary
protected  Map atomicTypeConverters
           
protected  Mapper mapper
           
protected  ObjectConverter objectConverter
           
 
Constructor Summary
AbstractCollectionConverterImpl(Map atomicTypeConverters, ObjectConverter objectConverter, Mapper mapper)
          Constructor
 
Method Summary
protected abstract  ManageableObjects doGetCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
           
protected abstract  void doInsertCollection(Session session, Node parentNode, CollectionDescriptor descriptor, ManageableObjects objects)
           
protected abstract  boolean doIsNull(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
           
protected abstract  void doUpdateCollection(Session session, Node parentNode, CollectionDescriptor descriptor, ManageableObjects objects)
           
 ManageableObjects getCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
          Get a ManageableObjects from the JCR repository
protected  String getCollectionJcrName(CollectionDescriptor descriptor)
           
 void insertCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableObjects objects)
          Insert/convert collection elements (a Collection or a Map) into some JCR nodes
 boolean isNull(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, Class collectionFieldClass)
          Check if the collection is null.
 void updateCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor, ManageableObjects objects)
          Update collection elements (a Collection or a Map) already present in the JCR repository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

atomicTypeConverters

protected Map atomicTypeConverters

objectConverter

protected ObjectConverter objectConverter

mapper

protected Mapper mapper
Constructor Detail

AbstractCollectionConverterImpl

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

Parameters:
atomicTypeConverters - The atomic type converter to used
objectConverter - The object converter to used
mapper - The mapper to used
Method Detail

doInsertCollection

protected abstract void doInsertCollection(Session session,
                                           Node parentNode,
                                           CollectionDescriptor descriptor,
                                           ManageableObjects objects)
                                    throws RepositoryException
Throws:
RepositoryException

doUpdateCollection

protected abstract void doUpdateCollection(Session session,
                                           Node parentNode,
                                           CollectionDescriptor descriptor,
                                           ManageableObjects objects)
                                    throws RepositoryException
Throws:
RepositoryException

doGetCollection

protected abstract ManageableObjects doGetCollection(Session session,
                                                     Node parentNode,
                                                     CollectionDescriptor collectionDescriptor,
                                                     Class collectionFieldClass)
                                              throws RepositoryException
Throws:
RepositoryException

doIsNull

protected abstract boolean doIsNull(Session session,
                                    Node parentNode,
                                    CollectionDescriptor collectionDescriptor,
                                    Class collectionFieldClass)
                             throws RepositoryException
Throws:
RepositoryException

insertCollection

public void insertCollection(Session session,
                             Node parentNode,
                             CollectionDescriptor collectionDescriptor,
                             ManageableObjects objects)
Description copied from interface: CollectionConverter
Insert/convert collection elements (a Collection or a Map) into some JCR nodes

Specified by:
insertCollection in interface CollectionConverter
Parameters:
session - The JCR session
parentNode - the node which will contains the collection element
collectionDescriptor - The collection descriptor
objects - The objects to insert
See Also:
org.apache.jackrabbit.ocm.manager.collectionconverter.CollectionConverter#insertCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection)

updateCollection

public void updateCollection(Session session,
                             Node parentNode,
                             CollectionDescriptor collectionDescriptor,
                             ManageableObjects objects)
Description copied from interface: CollectionConverter
Update collection elements (a Collection or a Map) already present in the JCR repository

Specified by:
updateCollection in interface CollectionConverter
Parameters:
session - The JCR session
parentNode - the node which will contains the collection element
collectionDescriptor - The collection descriptor
objects - The objects to update
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)

getCollection

public ManageableObjects getCollection(Session session,
                                       Node parentNode,
                                       CollectionDescriptor collectionDescriptor,
                                       Class collectionFieldClass)
Description copied from interface: CollectionConverter
Get a ManageableObjects from the JCR repository

Specified by:
getCollection in interface CollectionConverter
Parameters:
session - The JCR session
parentNode - the node which contains the collection element
collectionDescriptor - The collection descriptor
collectionFieldClass - The collection class to used (ArrayList, Vector, ..)
Returns:
The collection or a map populates with all elements found in the JCR repository
See Also:
CollectionConverter.getCollection(javax.jcr.Session, javax.jcr.Node, org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor, java.lang.Class)

isNull

public boolean isNull(Session session,
                      Node parentNode,
                      CollectionDescriptor collectionDescriptor,
                      Class collectionFieldClass)
Description copied from interface: CollectionConverter
Check if the collection is null. This method is mainly used in the Proxy manager to return a null value or a proxy object Without proxy proxy, this method is never called.

Specified by:
isNull in interface CollectionConverter
Parameters:
session - The JCR session
parentNode - the node which contains the collection element
collectionDescriptor - The collection descriptor
collectionFieldClass - The collection class to used (ArrayList, Vector, ..)
Returns:
true if the collection contains elements.
See Also:
CollectionConverter.isNull(Session, Node, CollectionDescriptor, Class)

getCollectionJcrName

protected String getCollectionJcrName(CollectionDescriptor descriptor)


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