org.jcrom.dao
Interface JcrDAO<T>

All Known Implementing Classes:
AbstractJcrDAO

public interface JcrDAO<T>

The base interface for JCR Data Access Objects. Normally, the interface will be implemented for each root object being mapped to a Java Content Repository (JCR). It is intended that such implementations will manage the JCR root path for the entity being mapped. JCR session strategy is also to be declared by implementations.

Implementations should encapsulate exceptions in JcrMappingException, which is a RuntimeException.

Author:
Olafur Gauti Gudmundsson

Method Summary
 T create(java.lang.String parentNodePath, T entity)
          Creates a new JCR Node from the object supplied, under the parent node with the path specified.
 T create(T entity)
          Creates a new JCR Node from the object supplied.
 boolean exists(java.lang.String path)
          Check whether an entity with the path supplied exists in JCR.
 java.util.List<T> findAll(java.lang.String rootPath)
          Find all entities represented by this DAO.
 java.util.List<T> findAll(java.lang.String rootPath, long startIndex, long resultSize)
          Find all entities represented by this DAO.
 java.util.List<T> findAll(java.lang.String rootPath, java.lang.String childNameFilter, int maxDepth)
          Find all entities represented by this DAO.
 java.util.List<T> findAll(java.lang.String rootPath, java.lang.String childNameFilter, int maxDepth, long startIndex, long resultSize)
          Find all entities represented by this DAO.
 T get(java.lang.String path)
          Get an entity from JCR by path (from a @JcrPath field).
 T get(java.lang.String path, java.lang.String childNodeFilter, int maxDepth)
          Get an entity from JCR by path (from a @JcrPath field).
 long getSize(java.lang.String rootPath)
          Get the number of entities.
 T getVersion(java.lang.String path, java.lang.String versionName)
           
 T getVersion(java.lang.String path, java.lang.String versionName, java.lang.String childNodeFilter, int maxDepth)
           
 T getVersionByUUID(java.lang.String uuid, java.lang.String versionName)
           
 T getVersionByUUID(java.lang.String uuid, java.lang.String versionName, java.lang.String childNodeFilter, int maxDepth)
           
 java.util.List<T> getVersionList(java.lang.String path)
           
 java.util.List<T> getVersionList(java.lang.String path, java.lang.String childNameFilter, int maxDepth)
           
 java.util.List<T> getVersionList(java.lang.String path, java.lang.String childNameFilter, int maxDepth, long startIndex, long resultSize)
           
 java.util.List<T> getVersionListByUUID(java.lang.String uuid)
           
 java.util.List<T> getVersionListByUUID(java.lang.String uuid, java.lang.String childNameFilter, int maxDepth)
           
 java.util.List<T> getVersionListByUUID(java.lang.String uuid, java.lang.String childNameFilter, int maxDepth, long startIndex, long resultSize)
           
 long getVersionSize(java.lang.String path)
           
 long getVersionSizeByUUID(java.lang.String uuid)
           
 T loadByUUID(java.lang.String uuid)
          Load an entity from JCR by UUID lookup.
 T loadByUUID(java.lang.String uuid, java.lang.String childNodeFilter, int maxDepth)
          Load an entity from JCR by UUID lookup.
 void move(T entity, java.lang.String newParentPath)
          Move an entity to the parent with the path specified.
 void remove(java.lang.String path)
          Permanently remove the entity with the path supplied (from a @JcrPath field).
 void removeByUUID(java.lang.String uuid)
          Permanently remove the entity with the UUID supplied.
 void removeVersion(java.lang.String path, java.lang.String versionName)
           
 void removeVersionByUUID(java.lang.String uuid, java.lang.String versionName)
           
 void restoreVersion(java.lang.String path, java.lang.String versionName)
           
 void restoreVersion(java.lang.String path, java.lang.String versionName, boolean removeExisting)
           
 void restoreVersionByUUID(java.lang.String uuid, java.lang.String versionName)
           
 void restoreVersionByUUID(java.lang.String uuid, java.lang.String versionName, boolean removeExisting)
           
 java.lang.String update(T entity)
          Updates an existing JCR Node with the values extracted from the object supplied.
 java.lang.String update(T entity, java.lang.String childNameFilter, int maxDepth)
          Updates an existing JCR Node with the values extracted from the object supplied.
 java.lang.String updateByUUID(T entity, java.lang.String uuid)
          Updates an existing JCR Node with the values extracted from the object supplied.
 java.lang.String updateByUUID(T entity, java.lang.String uuid, java.lang.String childNameFilter, int maxDepth)
          Updates an existing JCR Node with the values extracted from the object supplied.
 

