Package org.nuxeo.ecm.core.storage.dbs
Class DBSSession
java.lang.Object
org.nuxeo.ecm.core.model.BaseSession
org.nuxeo.ecm.core.storage.dbs.DBSSession
- All Implemented Interfaces:
Session<QueryFilter>
Implementation of a
Session for Document-Based Storage.- Since:
- 5.9.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classstatic classNested classes/interfaces inherited from class org.nuxeo.ecm.core.model.BaseSession
BaseSession.VersionAclMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final booleanprotected static final Patternprotected final booleanprotected final booleanKeys for values that are ids.protected booleanprotected final io.dropwizard.metrics5.MetricRegistryprotected static final Typeprotected final DBSTransactionStateKeys for boolean values that are stored as true or null (never false).Fields inherited from class org.nuxeo.ecm.core.model.BaseSession
disableReadVersionPermission, READ_VERSION_PERM_DISABLED_PROP, repository, VERSION_ACL_DISABLED_PROP, versionAclModeFields inherited from interface org.nuxeo.ecm.core.model.Session
PROP_ALLOW_DELETE_UNDELETABLE_DOCUMENTS, PROP_RETENTION_COMPLIANCE_MODE_ENABLED, PROP_RETENTION_STRICT_MODE_ENABLED, USER_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Serializableprotected voidaddBackProxyId(DBSDocumentState docState, String id) protected DBSDocumentStateaddProxyState(String id, String parentId, String name, Long pos, String targetId, String versionSeriesId) protected Documentprotected voidcheckNotUnder(String parentId, String id, String op) Checks that we don't move/copy under ourselves.protected voidvoidcommit()Commit the transaction.static StringconvToInternal(String name) static StringconvToInternalAce(String name) static StringconvToNXQL(String name) protected StringCopy source under parent, and set its ancestors.Copies the source document to the given folder.protected StringcopyRecurse(String sourceId, String parentId, LinkedList<String> ancestorIds, String name, boolean excludeSpecialChildren, boolean excludeRegularChildren) protected DBSDocumentStatecreateProxy(Document doc, Document folder) Creates a generic proxy to the given document inside the given folder.voiddestroy()Destroys this session.protected voiddoOrderBy(List<Map<String, Serializable>> projections, OrderByClause orderByClause) protected PartialList<String> doQuery(String query, String queryType, QueryFilter queryFilter, int countUpTo) protected PartialList<Map<String, Serializable>> doQueryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, int countUpTo, org.apache.commons.lang3.mutable.Mutable<String> idKeyHolder) voidend()Called just before the transaction is committed or rolled back.protected StringfindFreeName(Document parent, String name) Gets the ACP for the document (without any inheritance).Gets the fulltext extracted from the binary fields.protected DocumentgetChildren(String parentId) getChildrenIds(String parentId) getChildrenIds(String parentId, boolean excludeSpecialChildren, boolean excludeRegularChildren) protected DBSDocumentgetDocument(String id) protected DBSDocumentgetDocument(DBSDocumentState docState) protected DBSDocumentgetDocument(DBSDocumentState docState, boolean readonly) Gets a document given its ID.protected StringgetDocumentIdByPath(String path) getDocuments(List<String> ids) protected DocumentgetLastVersion(String versionSeriesId) Gets the lock manager for this session.protected LonggetNextPos(String parentId) Gets the null document, to be used as a fake parent to add placeless children.protected StringgetPath(Map<String, Serializable> projection) getProxies(Document doc) Finds the proxies for a document.getProxies(Document doc, Document folder) Finds the proxies for a document.Gets the repository that created this session.Gets the root document in this repository.protected Stringstatic TypegetVersion(String versionSeriesId, VersionModel versionModel) Gets a version of a document, given its versionable id and label.protected DBSDocumentStategetVersionByLabel(String versionSeriesId, String label) getVersionsIds(String versionSeriesId) protected booleanprotected booleanhasChildren(String parentId) importDocument(String id, Document parent, String name, String typeName, Map<String, Serializable> properties) Imports a document with a given id and parent.booleanChecks if fulltext extracted from the binary fields is internally stored as a blob.booleanReturnstrueif negative ACLs are allowed.protected booleanisOrderable(String id) protected booleanisOrderByPath(OrderByClause orderByClause) Does an ORDER BY clause include ecm:pathprotected booleankeepWhenRestore(String key) voidmarkUserChange(String id) Marks this document id as belonging to a user change.protected static ACPmemToAcp(String docId, Serializable acpSer) Moves the source document to the given folder.protected Stringprotected voidnotifyDocumentRemove(String docId) protected voidorderBefore(String parentId, String sourceId, String destId) query(String query, String queryType, QueryFilter queryFilter, long countUpTo) Does a query.queryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object[] params) Does a query and fetch the individual results as maps.queryProjection(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object[] params) Does a query and fetch the individual results as maps.protected voidrecomputeVersionSeries(String versionSeriesId) Recomputes isLatest / isLatestMajor on all versions.protected voidremove(String rootId, NuxeoPrincipal principal) Removes a document.protected voidremoveBackProxyId(DBSDocumentState docState, String id) protected voidremoveBackProxyIds(DBSDocumentState docState, Set<String> ids) voidremoveDocument(String id) Removes a document.resolvePath(String path) Gets the document at the given path, if any.protected voidrestoreVersion(Document doc, Document version) voidrollback()Rollback the transaction.voidsave()Saves this session.Get the next batch of result containing id of documents.Executes the given query and returns the first batch of results containing id of documents, next batch must be requested within the keepAliveSeconds delay.scroll(String query, QueryFilter queryFilter, 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.voidvoidsetProxyTarget(Document proxy, Document target) Sets a proxies' target.voidstart()Start the transaction.protected static BooleantrueOrNull(Object value) voidupdateReadACLs(Collection<String> docIds) Updates the Read ACLs for some documents.Methods inherited from class org.nuxeo.ecm.core.model.BaseSession
canDeleteUndeletable, checkNegativeAcl, getACP, getDocumentBlobManager, getMergedACP, isReadVersionPermissionDisabled, isRetentionStricMode, notifyAfterCopy, updateACP
-
Field Details
-
KEYS_RETENTION_HOLD_AND_PROXIES
-
transaction
-
fulltextStoredInBlob
protected final boolean fulltextStoredInBlob -
fulltextSearchDisabled
protected final boolean fulltextSearchDisabled -
changeTokenEnabled
protected final boolean changeTokenEnabled -
registry
protected final io.dropwizard.metrics5.MetricRegistry registry -
isLatestVersionDisabled
protected boolean isLatestVersionDisabled -
dotDigitsPattern
-
STRING_ARRAY_TYPE
-
TRUE_OR_NULL_BOOLEAN_KEYS
Keys for boolean values that are stored as true or null (never false).- Since:
- 11.1
-
ID_VALUES_KEYS
Keys for values that are ids.- Since:
- 11.1
-
-
Constructor Details
-
DBSSession
-
-
Method Details
-
getRepositoryName
Description copied from interface:SessionGets the repository that created this session.- Returns:
- the repository
-
destroy
public void destroy()Description copied from interface:SessionDestroys this session. -
save
public void save()Description copied from interface:SessionSaves this session. -
getRootId
-
normalize
-
resolvePath
Description copied from interface:SessionGets the document at the given path, if any. -
getDocumentIdByPath
-
getChild
-
getChildren
-
getChildrenIds
-
getChildrenIds
-
hasChildren
-
getDocumentByUUID
Description copied from interface:SessionGets a document given its ID.- Parameters:
id- the document id- Returns:
- the document
-
getRootDocument
Description copied from interface:SessionGets the root document in this repository.- Returns:
- the root document
-
getNullDocument
Description copied from interface:SessionGets the null document, to be used as a fake parent to add placeless children.- Returns:
- the null document
-
getDocument
-
getDocuments
-
getDocument
-
getDocument
-
hasChild
-
createChild
-
createChildState
-
isOrderable
-
getNextPos
-
orderBefore
-
checkOut
-
checkIn
-
recomputeVersionSeries
Recomputes isLatest / isLatestMajor on all versions. -
restoreVersion
-
keepWhenRestore
-
copy
Description copied from interface:SessionCopies the source document to the given folder.If the destination document is not a folder, an exception is thrown.
-
copyRecurse
-
copy
Copy source under parent, and set its ancestors. -
findFreeName
-
checkNotUnder
Checks that we don't move/copy under ourselves. -
move
Description copied from interface:SessionMoves the source document to the given folder.If the destination document is not a folder an exception is thrown.
- Parameters:
source- the source document to moveparent- the destination foldername- the new name of the document or null if the original name should be preserved
-
remove
Removes a document.We also have to update everything impacted by "relations":
- parent-child relations: delete all subchildren recursively,
- proxy-target relations: if a proxy is removed, update the target's PROXY_IDS; and if a target is removed, raise an error if a proxy still exists for that target.
-
createProxy
Description copied from interface:SessionCreates a generic proxy to the given document inside the given folder.- Parameters:
doc- the documentfolder- the folder- Returns:
- the proxy
-
addProxyState
-
addBackProxyId
-
removeBackProxyId
-
removeBackProxyIds
-
getProxies
Description copied from interface:SessionFinds the proxies for a document. If the folder is not null, the search will be limited to its children.If the document is a version, then only proxies to that version will be looked up.
- Parameters:
doc- the document or versionfolder- the folder, or null- Returns:
- the list of proxies if any is found otherwise an empty list
-
getProxies
Description copied from interface:SessionFinds the proxies for a document. (The document may be a version or a live document)- Parameters:
doc- the document or version- Returns:
- the list of proxies if any is found otherwise an empty list
-
setProxyTarget
Description copied from interface:SessionSets a proxies' target.The target must have the same version series as the proxy.
- Parameters:
proxy- the proxytarget- the new target
-
importDocument
public Document importDocument(String id, Document parent, String name, String typeName, Map<String, Serializable> properties) Description copied from interface:SessionImports a document with a given id and parent.The document can then be filled with the normal imported properties.
- Parameters:
id- the document uuidparent- the document parent, ornullfor a versionname- the document name in its parenttypeName- the document type, orecm:proxyfor a proxyproperties- system properties of the document, which will vary depending whether it's a live document, a version or a proxy (see the variousIMPORT_*constants ofCoreSession)- Returns:
- a writable
Document, even for proxies and versions
-
trueOrNull
-
getVersion
Description copied from interface:SessionGets a version of a document, given its versionable id and label.The version model contains the label of the version to look for. On return, it is filled with the version's description and creation date.
- Parameters:
versionSeriesId- the versionable idversionModel- the version model- Returns:
- the version, or
nullif not found
-
getVersionByLabel
-
getVersionsIds
-
getLastVersion
-
updateReadACLs
Description copied from interface:SessionUpdates the Read ACLs for some documents.- Parameters:
docIds- the document ids
-
isNegativeAclAllowed
public boolean isNegativeAclAllowed()Description copied from interface:SessionReturnstrueif negative ACLs are allowed.Negative ACLs are ACLs that include an ACE with a deny (isGranted=false). This does not include the full-blocking ACE for Everyone/Everything, which is always allowed.
- Returns:
trueif negative ACLs are allowed
-
getACP
Description copied from class:BaseSessionGets the ACP for the document (without any inheritance).- Specified by:
getACPin classBaseSession- Parameters:
doc- the document- Returns:
- the ACP
-
setACP
-
acpToMem
-
memToAcp
-
isFulltextStoredInBlob
public boolean isFulltextStoredInBlob()Description copied from interface:SessionChecks if fulltext extracted from the binary fields is internally stored as a blob.- Returns:
trueif fulltext from binaries is store as a blob
-
getBinaryFulltext
Description copied from interface:SessionGets the fulltext extracted from the binary fields. -
removeDocument
Description copied from interface:SessionRemoves a document. In DBS, this removal is done without checking if proxies are targeting the document, or if it has any children.- Parameters:
id- the document id
-
notifyDocumentRemove
-
query
public PartialList<Document> query(String query, String queryType, QueryFilter queryFilter, long countUpTo) Description copied from interface:SessionDoes a query. -
doQuery
protected PartialList<String> doQuery(String query, String queryType, QueryFilter queryFilter, int countUpTo) -
doQueryAndFetch
protected PartialList<Map<String,Serializable>> doQueryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, int countUpTo, org.apache.commons.lang3.mutable.Mutable<String> idKeyHolder) -
isOrderByPath
Does an ORDER BY clause include ecm:path -
getPath
-
doOrderBy
-
queryAndFetch
public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object[] params) Description copied from interface:SessionDoes a query and fetch the individual results as maps. -
queryProjection
public PartialList<Map<String,Serializable>> queryProjection(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object[] params) Description copied from interface:SessionDoes a query and fetch the individual results as maps. -
scroll
Description copied from interface:SessionExecutes the given query and returns the first batch of results containing id of documents, next batch must be requested within the keepAliveSeconds delay. -
scroll
public ScrollResult<String> scroll(String query, QueryFilter queryFilter, int batchSize, int keepAliveSeconds) Description copied from interface:SessionExecutes the given query and returns the first batch of results containing id of documents, next batch must be requested within the keepAliveSeconds delay. -
scroll
Description copied from interface:SessionGet the next batch of result containing id of documents. -
convToInternal
-
convToInternalAce
-
convToNXQL
-
getType
-
getLockManager
Description copied from interface:SessionGets the lock manager for this session.- Returns:
- the lock manager
-
markUserChange
Marks this document id as belonging to a user change.- Since:
- 9.2
-
start
public void start()Description copied from interface:SessionStart the transaction. -
end
public void end()Description copied from interface:SessionCalled just before the transaction is committed or rolled back. -
commit
public void commit()Description copied from interface:SessionCommit the transaction. -
rollback
public void rollback()Description copied from interface:SessionRollback the transaction.
-