public class DBSSession extends Object implements Session
Session for Document-Based Storage.| Modifier and Type | Class and Description |
|---|---|
protected static class |
DBSSession.DBSQueryResult |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
closed |
protected static Pattern |
dotDigitsPattern |
protected DBSRepository |
repository |
protected DBSTransactionState |
transaction |
| Constructor and Description |
|---|
DBSSession(DBSRepository repository) |
| Modifier and Type | Method and Description |
|---|---|
protected static Serializable |
acpToMem(ACP acp) |
protected void |
addBackProxyId(DBSDocumentState docState,
String id) |
protected DBSDocumentState |
addProxyState(String id,
String parentId,
String name,
Long pos,
String targetId,
String versionSeriesId) |
void |
begin() |
protected Document |
checkIn(String id,
String label,
String checkinComment) |
protected void |
checkNegativeAcl(ACP acp) |
protected void |
checkNotUnder(String parentId,
String id,
String op)
Checks that we don't move/copy under ourselves.
|
protected void |
checkOut(String id) |
void |
close()
Closes this session.
|
void |
commit() |
static String |
convToInternal(String name) |
static String |
convToInternalAce(String name) |
static String |
convToNXQL(String name) |
Document |
copy(Document source,
Document parent,
String name)
Copies the source document to the given folder.
|
protected String |
copy(String sourceId,
String parentId,
List<String> ancestorIds,
String name)
Copy source under parent, and set its ancestors.
|
protected String |
copyRecurse(String sourceId,
String parentId,
LinkedList<String> ancestorIds,
String name) |
Document |
createChild(String id,
String parentId,
String name,
Long pos,
String typeName) |
protected DBSDocumentState |
createChildState(String id,
String parentId,
String name,
Long pos,
String typeName) |
Document |
createProxy(Document doc,
Document folder)
Creates a generic proxy to the given document inside the given folder.
|
protected void |
doOrderBy(List<State> states,
OrderByClause orderByClause,
DBSExpressionEvaluator evaluator) |
protected PartialList<String> |
doQuery(String query,
String queryType,
QueryFilter queryFilter,
int countUpTo) |
protected PartialList<Map<String,Serializable>> |
doQueryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
int countUpTo) |
protected PartialList<Map<String,Serializable>> |
doQueryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
int countUpTo,
boolean onlyId) |
protected String |
findFreeName(Document parent,
String name) |
protected List<Map<String,Serializable>> |
flatten(List<State> states)
Flatten and convert from internal names to NXQL.
|
protected void |
flatten(Map<String,Serializable> map,
State state,
String prefix) |
protected ACP |
getACP(Document doc) |
Map<String,String> |
getBinaryFulltext(String id)
Gets the fulltext extracted from the binary fields.
|
protected BlobManager |
getBlobManager() |
protected Document |
getChild(String parentId,
String name) |
protected List<Document> |
getChildren(String parentId) |
protected List<String> |
getChildrenIds(String parentId) |
protected Document |
getDocument(DBSDocumentState docState) |
protected Document |
getDocument(DBSDocumentState docState,
boolean readonly) |
protected Document |
getDocument(String id) |
Document |
getDocumentByUUID(String id)
Gets a document given its ID.
|
protected String |
getDocumentIdByPath(String path) |
protected List<Document> |
getDocuments(List<String> ids) |
protected ACL |
getInheritedACLs(Document doc) |
protected Document |
getLastVersion(String versionSeriesId) |
LockManager |
getLockManager()
Gets the lock manager for this session.
|
ACP |
getMergedACP(Document doc) |
protected Long |
getNextPos(String parentId) |
Document |
getNullDocument()
Gets the null document, to be used as a fake parent to add placeless children.
|
protected String |
getPath(State state) |
List<Document> |
getProxies(Document doc,
Document folder)
Finds the proxies for a document.
|
String |
getRepositoryName()
Gets the repository that created this session.
|
Document |
getRootDocument()
Gets the root document in this repository.
|
protected String |
getRootId() |
Document |
getVersion(String versionSeriesId,
VersionModel versionModel)
Gets a version of a document, given its versionable id and label.
|
protected DBSDocumentState |
getVersionByLabel(String versionSeriesId,
String label) |
protected List<String> |
getVersionsIds(String versionSeriesId) |
protected boolean |
hasChild(String parentId,
String name) |
protected boolean |
hasChildren(String parentId) |
Document |
importDocument(String id,
Document parent,
String name,
String typeName,
Map<String,Serializable> properties)
Imports a document with a given id and parent.
|
static boolean |
isArray(String name) |
static boolean |
isBoolean(String name) |
boolean |
isLive()
Checks whether the session is alive.
|
boolean |
isNegativeAclAllowed()
Returns
true if negative ACLs are allowed. |
protected boolean |
isOrderable(String id) |
protected boolean |
isOrderByPath(OrderByClause orderByClause)
Does an ORDER BY clause include ecm:path
|
boolean |
isStateSharedByAllThreadSessions()
Returns
true if all sessions in the current thread share the same state. |
protected boolean |
keepWhenRestore(String key) |
protected static ACP |
memToAcp(Serializable acpSer) |
Document |
move(Document source,
Document parent,
String name)
Moves the source document to the given folder.
|
protected String |
normalize(String path) |
protected void |
orderBefore(String parentId,
String sourceId,
String destId) |
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 |
recomputeVersionSeries(String versionSeriesId)
Recomputes isLatest / isLatestMajor on all versions.
|
protected void |
remove(String id)
Removes a document.
|
protected void |
removeBackProxyId(DBSDocumentState docState,
String id) |
protected void |
removeBackProxyIds(DBSDocumentState docState,
Set<String> ids) |
Document |
resolvePath(String path)
Gets the document at the given path, if any.
|
protected void |
restoreVersion(Document doc,
Document version) |
void |
rollback() |
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 Boolean |
trueOrNull(Object value) |
protected static ACP |
updateACP(ACP curAcp,
ACP addAcp)
Returns the merge of two ACPs.
|
protected final DBSRepository repository
protected final DBSTransactionState transaction
protected boolean closed
protected static final Pattern dotDigitsPattern
public DBSSession(DBSRepository repository)
public String getRepositoryName()
SessiongetRepositoryName in interface Sessionpublic void close()
Sessionpublic boolean isLive()
Sessionpublic void begin()
public void commit()
public void rollback()
public boolean isStateSharedByAllThreadSessions()
Sessiontrue if all sessions in the current thread share the same state.isStateSharedByAllThreadSessions in interface Sessionprotected BlobManager getBlobManager()
public Document resolvePath(String path)
SessionresolvePath in interface Sessionprotected String getDocumentIdByPath(String path)
protected List<Document> getChildren(String parentId)
protected List<String> getChildrenIds(String parentId)
protected boolean hasChildren(String parentId)
public Document getDocumentByUUID(String id)
SessiongetDocumentByUUID in interface Sessionid - the document idpublic Document getRootDocument()
SessiongetRootDocument in interface Sessionpublic Document getNullDocument()
SessiongetNullDocument in interface Sessionprotected Document getDocument(String id)
protected List<Document> getDocuments(List<String> ids)
protected Document getDocument(DBSDocumentState docState)
protected Document getDocument(DBSDocumentState docState, boolean readonly)
public Document createChild(String id, String parentId, String name, Long pos, String typeName)
protected DBSDocumentState createChildState(String id, String parentId, String name, Long pos, String typeName)
protected boolean isOrderable(String id)
protected Long getNextPos(String parentId)
protected void orderBefore(String parentId, String sourceId, String destId)
protected void recomputeVersionSeries(String versionSeriesId)
protected void restoreVersion(Document doc, Document version)
protected boolean keepWhenRestore(String key)
public Document copy(Document source, Document parent, String name)
SessionIf the destination document is not a folder, an exception is thrown.
protected String copyRecurse(String sourceId, String parentId, LinkedList<String> ancestorIds, String name)
protected String copy(String sourceId, String parentId, List<String> ancestorIds, String name)
protected String findFreeName(Document parent, String name)
protected void checkNotUnder(String parentId, String id, String op)
public Document move(Document source, Document parent, String name)
SessionIf the destination document is not a folder an exception is thrown.
protected void remove(String id)
We also have to update everything impacted by "relations":
public Document createProxy(Document doc, Document folder)
SessioncreateProxy in interface Sessiondoc - the documentfolder - the folderprotected DBSDocumentState addProxyState(String id, String parentId, String name, Long pos, String targetId, String versionSeriesId)
protected void addBackProxyId(DBSDocumentState docState, String id)
protected void removeBackProxyId(DBSDocumentState docState, String id)
protected void removeBackProxyIds(DBSDocumentState docState, Set<String> ids)
public List<Document> getProxies(Document doc, Document folder)
SessionIf the document is a version, then only proxies to that version will be looked up.
getProxies in interface Sessiondoc - the document or versionfolder - 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 id, Document parent, String name, String typeName, Map<String,Serializable> properties)
SessionThe document can then be filled with the normal imported properties.
importDocument in interface Sessionid - 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 versionsprotected static Boolean trueOrNull(Object value)
public Document getVersion(String versionSeriesId, 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 SessionversionSeriesId - the versionable idversionModel - the version modelnull if not foundprotected DBSDocumentState getVersionByLabel(String versionSeriesId, String label)
protected List<String> getVersionsIds(String versionSeriesId)
protected Document getLastVersion(String versionSeriesId)
public 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 ACP getMergedACP(Document doc)
getMergedACP in interface Sessionprotected ACL getInheritedACLs(Document doc)
protected void checkNegativeAcl(ACP acp)
protected static Serializable acpToMem(ACP acp)
protected static ACP memToAcp(Serializable acpSer)
public Map<String,String> getBinaryFulltext(String id)
SessiongetBinaryFulltext in interface Sessionpublic PartialList<Document> query(String query, String queryType, QueryFilter queryFilter, long countUpTo)
Sessionprotected PartialList<String> doQuery(String query, String queryType, QueryFilter queryFilter, int countUpTo)
protected PartialList<Map<String,Serializable>> doQueryAndFetch(String query, String queryType, QueryFilter queryFilter, int countUpTo)
protected PartialList<Map<String,Serializable>> doQueryAndFetch(String query, String queryType, QueryFilter queryFilter, int countUpTo, boolean onlyId)
protected boolean isOrderByPath(OrderByClause orderByClause)
protected void doOrderBy(List<State> states, OrderByClause orderByClause, DBSExpressionEvaluator evaluator)
protected List<Map<String,Serializable>> flatten(List<State> states)
public IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, Object[] params)
SessionqueryAndFetch in interface Sessionpublic static String convToInternal(String name)
public static String convToInternalAce(String name)
public static String convToNXQL(String name)
public LockManager getLockManager()
SessiongetLockManager in interface SessionCopyright © 2015 Nuxeo SA. All rights reserved.