Constructor and Description |
---|
SQLSession(Session session,
Repository repository,
Map<String,Serializable> context) |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels changes done in this session.
|
void |
close()
Closes this session and saves changes on the workspace, if any.
|
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.
|
Document |
createProxyForVersion(Document parent,
Document document,
String label)
Creates a proxy to the given version of the given document inside the
given parent.
|
Query |
createQuery(String query,
Query.Type qType,
String... params)
Creates a query object given a SQL like query string.
|
Query |
createQuery(String query,
String queryType,
String... params)
Creates a query object given a SQL like query string.
|
void |
dispose()
Closes the session and cancel changes on workspace, if any.
|
InputStream |
getDataStream(String key)
Gets a blob stream using the given key.
|
Document |
getDocumentByUUID(String uuid)
Gets a document given its ID.
|
Document |
getLastVersion(Serializable versionSeriesId) |
Document |
getNullDocument()
Gets the null document, to be used as a fake parent to add placeless
children.
|
Collection<Document> |
getProxies(Document document,
Document parent)
Finds the proxies for a document.
|
Repository |
getRepository()
Gets the repository that created this session.
|
Document |
getRootDocument()
Gets the root document in this repository.
|
SecurityManager |
getSecurityManager()
Gets the security manager used by the repository.
|
Map<String,Serializable> |
getSessionContext()
Gets the session context used to create this session.
|
long |
getSessionId()
Gets the session id.
|
SchemaManager |
getTypeManager()
Gets the type manager used by the repository.
|
String |
getUserSessionId()
The unique ID of the user session on this repository.
|
Document |
getVersion(String versionableId,
VersionModel versionModel)
Gets a version of a document, given its versionable id and label.
|
XAResource |
getXAResource()
The XAResource corresponding to this session.
|
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.
|
Document |
move(Document source,
Document parent,
String name)
Moves the source document to the given folder.
|
IterableQueryResult |
queryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
Object... params) |
void |
requireReadAclsUpdate()
This method flag the current session, the read ACLs update will be done
automatically at save time.
|
Document |
resolvePath(String path)
Gets the document at the given path, if any.
|
void |
save()
Saves this session.
|
void |
setProxyTarget(Document proxy,
Document target)
Sets a proxies' target.
|
public SQLSession(Session session, Repository repository, Map<String,Serializable> context) throws DocumentException
DocumentException
public Document getRootDocument()
Session
getRootDocument
in interface Session
public Document getNullDocument()
Session
getNullDocument
in interface Session
public XAResource getXAResource()
Session
getXAResource
in interface Session
public void close() throws DocumentException
Session
close
in interface Session
DocumentException
- if any error occurspublic void save() throws DocumentException
Session
save
in interface Session
DocumentException
- if any error occurspublic void cancel() throws DocumentException
Session
cancel
in interface Session
DocumentException
- if any error occurspublic boolean isLive()
Session
public void dispose()
Session
public long getSessionId()
Session
This is an unique identifier of this session relative to the current JVM.
getSessionId
in interface Session
public String getUserSessionId()
Session
The ID is unique in the application (possible deployed on multiple machines).
This ID is normally passed by the session creator through the session context.
getUserSessionId
in interface Session
public Repository getRepository()
Session
getRepository
in interface Session
public Map<String,Serializable> getSessionContext()
Session
getSessionContext
in interface Session
public SchemaManager getTypeManager()
Session
getTypeManager
in interface Session
public SecurityManager getSecurityManager()
Session
getSecurityManager
in interface Session
public Document getDocumentByUUID(String uuid) throws DocumentException
Session
getDocumentByUUID
in interface Session
uuid
- the document idDocumentException
- if any error occurspublic Document resolvePath(String path) throws DocumentException
Session
resolvePath
in interface Session
DocumentException
- if any error occurspublic Document move(Document source, Document parent, String name) throws DocumentException
Session
If the destination document is not a folder an exception is thrown.
move
in interface Session
source
- the source document to moveparent
- the destination foldername
- the new name of the document or null if the original name
should be preservedDocumentException
- if any error occurspublic Document copy(Document source, Document parent, String name) throws DocumentException
Session
If the destination document is not a folder, an exception is thrown.
copy
in interface Session
DocumentException
- if any error occurspublic Document getVersion(String versionableId, VersionModel versionModel) throws DocumentException
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 foundDocumentException
public Document createProxy(Document doc, Document folder) throws DocumentException
Session
createProxy
in interface Session
doc
- the documentfolder
- the folderDocumentException
- if any error occurspublic Document createProxyForVersion(Document parent, Document document, String label) throws DocumentException
Session
createProxyForVersion
in interface Session
parent
- the parentdocument
- the documentlabel
- the versionDocumentException
- if any error occurspublic Collection<Document> getProxies(Document document, Document parent) throws DocumentException
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 nullDocumentException
- if any error occurspublic void setProxyTarget(Document proxy, Document target) throws DocumentException
Session
The target must have the same version series as the proxy.
setProxyTarget
in interface Session
proxy
- the proxytarget
- the new targetDocumentException
public InputStream getDataStream(String key) throws DocumentException
Session
The implementation may use anything as the key. It may use the property path or a unique ID of the property.
This method can be used to lazily fetch blob content.
getDataStream
in interface Session
key
- the key of the blob dataDocumentException
- if any error occurspublic Document importDocument(String uuid, Document parent, String name, String typeName, Map<String,Serializable> properties) throws DocumentException
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 versionsDocumentException
public Query createQuery(String query, String queryType, String... params) throws QueryException
Session
createQuery
in interface Session
query
- the SQL like queryQueryException
public Query createQuery(String query, Query.Type qType, String... params) throws QueryException
Session
createQuery
in interface Session
query
- the SQL like queryQueryException
public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, Object... params) throws QueryException
queryAndFetch
in interface Session
QueryException
public Document getLastVersion(Serializable versionSeriesId) throws DocumentException
DocumentException
public void requireReadAclsUpdate()
Copyright © 2011 Nuxeo SA. All Rights Reserved.