org.apache.portals.graffito.jcr.persistence.objectconverter
Interface ObjectConverter

All Known Implementing Classes:
ObjectConverterImpl

public interface ObjectConverter

Convert any kind of beans into JCR nodes & properties

Version:
$Id: Exp $
Author:
Lombart Christophe

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 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
 

Method Detail

insert

void insert(javax.jcr.Session session,
            java.lang.Object object)
            throws PersistenceException
Insert the object

Parameters:
session - the JCR session
object - the object to insert
Throws:
PersistenceException - when it is not possible to insert the object

update

void update(javax.jcr.Session session,
            java.lang.Object object)
            throws PersistenceException
Update the object

Parameters:
session - the JCR session
object - the object to update
Throws:
PersistenceException - when it is not possible to update the object

getObject

java.lang.Object getObject(javax.jcr.Session session,
                           java.lang.String path)
                           throws PersistenceException
Retrieve an object from the JCR repo

Parameters:
session - The JCR session
clazz - The class assigned to the object to retrieve
path - the JCR path
Returns:
The object found or null
Throws:
PersistenceException - when it is not possible to retrieve the object

getObject

java.lang.Object getObject(javax.jcr.Session session,
                           java.lang.Class clazz,
                           java.lang.String path)
                           throws PersistenceException
Retrieve an object from the JCR repo

Parameters:
session - The JCR session
clazz - The class assigned to the object to retrieve
path - the JCR path
Returns:
The object found or null
Throws:
PersistenceException - when it is not possible to retrieve the object

retrieveMappedAttribute

void retrieveMappedAttribute(javax.jcr.Session session,
                             java.lang.Object object,
                             java.lang.String attributeName)
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"

Parameters:
session - The JCR session
object - The persistent object
attributeName - The name of the attribute to retrieve

retrieveAllMappedAttributes

void retrieveAllMappedAttributes(javax.jcr.Session session,
                                 java.lang.Object object)
Retrieve all mapped attributes for the given persistent object.

Parameters:
session - The JCR session
object - The persistent object

insert

void insert(javax.jcr.Session session,
            javax.jcr.Node parentNode,
            java.lang.String nodeName,
            java.lang.Object object)
            throws PersistenceException
Insert the object

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
Throws:
PersistenceException - when it is not possible to insert the object

update

void update(javax.jcr.Session session,
            javax.jcr.Node parentNode,
            java.lang.String nodeName,
            java.lang.Object object)
            throws PersistenceException
Update the object

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
Throws:
PersistenceException - when it is not possible to update the object

getPath

java.lang.String getPath(javax.jcr.Session session,
                         java.lang.Object object)
                         throws PersistenceException
Get the object JCR path

Parameters:
session - the JCR session
object - the object for which the path has to be retrieve
Returns:
the object JCR path
Throws:
PersistenceException - when it is not possible to retrieve the object path


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