Class SQLSession
java.lang.Object
org.nuxeo.ecm.core.model.BaseSession
org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession
- All Implemented Interfaces:
Session<QueryFilter>
This class is the bridge between the Nuxeo SPI Session and the actual low-level implementation of the SQL storage
session.
- Author:
- Florent Guillaume
-
Nested Class Summary
Nested classes/interfaces inherited from class org.nuxeo.ecm.core.model.BaseSession
BaseSession.VersionAclMode
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Framework property to control whether negative ACLs (deny) are allowed.static final String
Framework property to disabled free-name collision detection for copy.protected static final Pattern
protected static final Pattern
Fields inherited from class org.nuxeo.ecm.core.model.BaseSession
disableReadVersionPermission, READ_VERSION_PERM_DISABLED_PROP, repository, VERSION_ACL_DISABLED_PROP, versionAclMode
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionprotected static ACP
aclRowsToACP
(ACLRow[] acls) protected static ACLRow[]
acpToAclRows
(ACP acp) protected static void
protected Document
protected Node
addChildProperty
(Node parent, String name, Long pos, String typeName) protected boolean
addMixinType
(Node node, String mixin) protected Document
protected void
void
commit()
Commit the transaction.Copies the source document to the given folder.createProxy
(Document doc, Document folder) Creates a generic proxy to the given document inside the given folder.void
destroy()
Destroys this session.void
end()
Called just before the transaction is committed or rolled back.protected String
findFreeName
(Node parentNode, String name) protected static String
Key to distinguish ACEsprotected static String
getACLrowKey
(ACLRow aclrow) Key to distinguish ACLRowsGets the ACP for the document (without any inheritance).Gets the fulltext extracted from the binary fields.protected Document
protected Node
getChildProperty
(Node node, String name, String typeName) protected Node
getChildPropertyForWrite
(Node node, String name, String typeName) getChildren
(Node node) getComplexList
(Node node, String name) protected Document
getDocumentByUUID
(String uuid) Gets a document given its ID.getDocumentsById
(List<Serializable> ids) getLastVersion
(String versionSeriesId) Gets the lock manager for this session.protected Node
Gets the null document, to be used as a fake parent to add placeless children.protected Document
protected String
getProxies
(Document doc) Finds the proxies for a document.getProxies
(Document document, Document parent) Finds the proxies for a document.Gets the repository that created this session.Gets the root document in this repository.getVersion
(String versionableId, VersionModel versionModel) Gets a version of a document, given its versionable id and label.protected Document
getVersionByLabel
(String versionSeriesId, String label) getVersions
(String versionSeriesId) protected boolean
protected boolean
hasChildren
(Node node) protected Serializable
idFromString
(String id) protected String
protected Document
importChild
(String uuid, Node parent, String name, Long pos, String typeName, Map<String, Serializable> props) importDocument
(String uuid, Document parent, String name, String typeName, Map<String, Serializable> properties) Imports a document with a given id and parent.boolean
boolean
Checks if fulltext extracted from the binary fields is internally stored as a blob.boolean
Returnstrue
if negative ACLs are allowed.void
Moves the source document to the given folder.protected void
protected void
protected void
notifyDocumentRemove
(Node node) protected void
orderBefore
(Node node, Node src, Node dest) 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 void
void
removeDocument
(String id) Removes a document.protected boolean
removeMixinType
(Node node, String mixin) protected void
removeProperty
(Node node) resolvePath
(String path) Gets the document at the given path, if any.protected void
void
rollback()
Rollback the transaction.void
save()
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.void
void
setProxyTarget
(Document proxy, Document target) Sets a proxies' target.void
start()
Start the transaction.protected static ACLRow[]
updateAclRows
(ACLRow[] aclrows, ACP acp) void
updateReadACLs
(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
-
ALLOW_NEGATIVE_ACL_PROPERTY
Framework property to control whether negative ACLs (deny) are allowed.- Since:
- 6.0
- See Also:
-
COPY_FINDFREENAME_DISABLED_PROP
Framework property to disabled free-name collision detection for copy. This is useful when constraints have been added to the database to detect collisions at the database level and raise a ConcurrentUpdateException, thus letting the high-level application deal with collisions.- Since:
- 7.3
- See Also:
-
ORDER_BY_PATH_ASC
-
ORDER_BY_PATH_DESC
-
-
Constructor Details
-
SQLSession
-
-
Method Details
-
getRootDocument
Description copied from interface:Session
Gets the root document in this repository.- Returns:
- the root document
-
getNullDocument
Description copied from interface:Session
Gets the null document, to be used as a fake parent to add placeless children.- Returns:
- the null document
-
destroy
public void destroy()Description copied from interface:Session
Destroys this session. -
save
public void save()Description copied from interface:Session
Saves this session. -
getRepositoryName
Description copied from interface:Session
Gets the repository that created this session.- Returns:
- the repository
-
idToString
-
idFromString
-
scroll
Description copied from interface:Session
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
public ScrollResult<String> scroll(String query, QueryFilter queryFilter, int batchSize, int keepAliveSeconds) Description copied from interface:Session
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
Description copied from interface:Session
Get the next batch of result containing id of documents. -
getDocumentByUUID
Description copied from interface:Session
Gets a document given its ID.- Parameters:
uuid
- the document id- Returns:
- the document
- Throws:
DocumentNotFoundException
- if the document doesn't exist
-
resolvePath
Description copied from interface:Session
Gets the document at the given path, if any.- Throws:
DocumentNotFoundException
- if the document doesn't exist
-
orderBefore
-
move
Description copied from interface:Session
Moves 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
-
findFreeName
-
copy
Description copied from interface:Session
Copies the source document to the given folder.If the destination document is not a folder, an exception is thrown.
-
notifyDocumentBlobManagerAfterCopy
-
getVersion
Description copied from interface:Session
Gets 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:
versionableId
- the versionable idversionModel
- the version model- Returns:
- the version, or
null
if not found
-
createProxy
Description copied from interface:Session
Creates a generic proxy to the given document inside the given folder.- Parameters:
doc
- the documentfolder
- the folder- Returns:
- the proxy
-
getProxies
Description copied from interface:Session
Finds 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:
document
- the document or versionparent
- the folder, or null- Returns:
- the list of proxies if any is found otherwise an empty list
-
getProxies
Description copied from interface:Session
Finds 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:Session
Sets 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 uuid, Document parent, String name, String typeName, Map<String, Serializable> properties) Description copied from interface:Session
Imports a document with a given id and parent.The document can then be filled with the normal imported properties.
- Parameters:
uuid
- the document uuidparent
- the document parent, ornull
for a versionname
- the document name in its parenttypeName
- the document type, orecm:proxy
for 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
-
query
public PartialList<Document> query(String query, String queryType, QueryFilter queryFilter, long countUpTo) Description copied from interface:Session
Does a query. -
queryAndFetch
public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object[] params) Description copied from interface:Session
Does 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:Session
Does a query and fetch the individual results as maps. -
getDocumentById
-
getDocumentsById
-
getParent
-
getPath
-
getChild
- Throws:
DocumentNotFoundException
-
getChildProperty
-
getChildPropertyForWrite
-
getChildren
-
hasChild
-
hasChildren
-
addChild
-
addChildProperty
-
importChild
-
addMixinType
-
removeMixinType
-
getComplexList
-
remove
-
notifyDocumentRemove
-
notifyDocumentBlobManagerBeforeRemove
-
removeProperty
-
checkIn
-
checkOut
-
restore
-
getVersionByLabel
-
getVersions
-
getLastVersion
-
getNodeById
-
getLockManager
Description copied from interface:Session
Gets the lock manager for this session.- Returns:
- the lock manager
-
isNegativeAclAllowed
public boolean isNegativeAclAllowed()Description copied from interface:Session
Returnstrue
if 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:
true
if negative ACLs are allowed
-
updateReadACLs
Description copied from interface:Session
Updates the Read ACLs for some documents.- Parameters:
docIds
- the document ids
-
setACP
-
getACP
Description copied from class:BaseSession
Gets the ACP for the document (without any inheritance).- Specified by:
getACP
in classBaseSession
- Parameters:
doc
- the document- Returns:
- the ACP
-
aclRowsToACP
-
acpToAclRows
-
updateAclRows
-
getACEkey
Key to distinguish ACEs -
getACLrowKey
Key to distinguish ACLRows -
addACLRow
-
isFulltextStoredInBlob
public boolean isFulltextStoredInBlob()Description copied from interface:Session
Checks if fulltext extracted from the binary fields is internally stored as a blob.- Returns:
true
if fulltext from binaries is store as a blob
-
getBinaryFulltext
Description copied from interface:Session
Gets the fulltext extracted from the binary fields. -
removeDocument
Description copied from interface:Session
Removes 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
-
isChangeTokenEnabled
public boolean isChangeTokenEnabled() -
markUserChange
-
start
public void start()Description copied from interface:Session
Start the transaction. -
end
public void end()Description copied from interface:Session
Called just before the transaction is committed or rolled back. -
commit
public void commit()Description copied from interface:Session
Commit the transaction. -
rollback
public void rollback()Description copied from interface:Session
Rollback the transaction.
-