Method Detail

create

T create(T entity)
Creates a new JCR Node from the object supplied. The path to the parent node will be retrieved from the entity path. A path of "/" means that the entity will be created on root level.

Parameters:
entity - the object to be mapped to a JCR node
Returns:
the newly created Object

create

T create(java.lang.String parentNodePath,
         T entity)
Creates a new JCR Node from the object supplied, under the parent node with the path specified.

Parameters:
parentNodePath - path to the parent node
entity - the object to be mapped to a JCR node
Returns:
the newly created Object

update

java.lang.String update(T entity)
Updates an existing JCR Node with the values extracted from the object supplied.

Parameters:
entity - the object to be mapped to a JCR node
Returns:
the name of the JCR Node that was updated

update

java.lang.String update(T entity,
                        java.lang.String childNameFilter,
                        int maxDepth)
Updates an existing JCR Node with the values extracted from the object supplied.

Parameters:
entity - the object to be mapped to a JCR node
childNameFilter - comma separated list of names of child nodes to load ("*" loads all, "none" loads no children, and "-" at the beginning makes it an exclusion filter)
maxDepth - the maximum depth of loaded child nodes (0 means no child nodes are loaded, while a negative value means that no restrictions are set on the depth).
Returns:
the name of the JCR Node that was updated

updateByUUID

java.lang.String updateByUUID(T entity,
                              java.lang.String uuid)
Updates an existing JCR Node with the values extracted from the object supplied. The node to update is loaded using the UUID supplied.

Parameters:
entity - the object to be mapped to a JCR node
uuid - the JCR UUID of the node to update
Returns:
the name of the node that was updated

updateByUUID

java.lang.String updateByUUID(T entity,
                              java.lang.String uuid,
                              java.lang.String childNameFilter,
                              int maxDepth)
Updates an existing JCR Node with the values extracted from the object supplied. The node to update is loaded using the UUID supplied.

Parameters:
entity - the object to be mapped to a JCR node
uuid - the UUID of the node to update
childNameFilter - comma separated list of names of child nodes to load ("*" loads all, "none" loads no children, and "-" at the beginning makes it an exclusion filter)
maxDepth - the maximum depth of loaded child nodes (0 means no child nodes are loaded, while a negative value means that no restrictions are set on the depth).
Returns:
the name of the JCR Node that was updated

move

void move(T entity,
          java.lang.String newParentPath)
Move an entity to the parent with the path specified. Handles checkout and checkin for mix:versionable parents.

Parameters:
entity -
newParentPath -

remove

void remove(java.lang.String path)
Permanently remove the entity with the path supplied (from a @JcrPath field).

Parameters:
path - the full path of the entity

removeByUUID

void removeByUUID(java.lang.String uuid)
Permanently remove the entity with the UUID supplied.

Parameters:
uuid - the JCR UUID of the entity

exists

boolean exists(java.lang.String path)
Check whether an entity with the path supplied exists in JCR.

Parameters:
path - the path of the entity
Returns:
true if the entity exists, else false

get

T get(java.lang.String path)
Get an entity from JCR by path (from a @JcrPath field).

Parameters:
path - the full path of the entity to be loaded
Returns:
an object instance mapped from the JCR node with the path supplied, or null if no such node was found

get

T get(java.lang.String path,
      java.lang.String childNodeFilter,
      int maxDepth)
Get an entity from JCR by path (from a @JcrPath field).

Parameters:
path - the full path of the entity to be loaded
childNameFilter - comma separated list of names of child nodes to load ("*" loads all, "none" loads no children, and "-" at the beginning makes it an exclusion filter)
maxDepth - the maximum depth of loaded child nodes (0 means no child nodes are loaded, while a negative value means that no restrictions are set on the depth).
Returns:
an object instance mapped from the JCR node with the path supplied, or null if no such node was found

loadByUUID

T loadByUUID(java.lang.String uuid)
Load an entity from JCR by UUID lookup.

Parameters:
uuid - the UUID generated by JCR
Returns:
an object instance mapped from the JCR node with the uuid

loadByUUID

