public interface RowMapper
RowMapper
maps Row
s to and from the database.
These are the operations that can benefit from a cache.
SoftRefCachingRowMapper
Modifier and Type | Interface and Description |
---|---|
static class |
RowMapper.CopyResult |
static class |
RowMapper.IdWithTypes
A document id and its primary type and mixin types.
|
static class |
RowMapper.NodeInfo
A document id, parent id and primary type, along with the version and proxy information (the potentially impacted
selections).
|
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. |
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clears the mapper's cache (if any)
|
RowMapper.CopyResult |
copy(RowMapper.IdWithTypes source,
Serializable destParentId,
String destName,
Row overwriteRow)
Copies the hierarchy starting from a given row to a new parent with a new name.
|
Serializable |
generateNewId()
Computes a new unique id.
|
Map<String,String> |
getBinaryFulltext(RowId rowId)
Gets the fulltext extracted from the binary fields.
|
long |
getCacheSize()
Evaluate the cached elements size
|
List<? extends RowId> |
read(Collection<RowId> rowIds,
boolean cacheOnly)
Reads a set of rows for the given
RowId s. |
Serializable[] |
readCollectionRowArray(RowId rowId)
Gets an array for a
CollectionFragment from the database, given its table name and id. |
List<Row> |
readSelectionRows(SelectionType selType,
Serializable selId,
Serializable filter,
Serializable criterion,
boolean limitToOne)
Reads the rows corresponding to a selection.
|
Row |
readSimpleRow(RowId rowId)
Gets a row for a
SimpleFragment from the database, given its table name and id. |
Invalidations |
receiveInvalidations()
Processes and returns the invalidations queued for processing by the cache (if any).
|
List<RowMapper.NodeInfo> |
remove(RowMapper.NodeInfo rootInfo)
Deletes a hierarchy and returns information to generate invalidations.
|
void |
rollback(Xid xid)
Rollback the XA Resource.
|
void |
sendInvalidations(Invalidations invalidations)
Post-transaction invalidations notification.
|
void |
write(RowMapper.RowBatch batch)
Writes a set of rows.
|
Serializable generateNewId() throws StorageException
StorageException
List<? extends RowId> read(Collection<RowId> rowIds, boolean cacheOnly) throws StorageException
RowId
s.
For each requested row, either a Row
is found and returned, or a RowId
(not implementing
Row
) is returned to signify an absent row.
rowIds
- the row ids (including their table name)cacheOnly
- if true
, only hit memoryRow
s (or RowId
s if the row was absent from the database). Order is not
the same as the input rowIds
StorageException
void write(RowMapper.RowBatch batch) throws StorageException
batch
- the set of rows and the operations to do on themStorageException
Row readSimpleRow(RowId rowId) throws StorageException
SimpleFragment
from the database, given its table name and id. If the row doesn't exist,
null
is returned.rowId
- the row idnull
StorageException
Map<String,String> getBinaryFulltext(RowId rowId) throws StorageException
rowId
- the row idnull
if unsupportedStorageException
Serializable[] readCollectionRowArray(RowId rowId) throws StorageException
CollectionFragment
from the database, given its table name and id. If no rows are
found, an empty array is returned.rowId
- the row idStorageException
List<Row> readSelectionRows(SelectionType selType, Serializable selId, Serializable filter, Serializable criterion, boolean limitToOne) throws StorageException
selType
- the selection typeselId
- the selection id (parent id for a hierarchy selection)filter
- the filter value (name for a hierarchy selection)criterion
- an optional additional criterion depending on the selection type (complex prop flag for a
hierarchy selection)limitToOne
- whether to stop after one row retrievedStorageException
RowMapper.CopyResult copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow) throws StorageException
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.
source
- the id, primary type and mixin types of the row to copydestParentId
- the new parent id, or null
destName
- the new nameoverwriteRow
- when not null
, the copy is done onto this existing row, and the values are set in
hierarchyStorageException
List<RowMapper.NodeInfo> remove(RowMapper.NodeInfo rootInfo) throws StorageException
rootInfo
- info about the root to be deleted with its children (root id, and the rest is for invalidations)StorageException
Invalidations receiveInvalidations() throws StorageException
Called pre-transaction by session start or transactionless save;
null
StorageException
void sendInvalidations(Invalidations invalidations) throws StorageException
Called post-transaction by session commit/rollback or transactionless save.
invalidations
- the known invalidations to send to others, or null
StorageException
void clearCache()
Called after a rollback, or a manual clear through RepositoryStatus MBean.
long getCacheSize()
void rollback(Xid xid) throws XAException
This is in the RowMapper
interface because on rollback the cache must be invalidated.
XAException
Copyright © 2015 Nuxeo SA. All rights reserved.