Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.storage.sql
Interface RowMapper

All Known Subinterfaces:
Mapper
All Known Implementing Classes:
CachingMapper, CachingRowMapper, JDBCMapper, JDBCRowMapper

public interface RowMapper

A RowMapper maps Rows to and from the database.

These are the operations that can benefit from a cache.

See Also:
CachingRowMapper

Nested Class Summary
static class RowMapper.CopyHierarchyResult
           
static class RowMapper.RowBatch
          The description of a set of rows to create, update or delete.
static class RowMapper.RowUpdate
          A Row and a list of its keys that have to be updated.
 
Method Summary
 void clearCache()
          Clears the mapper's cache (if any) Called after a rollback, or a manual clear through RepositoryStatus MBean.
 RowMapper.CopyHierarchyResult copyHierarchy(java.io.Serializable sourceId, java.lang.String typeName, java.io.Serializable destParentId, java.lang.String destName, Row overwriteRow)
          Copies the hierarchy starting from a given row to a new parent with a new name.
 java.util.List<Row> getProxyRows(java.io.Serializable searchId, boolean byTarget, java.io.Serializable parentId)
          Finds proxies, maybe restricted to the children of a given parent.
 java.util.List<Row> getVersionRows(java.io.Serializable versionSeriesId)
          Gets the list of version rows for all the versions in a given version series id.
 java.util.List<? extends RowId> read(java.util.Collection<RowId> rowIds)
          Reads a set of rows for the given RowIds.
 Row readChildHierRow(java.io.Serializable parentId, java.lang.String childName, boolean complexProp)
          Reads the hierarchy row for a child, given its parent id and the child name.
 java.util.List<Row> readChildHierRows(java.io.Serializable parentId, boolean complexProp)
          Reads the hierarchy rows for all the children of parent.
 java.io.Serializable[] readCollectionRowArray(RowId rowId)
          Gets an array for a CollectionFragment from the database, given its table name and id.
 Row readSimpleRow(RowId rowId)
          Gets a row for a SimpleFragment from the database, given its table name and id.
 Invalidations.InvalidationsPair receiveInvalidations()
          Processes and returns the invalidations queued for processing by the cache (if any).
 void rollback(javax.transaction.xa.Xid xid)
          Rollback the XA Resource.
 void sendInvalidations(Invalidations invalidations)
          Post-transaction invalidations notification.
 void write(RowMapper.RowBatch batch)
          Writes a set of rows.
 

Method Detail

read

java.util.List<? extends RowId> read(java.util.Collection<RowId> rowIds)
                                     throws StorageException
Reads a set of rows for the given RowIds.

For each requested row, either a Row is found and returned, or a RowId (not implementing Row) is returned to signify an absent row.

Parameters:
rowIds - the row ids (including their table name)
Returns:
the collection of Rows (or RowIds if the row was absent from the database). Order is not the same as the input rowIds
Throws:
StorageException

write

void write(RowMapper.RowBatch batch)
           throws StorageException
Writes a set of rows. This includes creating, updating and deleting rows.

Parameters:
batch - the set of rows and the operations to do on them
Throws:
StorageException

readSimpleRow

Row readSimpleRow(RowId rowId)
                  throws StorageException
Gets a row for a SimpleFragment from the database, given its table name and id. If the row doesn't exist, null is returned.

Parameters:
rowId - the row id
Returns:
the row, or null
Throws:
StorageException

readCollectionRowArray

java.io.Serializable[] readCollectionRowArray(RowId rowId)
                                              throws StorageException
Gets an array for a CollectionFragment from the database, given its table name and id. If no rows are found, an empty array is returned.

Parameters:
rowId - the row id
Returns:
the array
Throws:
StorageException

readChildHierRow

Row readChildHierRow(java.io.Serializable parentId,
                     java.lang.String childName,
                     boolean complexProp)
                     throws StorageException
Reads the hierarchy row for a child, given its parent id and the child name.

Parameters:
parentId - the parent id
childName - the child name
complexProp - whether to get complex properties (true) or regular children(false)
Returns:
the child hierarchy row, or null
Throws:
StorageException

readChildHierRows

java.util.List<Row> readChildHierRows(java.io.Serializable parentId,
                                      boolean complexProp)
                                      throws StorageException
Reads the hierarchy rows for all the children of parent.

Depending on the boolean complexProp, only the complex properties or only the regular children are returned.

Parameters:
parentId - the parent id
complexProp - whether to get complex properties (true) or regular children(false)
Returns:
the child hierarchy rows
Throws:
StorageException

getVersionRows

java.util.List<Row> getVersionRows(java.io.Serializable versionSeriesId)
                                   throws StorageException
Gets the list of version rows for all the versions in a given version series id.

Parameters:
versionSeriesId - the version series id
Returns:
the list of version rows
Throws:
StorageException

getProxyRows

java.util.List<Row> getProxyRows(java.io.Serializable searchId,
                                 boolean byTarget,
                                 java.io.Serializable parentId)
                                 throws StorageException
Finds proxies, maybe restricted to the children of a given parent.

Parameters:
searchId - the id to look for
byTarget - true if the searchId is a proxy target id, false if the searchId is a version series id
parentId - the parent to which to restrict, if not null
Returns:
the list of proxies rows
Throws:
StorageException

copyHierarchy

RowMapper.CopyHierarchyResult copyHierarchy(java.io.Serializable sourceId,
                                            java.lang.String typeName,
                                            java.io.Serializable destParentId,
                                            java.lang.String destName,
                                            Row overwriteRow)
                                            throws StorageException
Copies the hierarchy starting from a given row to a new parent with a new name.

If the new parent is null, then this is a version creation, which doesn't recurse in regular children.

If overwriteRow is passed, the copy is done onto this existing node as its root (version restore) instead of creating a new node in the parent.

Parameters:
sourceId - the id of row to copy (with children)
typeName - the type of the row to copy (to avoid refetching known info)
destParentId - the new parent id, or null
destName - the new name
overwriteRow - when not null, the copy is done onto this existing row, and the values are set in hierarchy
Returns:
info about the copy
Throws:
StorageException

receiveInvalidations

Invalidations.InvalidationsPair receiveInvalidations()
                                                     throws StorageException
Processes and returns the invalidations queued for processing by the cache (if any).

Called pre-transaction by session start or transactionless save;

Returns:
the invalidations (both for the mapper and the events), or null
Throws:
StorageException

sendInvalidations

void sendInvalidations(Invalidations invalidations)
                       throws StorageException
Post-transaction invalidations notification.

Called post-transaction by session commit/rollback or transactionless save.

Parameters:
invalidations - the known invalidations to send to others, or null
Throws:
StorageException

clearCache

void clearCache()
Clears the mapper's cache (if any)

Called after a rollback, or a manual clear through RepositoryStatus MBean.


rollback

void rollback(javax.transaction.xa.Xid xid)
              throws javax.transaction.xa.XAException
Rollback the XA Resource.

This is in the RowMapper interface because on rollback the cache must be invalidated.

Throws:
javax.transaction.xa.XAException

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.