public class SQLSession extends Object implements Session
| Modifier and Type | Class and Description |
|---|---|
static class |
SQLSession.PathComparator |
| Modifier and Type | Field and Description |
|---|---|
static String |
ALLOW_NEGATIVE_ACL_PROPERTY
Framework property to control whether negative ACLs (deny) are allowed.
|
static String |
COPY_FINDFREENAME_DISABLED_PROP
Framework property to disabled free-name collision detection for copy.
|
protected org.apache.commons.logging.Log |
log |
protected static Pattern |
ORDER_BY_PATH_ASC |
protected static Pattern |
ORDER_BY_PATH_DESC |
| Constructor and Description |
|---|
SQLSession(Session session,
Repository repository) |
| Modifier and Type | Method and Description |
|---|---|
protected static ACP |
aclRowsToACP(ACLRow[] acls) |
protected static ACLRow[] |
acpToAclRows(ACP acp) |
protected static void |
addACLRow(List<ACLRow> aclrows,
String name,
ACE ace) |
protected Document |
addChild(Node parent,
String name,
Long pos,
String typeName) |
protected Node |
addChildProperty(Node parent,
String name,
Long pos,
String typeName) |
protected boolean |
addMixinType(Node node,
String mixin) |
protected Document |
checkIn(Node node,
String label,
String checkinComment) |
protected void |
checkNegativeAcl(ACP acp) |
protected void |
checkOut(Node node) |
void |
close()
Closes this session.
|
Document |
copy(Document source,
Document parent,
String name)
Copies the source document to the given folder.
|
Document |
createProxy(Document doc,
Document folder)
Creates a generic proxy to the given document inside the given folder.
|
protected String |
findFreeName(Node parentNode,
String name) |
protected static String |
getACEkey(ACE ace)
Key to distinguish ACEs
|
protected static String |
getACLrowKey(ACLRow aclrow)
Key to distinguish ACLRows
|
protected ACP |
getACP(Document doc) |
Map<String,String> |
getBinaryFulltext(String id)
Gets the fulltext extracted from the binary fields.
|
protected Document |
getChild(Node node,
String name) |
protected Node |
getChildProperty(Node node,
String name,
String typeName) |
protected Node |
getChildPropertyForWrite(Node node,
String name,
String typeName) |
protected List<Document> |
getChildren(Node node) |
protected List<Node> |
getComplexList(Node node,
String name) |
protected Document |
getDocumentById(Serializable id) |
Document |
getDocumentByUUID(String uuid)
Gets a document given its ID.
|
protected List<Document> |
getDocumentsById(List<Serializable> ids) |
protected ACL |
getInheritedACLs(Document doc) |
Document |
getLastVersion(String versionSeriesId) |
LockManager |
getLockManager()
Gets the lock manager for this session.
|
ACP |
getMergedACP(Document doc) |
protected Node |
getNodeById(Serializable id) |
Document |
getNullDocument()
Gets the null document, to be used as a fake parent to add placeless children.
|
protected Document |
getParent(Node node) |
protected String |
getPath(Node node) |
List<Document> |
getProxies(Document document,
Document parent)
Finds the proxies for a document.
|
String |
getRepositoryName()
Gets the repository that created this session.
|
Document |
getRootDocument()
Gets the root document in this repository.
|
Document |
getVersion(String versionableId,
VersionModel versionModel)
Gets a version of a document, given its versionable id and label.
|
protected Document |
getVersionByLabel(String versionSeriesId,
String label) |
protected List<Document> |
getVersions(String versionSeriesId) |
protected boolean |
hasChild(Node node,
String name) |
protected boolean |
hasChildren(Node node) |
protected Serializable |
idFromString(String id) |
protected String |
idToString(Serializable id) |
protected Document |
importChild(String uuid,
Node parent,
String name,
Long pos,
String typeName,
Map<String,Serializable> props) |
Document |
importDocument(String uuid,
Document parent,
String name,
String typeName,
Map<String,Serializable> properties)
Imports a document with a given id and parent.
|
boolean |
isChangeTokenEnabled() |
boolean |
isLive()
Checks whether the session is alive.
|
boolean |
isNegativeAclAllowed()
Returns
true if negative ACLs are allowed. |
void |
markUserChange(Serializable id) |
Document |
move(Document source,
Document parent,
String name)
Moves the source document to the given folder.
|
protected void |
orderBefore(Node node,
Node src,
Node dest) |
PartialList<Document> |
query(String query,
String queryType,
QueryFilter queryFilter,
long countUpTo)
Does a query.
|
IterableQueryResult |
queryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
boolean distinctDocuments,
Object[] params)
Does a query and fetch the individual results as maps.
|
PartialList<Map<String,Serializable>> |
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 |
remove(Node node) |
protected boolean |
removeMixinType(Node node,
String mixin) |
protected void |
removeProperty(Node node) |
Document |
resolvePath(String path)
Gets the document at the given path, if any.
|
protected void |
restore(Node node,
Node version) |
void |
save()
Saves this session.
|
ScrollResult<String> |
scroll(String scrollId)
Get the next batch of result containing id of documents.
|
ScrollResult<String> |
scroll(String query,
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 |
setACP(Document doc,
ACP acp,
boolean overwrite) |
void |
setProxyTarget(Document proxy,
Document target)
Sets a proxies' target.
|
protected static ACLRow[] |
updateAclRows(ACLRow[] aclrows,
ACP acp) |
void |
updateReadACLs(Collection<String> docIds)
Updates the Read ACLs for some documents.
|
protected final org.apache.commons.logging.Log log
public static final String ALLOW_NEGATIVE_ACL_PROPERTY
public static final String COPY_FINDFREENAME_DISABLED_PROP
protected static final Pattern ORDER_BY_PATH_ASC
protected static final Pattern ORDER_BY_PATH_DESC
public SQLSession(Session session, Repository repository)
public Document getRootDocument()
SessiongetRootDocument in interface Sessionpublic Document getNullDocument()
SessiongetNullDocument in interface Sessionpublic void close()
Sessionpublic boolean isLive()
Sessionpublic String getRepositoryName()
SessiongetRepositoryName in interface Sessionprotected String idToString(Serializable id)
protected Serializable idFromString(String id)
public ScrollResult<String> scroll(String query, int batchSize, int keepAliveSeconds)
Sessionpublic ScrollResult<String> scroll(String scrollId)
Sessionpublic Document getDocumentByUUID(String uuid) throws DocumentNotFoundException
SessiongetDocumentByUUID in interface Sessionuuid - the document idDocumentNotFoundException - if the document doesn't existpublic Document resolvePath(String path) throws DocumentNotFoundException
SessionresolvePath in interface SessionDocumentNotFoundException - if the document doesn't existprotected void orderBefore(Node node, Node src, Node dest)
public Document move(Document source, Document parent, String name)
SessionIf the destination document is not a folder an exception is thrown.
protected String findFreeName(Node parentNode, String name)
public Document copy(Document source, Document parent, String name)
SessionIf the destination document is not a folder, an exception is thrown.
public Document getVersion(String versionableId, VersionModel versionModel)
SessionThe version model contains the label of the version to look for. On return, it is filled with the version's description and creation date.
getVersion in interface SessionversionableId - the versionable idversionModel - the version modelnull if not foundpublic Document createProxy(Document doc, Document folder)
SessioncreateProxy in interface Sessiondoc - the documentfolder - the folderpublic List<Document> getProxies(Document document, Document parent)
SessionIf the document is a version, then only proxies to that version will be looked up.
getProxies in interface Sessiondocument - the document or versionparent - the folder, or nullpublic void setProxyTarget(Document proxy, Document target)
SessionThe target must have the same version series as the proxy.
setProxyTarget in interface Sessionproxy - the proxytarget - the new targetpublic Document importDocument(String uuid, Document parent, String name, String typeName, Map<String,Serializable> properties)
SessionThe document can then be filled with the normal imported properties.
importDocument in interface Sessionuuid - the document uuidparent - the document parent, or null for a versionname - the document name in its parenttypeName - the document type, or ecm: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 various IMPORT_* constants of CoreSession)Document, even for proxies and versionspublic PartialList<Document> query(String query, String queryType, QueryFilter queryFilter, long countUpTo)
Sessionpublic IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object[] params)
SessionqueryAndFetch in interface Sessionpublic PartialList<Map<String,Serializable>> queryProjection(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object[] params)
SessionqueryProjection in interface Sessionprotected Document getDocumentById(Serializable id)
protected List<Document> getDocumentsById(List<Serializable> ids)
protected Document getChild(Node node, String name) throws DocumentNotFoundException
DocumentNotFoundExceptionprotected Node getChildProperty(Node node, String name, String typeName)
protected Node getChildPropertyForWrite(Node node, String name, String typeName)
protected List<Document> getChildren(Node node)
protected boolean hasChildren(Node node)
protected Node addChildProperty(Node parent, String name, Long pos, String typeName)
protected Document importChild(String uuid, Node parent, String name, Long pos, String typeName, Map<String,Serializable> props)
protected boolean addMixinType(Node node, String mixin)
protected boolean removeMixinType(Node node, String mixin)
protected List<Node> getComplexList(Node node, String name)
protected void removeProperty(Node node)
protected Document getVersionByLabel(String versionSeriesId, String label)
protected List<Document> getVersions(String versionSeriesId)
public Document getLastVersion(String versionSeriesId)
protected Node getNodeById(Serializable id)
public LockManager getLockManager()
SessiongetLockManager in interface Sessionpublic boolean isNegativeAclAllowed()
Sessiontrue 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.
isNegativeAclAllowed in interface Sessiontrue if negative ACLs are allowedpublic void updateReadACLs(Collection<String> docIds)
SessionupdateReadACLs in interface SessiondocIds - the document idsprotected void checkNegativeAcl(ACP acp)
public ACP getMergedACP(Document doc)
getMergedACP in interface Sessionprotected static ACP aclRowsToACP(ACLRow[] acls)
protected static ACLRow[] acpToAclRows(ACP acp)
protected static ACLRow[] updateAclRows(ACLRow[] aclrows, ACP acp)
protected static String getACLrowKey(ACLRow aclrow)
protected ACL getInheritedACLs(Document doc)
public Map<String,String> getBinaryFulltext(String id)
SessiongetBinaryFulltext in interface Sessionpublic boolean isChangeTokenEnabled()
public void markUserChange(Serializable id)
Copyright © 2018 Nuxeo. All rights reserved.