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<RowMapper.NodeInfo> |
getDescendantsInfo(Serializable rootId)
Gets descendants infos from a given root node.
|
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.
|
Set<Serializable> |
readSelectionsIds(SelectionType selType,
List<Serializable> values)
Gets all the selection ids for a given list of values.
|
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).
|
void |
remove(Serializable rootId,
List<RowMapper.NodeInfo> nodeInfos)
Deletes a hierarchy.
|
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()
List<? extends RowId> read(Collection<RowId> rowIds, boolean cacheOnly)
void write(RowMapper.RowBatch batch)
batch
- the set of rows and the operations to do on themRow readSimpleRow(RowId rowId)
SimpleFragment
from the database, given its table name and id. If the row doesn't exist,
null
is returned.rowId
- the row idnull
Map<String,String> getBinaryFulltext(RowId rowId)
rowId
- the row idnull
if unsupportedSerializable[] readCollectionRowArray(RowId rowId)
CollectionFragment
from the database, given its table name and id. If no rows are
found, an empty array is returned.rowId
- the row idList<Row> readSelectionRows(SelectionType selType, Serializable selId, Serializable filter, Serializable criterion, boolean limitToOne)
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 retrievedSet<Serializable> readSelectionsIds(SelectionType selType, List<Serializable> values)
RowMapper.CopyResult copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow)
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
hierarchyList<RowMapper.NodeInfo> getDescendantsInfo(Serializable rootId)
rootId
- the root node id from which to get descendants infovoid remove(Serializable rootId, List<RowMapper.NodeInfo> nodeInfos)
rootId
- the id of the root node to be deleted with its childrennodeInfos
- the information about all descendants being deleted along the root nodeInvalidations receiveInvalidations()
Called pre-transaction by session start or transactionless save;
null
void sendInvalidations(Invalidations invalidations)
Called post-transaction by session commit/rollback or transactionless save.
invalidations
- the known invalidations to send to others, or null
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 © 2017 Nuxeo. All rights reserved.