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 |
isLive()
Checks whether the session is alive.
|
boolean |
isNegativeAclAllowed()
Returns
true if negative ACLs are allowed. |
boolean |
isStateSharedByAllThreadSessions()
Returns
true if all sessions in the current thread share the same state. |
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,
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.
|
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) |
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()
Session
getRootDocument
in interface Session
public Document getNullDocument()
Session
getNullDocument
in interface Session
public void close()
Session
public boolean isLive()
Session
public boolean isStateSharedByAllThreadSessions()
Session
true
if all sessions in the current thread share the same state.isStateSharedByAllThreadSessions
in interface Session
public String getRepositoryName()
Session
getRepositoryName
in interface Session
protected String idToString(Serializable id)
protected Serializable idFromString(String id)
public Document getDocumentByUUID(String uuid) throws DocumentNotFoundException
Session
getDocumentByUUID
in interface Session
uuid
- the document idDocumentNotFoundException
- if the document doesn't existpublic Document resolvePath(String path) throws DocumentNotFoundException
Session
resolvePath
in interface Session
DocumentNotFoundException
- if the document doesn't existprotected void orderBefore(Node node, Node src, Node dest)
public Document move(Document source, Document parent, String name)
Session
If 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)
Session
If the destination document is not a folder, an exception is thrown.
public Document getVersion(String versionableId, VersionModel versionModel)
Session
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.
getVersion
in interface Session
versionableId
- the versionable idversionModel
- the version modelnull
if not foundpublic Document createProxy(Document doc, Document folder)
Session
createProxy
in interface Session
doc
- the documentfolder
- the folderpublic List<Document> getProxies(Document document, Document parent)
Session
If the document is a version, then only proxies to that version will be looked up.
getProxies
in interface Session
document
- the document or versionparent
- the folder, or nullpublic void setProxyTarget(Document proxy, Document target)
Session
The target must have the same version series as the proxy.
setProxyTarget
in interface Session
proxy
- the proxytarget
- the new targetpublic Document importDocument(String uuid, Document parent, String name, String typeName, Map<String,Serializable> properties)
Session
The document can then be filled with the normal imported properties.
importDocument
in interface Session
uuid
- 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)
Session
public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, Object[] params)
Session
queryAndFetch
in interface Session
protected Document getDocumentById(Serializable id)
protected List<Document> getDocumentsById(List<Serializable> ids)
protected Document getChild(Node node, String name) throws DocumentNotFoundException
DocumentNotFoundException
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 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()
Session
getLockManager
in interface Session
public boolean isNegativeAclAllowed()
Session
true
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 Session
true
if negative ACLs are allowedprotected void checkNegativeAcl(ACP acp)
public ACP getMergedACP(Document doc)
getMergedACP
in interface Session
protected 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)
Session
getBinaryFulltext
in interface Session
Copyright © 2015 Nuxeo SA. All rights reserved.