public interface DBSRepository extends Repository, LockManager
Repository
for Document-Based Storage.Modifier and Type | Method and Description |
---|---|
default void |
begin()
Called when created a transaction.
|
default void |
commit()
Saves and flushes to database.
|
void |
createState(State state)
Creates a document.
|
default void |
createStates(List<State> states)
Creates documents.
|
void |
deleteStates(Set<String> ids)
Deletes a set of document.
|
String |
generateNewId()
Generates a new id for a document.
|
BlobManager |
getBlobManager()
Gets the blob manager.
|
Stream<State> |
getDescendants(String id,
Set<String> keys)
Returns a stream of descendants from a given root document, in no particular order.
|
default Stream<State> |
getDescendants(String id,
Set<String> keys,
int limit)
Returns a stream of descendants from a given root document, in no particular order.
|
FulltextConfiguration |
getFulltextConfiguration()
Gets the fulltext configuration.
|
LockManager |
getLockManager()
Gets the lock manager for this repository.
|
String |
getRootId()
Gets the root id.
|
boolean |
hasChild(String parentId,
String name,
Set<String> ignored)
Checks if a document has a child with the given name
|
boolean |
isChangeTokenEnabled()
Checks if database-managed document change tokens are enabled.
|
boolean |
isFulltextDisabled()
Checks if fulltext indexing is disabled.
|
PartialList<Map<String,Serializable>> |
queryAndFetch(DBSExpressionEvaluator evaluator,
OrderByClause orderByClause,
boolean distinctDocuments,
int limit,
int offset,
int countUpTo)
Queries the repository for documents matching a NXQL query, and returns a projection of the documents.
|
List<State> |
queryKeyValue(String key,
Object value,
Set<String> ignored)
Queries the repository for documents having key = value.
|
List<State> |
queryKeyValue(String key1,
Object value1,
String key2,
Object value2,
Set<String> ignored)
Queries the repository for documents having key1 = value1 and key2 = value2.
|
boolean |
queryKeyValuePresence(String key,
String value,
Set<String> ignored)
Queries the repository to check if there are documents having key = value.
|
State |
readChildState(String parentId,
String name,
Set<String> ignored)
Reads the state of a child document.
|
default State |
readPartialState(String id,
Collection<String> keys)
Reads the partial state of a document.
|
State |
readState(String id)
Reads the state of a document.
|
List<State> |
readStates(List<String> ids)
Reads the states of several documents.
|
default void |
rollback()
Rolls back the save state by applying the undo log.
|
ScrollResult<String> |
scroll(DBSExpressionEvaluator evaluator,
int batchSize,
int keepAliveSeconds)
Executes the given query and returns the first batch of results containing id of documents, next batch must be
requested within the
keepAliveSeconds delay. |
ScrollResult<String> |
scroll(String scrollId)
Get the next batch of results containing id of documents, the
scrollId is part of the previous
ScrollResult response. |
void |
updateState(String id,
State.StateDiff diff,
DBSTransactionState.ChangeTokenUpdater changeTokenUpdater)
Updates a document.
|
getActiveSessionsCount, getName, getSession, markReferencedBinaries, shutdown
canLockBeRemoved, clearLockManagerCaches, closeLockManager, getLock, removeLock, setLock
BlobManager getBlobManager()
FulltextConfiguration getFulltextConfiguration()
boolean isFulltextDisabled()
true
if fulltext indexing is disabled, false
if it is enabledboolean isChangeTokenEnabled()
true
if the database maintains document change tokensString generateNewId()
State readState(String id)
id
- the document idnull
if not founddefault State readPartialState(String id, Collection<String> keys)
id
- the document idkeys
- the keys to readnull
if not foundList<State> readStates(List<String> ids)
The returned states may be in a different order than the ids.
ids
- the document idsnull
if not foundvoid createState(State state)
state
- the document statedefault void createStates(List<State> states)
states
- the document statesvoid updateState(String id, State.StateDiff diff, DBSTransactionState.ChangeTokenUpdater changeTokenUpdater)
id
- the document iddiff
- the diff to applychangeTokenUpdater
- how to get and update the change token (may be null
)void deleteStates(Set<String> ids)
ids
- the document idsState readChildState(String parentId, String name, Set<String> ignored)
parentId
- the parent document idname
- the name of the childignored
- a set of document ids that should not be considerednull
if not foundboolean hasChild(String parentId, String name, Set<String> ignored)
parentId
- the parent document idname
- the name of the childignored
- a set of document ids that should not be consideredtrue
if the child exists, false
if notList<State> queryKeyValue(String key, Object value, Set<String> ignored)
key
- the keyvalue
- the valueignored
- a set of document ids that should not be consideredList<State> queryKeyValue(String key1, Object value1, String key2, Object value2, Set<String> ignored)
key1
- the first keyvalue1
- the first valuekey2
- the second keyvalue2
- the second valueignored
- a set of document ids that should not be consideredStream<State> getDescendants(String id, Set<String> keys)
THE STREAM MUST BE CLOSED WHEN DONE to release resources.
id
- the root document idkeys
- what to collect about the descendants in addition to their idsState
s; THE STREAM MUST BE CLOSED WHEN DONEdefault Stream<State> getDescendants(String id, Set<String> keys, int limit)
THE STREAM MUST BE CLOSED WHEN DONE to release resources.
id
- the root document idkeys
- what to collect about the descendants in addition to their idslimit
- the maximum number of descendants to returnState
s; THE STREAM MUST BE CLOSED WHEN DONEboolean queryKeyValuePresence(String key, String value, Set<String> ignored)
key
- the keyvalue
- the valueignored
- a set of document ids that should not be consideredtrue
if the query matches at least one document, false
if the query matches nothingPartialList<Map<String,Serializable>> queryAndFetch(DBSExpressionEvaluator evaluator, OrderByClause orderByClause, boolean distinctDocuments, int limit, int offset, int countUpTo)
evaluator
- the map-based evaluator for the queryorderByClause
- an ORDER BY clausedistinctDocuments
- true
if the projection should return a maximum of one row per documentlimit
- the limit on the number of documents to returnoffset
- the offset in the list of documents to returncountUpTo
- if -1
, count the total size without offset/limit.0
, don't count the total size, set it to -1
.n
, count the total number if there are less than n documents otherwise set the total size
to -2
.LockManager getLockManager()
ScrollResult<String> scroll(DBSExpressionEvaluator evaluator, int batchSize, int keepAliveSeconds)
keepAliveSeconds
delay.ScrollResult<String> scroll(String scrollId)
scrollId
is part of the previous
ScrollResult
response.default void begin()
default void commit()
default void rollback()
Copyright © 2018 Nuxeo. All rights reserved.