Interface RowMapper
-
- All Known Subinterfaces:
CachingMapper
,Mapper
- All Known Implementing Classes:
JDBCMapper
,JDBCRowMapper
,SoftRefCachingMapper
,SoftRefCachingRowMapper
,UnifiedCachingMapper
,UnifiedCachingRowMapper
public interface RowMapper
ARowMapper
mapsRow
s to and from the database.These are the operations that can benefit from a cache.
- See Also:
SoftRefCachingRowMapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface 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
ARow
and a list of its keys that have to be updated.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
clearCache()
Clears the mapper's cache (if any)default RowMapper.CopyResult
copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow, boolean excludeSpecialChildren)
Deprecated.since 11.3, use other signature insteadRowMapper.CopyResult
copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow, boolean excludeSpecialChildren, boolean excludeACL)
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 sizeList<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 givenRowId
s.Serializable[]
readCollectionRowArray(RowId rowId)
Gets an array for aCollectionFragment
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 aSimpleFragment
from the database, given its table name and id.VCSInvalidations
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()
Rollback the transaction.void
sendInvalidations(VCSInvalidations invalidations)
Post-transaction invalidations notification.void
write(RowMapper.RowBatch batch)
Writes a set of rows.
-
-
-
Method Detail
-
generateNewId
Serializable generateNewId()
Computes a new unique id.- Returns:
- a new unique id
-
read
List<? extends RowId> read(Collection<RowId> rowIds, boolean cacheOnly)
-
write
void write(RowMapper.RowBatch batch)
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
-
readSimpleRow
Row readSimpleRow(RowId rowId)
Gets a row for aSimpleFragment
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
-
getBinaryFulltext
Map<String,String> getBinaryFulltext(RowId rowId)
Gets the fulltext extracted from the binary fields.- Parameters:
rowId
- the row id- Returns:
- the fulltext string representation or
null
if unsupported - Since:
- 5.9.3
-
readCollectionRowArray
Serializable[] readCollectionRowArray(RowId rowId)
Gets an array for aCollectionFragment
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
-
readSelectionRows
List<Row> readSelectionRows(SelectionType selType, Serializable selId, Serializable filter, Serializable criterion, boolean limitToOne)
Reads the rows corresponding to a selection.- Parameters:
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 retrieved- Returns:
- the list of rows
-
readSelectionsIds
Set<Serializable> readSelectionsIds(SelectionType selType, List<Serializable> values)
Gets all the selection ids for a given list of values.- Since:
- 9.2
-
copy
@Deprecated default RowMapper.CopyResult copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow, boolean excludeSpecialChildren)
Deprecated.since 11.3, use other signature insteadCopies 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:
source
- the id, primary type and mixin types of the row to copydestParentId
- the new parent id, ornull
destName
- the new nameoverwriteRow
- when notnull
, the copy is done onto this existing row, and the values are set in hierarchyexcludeSpecialChildren
- the flag to exclude special children from copy- Returns:
- info about the copy
-
copy
RowMapper.CopyResult copy(RowMapper.IdWithTypes source, Serializable destParentId, String destName, Row overwriteRow, boolean excludeSpecialChildren, boolean excludeACL)
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:
source
- the id, primary type and mixin types of the row to copydestParentId
- the new parent id, ornull
destName
- the new nameoverwriteRow
- when notnull
, the copy is done onto this existing row, and the values are set in hierarchyexcludeSpecialChildren
- the flag to exclude special children from copyexcludeACL
- the flag to exclude ACL from copy- Returns:
- info about the copy
- Since:
- 11.3
-
getDescendantsInfo
List<RowMapper.NodeInfo> getDescendantsInfo(Serializable rootId)
Gets descendants infos from a given root node. This does not include information about the root node itself.- Parameters:
rootId
- the root node id from which to get descendants info- Returns:
- the list of descendant nodes info
- Since:
- 9.2
-
remove
void remove(Serializable rootId, List<RowMapper.NodeInfo> nodeInfos)
Deletes a hierarchy.- Parameters:
rootId
- the id of the root node to be deleted with its childrennodeInfos
- the information about all descendants being deleted along the root node- Since:
- 9.2
-
receiveInvalidations
VCSInvalidations receiveInvalidations()
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, or
null
-
sendInvalidations
void sendInvalidations(VCSInvalidations invalidations)
Post-transaction invalidations notification.Called post-transaction by session commit/rollback or transactionless save.
- Parameters:
invalidations
- the known invalidations to send to others, ornull
-
clearCache
void clearCache()
Clears the mapper's cache (if any)Called after a rollback, or a manual clear through RepositoryStatus MBean.
-
getCacheSize
long getCacheSize()
Evaluate the cached elements size- Since:
- 5.7.2
-
rollback
void rollback()
Rollback the transaction.This is in the
RowMapper
interface because on rollback the cache must be invalidated.
-
-