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

java.lang.Object
  extended by org.apache.portals.graffito.jcr.persistence.collectionconverter.impl.AbstractCollectionConverterImpl
All Implemented Interfaces:
CollectionConverter
Direct Known Subclasses:
DefaultCollectionConverterImpl, MultiValueCollectionConverterImpl, NTCollectionConverterImpl

public abstract class AbstractCollectionConverterImpl
extends java.lang.Object
implements CollectionConverter

Abstract class used for all CollectionConverter

Author:
Christophe Lombart, Alexandru Popescu

Field Summary
protected  java.util.Map atomicTypeConverters
           
protected  Mapper mapper
           
protected  ObjectConverter objectConverter
           
 
Constructor Summary
AbstractCollectionConverterImpl(java.util.Map atomicTypeConverters, ObjectConverter objectConverter, Mapper mapper)
          Constructor
 
Method Summary
protected abstract  ManageableCollection doGetCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, java.lang.Class collectionFieldClass)
           
protected abstract  void doInsertCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor descriptor, ManageableCollection collection)
           
protected abstract  boolean doIsNull(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, java.lang.Class collectionFieldClass)
           
protected abstract  void doUpdateCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor descriptor, ManageableCollection collection)
           
 ManageableCollection getCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, java.lang.Class collectionFieldClass)
          Get a ManageableCollection from the JCR repository
protected  java.lang.String getCollectionJcrName(CollectionDescriptor descriptor)
           
 void insertCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection)
          Insert/convert collection elements into some JCR nodes
 boolean isNull(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, java.lang.Class collectionFieldClass)
          Check if the collection is null.
 void updateCollection(javax.jcr.Session session, javax.jcr.Node parentNode, CollectionDescriptor collectionDescriptor, ManageableCollection collection)
          Update collection elements 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 java.util.Map atomicTypeConverters

objectConverter

protected ObjectConverter objectConverter

mapper

protected Mapper mapper
Constructor Detail

AbstractCollectionConverterImpl

public AbstractCollectionConverterImpl(java.util.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(javax.jcr.Session session,
                                           javax.jcr.Node parentNode,
                                           CollectionDescriptor descriptor,
                                           ManageableCollection collection)
                                    throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

doUpdateCollection

protected abstract void doUpdateCollection(javax.jcr.Session session,
                                           javax.jcr.Node parentNode,
                                           CollectionDescriptor descriptor,
                                           ManageableCollection collection)
                                    throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

doGetCollection

protected abstract ManageableCollection doGetCollection(javax.jcr.Session session,
                                                        javax.jcr.Node parentNode,
                                                        CollectionDescriptor collectionDescriptor,
                                                        java.lang.Class collectionFieldClass)
                                                 throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

doIsNull

protected abstract boolean doIsNull(javax.jcr.Session session,
                                    javax.jcr.Node parentNode,
                                    CollectionDescriptor collectionDescriptor,
                                    java.lang.Class collectionFieldClass)
                             throws javax.jcr.RepositoryException
Throws:
javax.jcr.RepositoryException

insertCollection

public void insertCollection(javax.jcr.Session session,
                             javax.jcr.Node parentNode,
                             CollectionDescriptor collectionDescriptor,
                             ManageableCollection collection)
Description copied from interface: CollectionConverter
Insert/convert collection elements 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
collection - the collection to insert
See Also:
CollectionConverter.insertCollection(javax.jcr.Session, javax.jcr.Node, org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor, org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection)

updateCollection

public void updateCollection(javax.jcr.Session session,
                             javax.jcr.Node parentNode,
                             CollectionDescriptor collectionDescriptor,
                             ManageableCollection collection)
Description copied from interface: CollectionConverter
Update collection elements 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
collection - the collection to update
See Also:
CollectionConverter.updateCollection(javax.jcr.Session, javax.jcr.Node, org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor, org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection)

getCollection

public ManageableCollection getCollection(javax.jcr.Session session,
                                          javax.jcr.Node parentNode,
                                          CollectionDescriptor collectionDescriptor,
                                          java.lang.Class collectionFieldClass)
Description copied from interface: CollectionConverter
Get a ManageableCollection 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 populates with all elements found in the JCR repository
See Also:
CollectionConverter.getCollection(javax.jcr.Session, javax.jcr.Node, org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor, java.lang.Class)

isNull

public boolean isNull(javax.jcr.Session session,
                      javax.jcr.Node parentNode,
                      CollectionDescriptor collectionDescriptor,
                      java.lang.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 java.lang.String getCollectionJcrName(CollectionDescriptor descriptor)


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