org.apache.portals.graffito.jcr.persistence.objectconverter.impl
Class ObjectConverterImpl

java.lang.Object
  extended by org.apache.portals.graffito.jcr.persistence.objectconverter.impl.ObjectConverterImpl
All Implemented Interfaces:
ObjectConverter

public class ObjectConverterImpl
extends java.lang.Object
implements ObjectConverter

Default implementation for ObjectConverterImpl

Author:
Lombart Christophe , Alexandru Popescu

Constructor Summary
ObjectConverterImpl()
          No-arg constructor.
ObjectConverterImpl(Mapper mapper, AtomicTypeConverterProvider converterProvider)
          Constructor
 
Method Summary
 java.lang.Object getObject(javax.jcr.Session session, java.lang.Class clazz, java.lang.String path)
          Retrieve an object from the JCR repo
 java.lang.Object getObject(javax.jcr.Session session, java.lang.String path)
          Retrieve an object from the JCR repo
 java.lang.String getPath(javax.jcr.Session session, java.lang.Object object)
          Get the object JCR path
 void insert(javax.jcr.Session session, javax.jcr.Node parentNode, java.lang.String nodeName, java.lang.Object object)
          Insert the object
 void insert(javax.jcr.Session session, java.lang.Object object)
          Insert the object
 void retrieveAllMappedAttributes(javax.jcr.Session session, java.lang.Object object)
          Retrieve all mapped attributes for the given persistent object.
 void retrieveMappedAttribute(javax.jcr.Session session, java.lang.Object object, java.lang.String attributeName)
          Retrieve the specified attribute for the given persistent object.
 void setAtomicTypeConverterProvider(AtomicTypeConverterProvider converterProvider)
          Sets the converter provider.
 void setMapper(Mapper mapper)
          Set the Mapper used to solve mappings.
 void update(javax.jcr.Session session, javax.jcr.Node parentNode, java.lang.String nodeName, java.lang.Object object)
          Update the object
 void update(javax.jcr.Session session, java.lang.Object object)
          Update the object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectConverterImpl

public ObjectConverterImpl()
No-arg constructor.


ObjectConverterImpl

public ObjectConverterImpl(Mapper mapper,
                           AtomicTypeConverterProvider converterProvider)
Constructor

Parameters:
mapper - The mapper to used
converterProvider - The atomic type converter provider
Method Detail

setMapper

public void setMapper(Mapper mapper)
Set the Mapper used to solve mappings.

Parameters:
mapper - a Mapper

setAtomicTypeConverterProvider

public void setAtomicTypeConverterProvider(AtomicTypeConverterProvider converterProvider)
Sets the converter provider.

Parameters:
converterProvider - an AtomicTypeConverterProvider

insert

public void insert(javax.jcr.Session session,
                   java.lang.Object object)
Description copied from interface: ObjectConverter
Insert the object

Specified by:
insert in interface ObjectConverter
Parameters:
session - the JCR session
object - the object to insert
See Also:
ObjectConverter.insert(javax.jcr.Session, java.lang.Object)

insert

public void insert(javax.jcr.Session session,
                   javax.jcr.Node parentNode,
                   java.lang.String nodeName,
                   java.lang.Object object)
Description copied from interface: ObjectConverter
Insert the object

Specified by:
insert in interface ObjectConverter
Parameters:
session - the JCR session
parentNode - The parent node used to store the new JCR element (object)
nodeName - The node name used to store the object
object - the object to insert
See Also:
ObjectConverter.insert(javax.jcr.Session, javax.jcr.Node, java.lang.String, java.lang.Object)

update

public void update(javax.jcr.Session session,
                   java.lang.Object object)
Description copied from interface: ObjectConverter
Update the object

Specified by:
update in interface ObjectConverter
Parameters:
session - the JCR session
object - the object to update
See Also:
ObjectConverter.update(javax.jcr.Session, java.lang.Object)

update

public void update(javax.jcr.Session session,
                   javax.jcr.Node parentNode,
                   java.lang.String nodeName,
                   java.lang.Object object)
Description copied from interface: ObjectConverter
Update the object

Specified by:
update in interface ObjectConverter
Parameters:
session - the JCR session
parentNode - The parent node used to store the new JCR element (object)
nodeName - The node name used to store the object
object - the object to update
See Also:
ObjectConverter.update(javax.jcr.Session, javax.jcr.Node, java.lang.String, java.lang.Object)

getObject

public java.lang.Object getObject(javax.jcr.Session session,
                                  java.lang.String path)
Description copied from interface: ObjectConverter
Retrieve an object from the JCR repo

Specified by:
getObject in interface ObjectConverter
Parameters:
session - The JCR session
path - the JCR path
Returns:
The object found or null
See Also:
ObjectConverter.getObject(javax.jcr.Session, java.lang.Class, java.lang.String)

getObject

public java.lang.Object getObject(javax.jcr.Session session,
                                  java.lang.Class clazz,
                                  java.lang.String path)
Description copied from interface: ObjectConverter
Retrieve an object from the JCR repo

Specified by:
getObject in interface ObjectConverter
Parameters:
session - The JCR session
clazz - The class assigned to the object to retrieve
path - the JCR path
Returns:
The object found or null
See Also:
ObjectConverter.getObject(javax.jcr.Session, java.lang.Class, java.lang.String)

retrieveAllMappedAttributes

public void retrieveAllMappedAttributes(javax.jcr.Session session,
                                        java.lang.Object object)
Description copied from interface: ObjectConverter
Retrieve all mapped attributes for the given persistent object.

Specified by:
retrieveAllMappedAttributes in interface ObjectConverter
Parameters:
session - The JCR session
object - The persistent object

retrieveMappedAttribute

public void retrieveMappedAttribute(javax.jcr.Session session,
                                    java.lang.Object object,
                                    java.lang.String attributeName)
Description copied from interface: ObjectConverter
Retrieve the specified attribute for the given persistent object. this attribute is either a bean or a collection. This method is usefull if the corresponding descriptor has an autoRetrieve="false"

Specified by:
retrieveMappedAttribute in interface ObjectConverter
Parameters:
session - The JCR session
object - The persistent object
attributeName - The name of the attribute to retrieve

getPath

public java.lang.String getPath(javax.jcr.Session session,
                                java.lang.Object object)
Description copied from interface: ObjectConverter
Get the object JCR path

Specified by:
getPath in interface ObjectConverter
Parameters:
session - the JCR session
object - the object for which the path has to be retrieve
Returns:
the object JCR path
Throws:
JcrMappingException
See Also:
ObjectConverter.getPath(javax.jcr.Session, java.lang.Object)


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