T loadByUUID(java.lang.String uuid,
             java.lang.String childNodeFilter,
             int maxDepth)
Load an entity from JCR by UUID lookup.

Parameters:
uuid - the UUID generated by JCR
Returns:
an object instance mapped from the JCR node with the uuid

getVersionList

java.util.List<T> getVersionList(java.lang.String path)

getVersionList

java.util.List<T> getVersionList(java.lang.String path,
                                 java.lang.String childNameFilter,
                                 int maxDepth)

getVersionList

java.util.List<T> getVersionList(java.lang.String path,
                                 java.lang.String childNameFilter,
                                 int maxDepth,
                                 long startIndex,
                                 long resultSize)

getVersionListByUUID

java.util.List<T> getVersionListByUUID(java.lang.String uuid)

getVersionListByUUID

java.util.List<T> getVersionListByUUID(java.lang.String uuid,
                                       java.lang.String childNameFilter,
                                       int maxDepth)

getVersionListByUUID

java.util.List<T> getVersionListByUUID(java.lang.String uuid,
                                       java.lang.String childNameFilter,
                                       int maxDepth,
                                       long startIndex,
                                       long resultSize)

getVersionSize

long getVersionSize(java.lang.String path)

getVersionSizeByUUID

long getVersionSizeByUUID(java.lang.String uuid)

getVersion

T getVersion(java.lang.String path,
             java.lang.String versionName)

getVersion

T getVersion(java.lang.String path,
             java.lang.String versionName,
             java.lang.String childNodeFilter,
             int maxDepth)

getVersionByUUID

T getVersionByUUID(java.lang.String uuid,
                   java.lang.String versionName)

getVersionByUUID

T getVersionByUUID(java.lang.String uuid,
                   java.lang.String versionName,
                   java.lang.String childNodeFilter,
                   int maxDepth)

restoreVersion

void restoreVersion(java.lang.String path,
                    java.lang.String versionName)

restoreVersionByUUID

void restoreVersionByUUID(java.lang.String uuid,
                          java.lang.String versionName)

restoreVersion

void restoreVersion(java.lang.String path,
                    java.lang.String versionName,
                    boolean removeExisting)

restoreVersionByUUID

void restoreVersionByUUID(java.lang.String uuid,
                          java.lang.String versionName,
                          boolean removeExisting)

removeVersion

void removeVersion(java.lang.String path,
                   java.lang.String versionName)

removeVersionByUUID

void removeVersionByUUID(java.lang.String uuid,
                         java.lang.String versionName)

getSize

long getSize(java.lang.String rootPath)
Get the number of entities.

Returns:
the size of the list returned by findAll()

findAll

java.util.List<T> findAll(java.lang.String rootPath)
Find all entities represented by this DAO.

Returns:
all entities represented by this DAO

findAll

java.util.List<T> findAll(java.lang.String rootPath,
                          long startIndex,
                          long resultSize)
Find all entities represented by this DAO. Takes parameters that control the size and offset of the result.

Parameters:
startIndex - the zero based index of the first item to return
resultSize - the number of items to return
Returns:
all entities represented by this DAO

findAll

java.util.List<T> findAll(java.lang.String rootPath,
                          java.lang.String childNameFilter,
                          int maxDepth)
Find all entities represented by this DAO.

Parameters:
childNameFilter - comma separated list of names of child nodes to load ("*" loads all, "none" loads no children, and "-" at the beginning makes it an exclusion filter)
maxDepth - the maximum depth of loaded child nodes (0 means no child nodes are loaded, while a negative value means that no restrictions are set on the depth).
Returns:
all entities represented by this DAO

findAll

java.util.List<T> findAll(java.lang.String rootPath,
                          java.lang.String childNameFilter,
                          int maxDepth,
                          long startIndex,
                          long resultSize)
Find all entities represented by this DAO. Takes parameters that control the size and offset of the result, and filter which child nodes to load.

Parameters:
childNameFilter - comma separated list of names of child nodes to load ("*" loads all, "none" loads no children, and "-" at the beginning makes it an exclusion filter)
maxDepth - the maximum depth of loaded child nodes (0 means no child nodes are loaded, while a negative value means that no restrictions are set on the depth).
startIndex - the zero based index of the first item to return
resultSize - the number of items to return
Returns:
all entities represented by this DAO


Copyright © 2009. All Rights Reserved.