public interface Session extends javax.resource.cci.Connection
Modifier and Type | Interface and Description |
---|---|
static interface |
Session.PathResolver
Interface for a class that knows how to resolve a node path into a node id.
|
Modifier and Type | Method and Description |
---|---|
Node |
addChildNode(Node parent,
String name,
Long pos,
String typeName,
boolean complexProp)
Creates a new child node.
|
Node |
addChildNode(Serializable id,
Node parent,
String name,
Long pos,
String typeName,
boolean complexProp)
Creates a new child node with given id (used for import).
|
boolean |
addMixinType(Node node,
String mixin)
Adds a mixin to a node.
|
Node |
addProxy(Serializable targetId,
Serializable versionSeriesId,
Node parent,
String name,
Long pos)
Creates a proxy for a version node.
|
Node |
checkIn(Node node,
String label,
String checkinComment)
Checks in a checked-out node: creates a new version with a copy of its information.
|
void |
checkOut(Node node)
Checks out a checked-in node.
|
Node |
copy(Node source,
Node parent,
String name)
Copies a node to a new location with a new name.
|
Map<String,String> |
getBinaryFulltext(Serializable id)
Gets the fulltext extracted from the binary fields.
|
Node |
getChildNode(Node parent,
String name,
boolean complexProp)
Gets a child node given its parent and name.
|
List<Node> |
getChildren(Node parent,
String name,
boolean complexProp)
Gets the children of a node.
|
Node |
getLastVersion(Serializable versionSeriesId)
Gets the last version for a given version series id.
|
LockManager |
getLockManager()
Gets the lock manager for this session.
|
Mapper |
getMapper()
Gets the low-level Mapper for this session.
|
Model |
getModel()
Gets the
Model associated to this session. |
Node |
getNodeById(Serializable id)
Gets a node given its id.
|
Node |
getNodeByPath(String path,
Node node)
Gets a node given its absolute path, or given an existing node and a relative path.
|
List<Node> |
getNodesByIds(List<Serializable> ids)
Gets several nodes given their ids.
|
Node |
getParentNode(Node node)
Gets the parent of a node.
|
String |
getPath(Node node)
Gets the absolute path of a node.
|
List<Node> |
getProxies(Node document,
Node parent)
Finds the proxies for a document.
|
String |
getRepositoryName()
Gets the session repository name.
|
Node |
getRootNode()
Gets the root node of the repository.
|
Node |
getVersionByLabel(Serializable versionSeriesId,
String label)
Gets a version given its version series id and label.
|
List<Node> |
getVersions(Serializable versionSeriesId)
Gets all the versions for a given version series id.
|
boolean |
hasChildNode(Node parent,
String name,
boolean complexProp)
Checks if a child node with the given name exists.
|
boolean |
hasChildren(Node parent,
boolean complexProp)
Checks it a node has children.
|
boolean |
isChangeTokenEnabled()
Checks if change token management is enabled.
|
boolean |
isLive()
Checks if the session is live (not closed).
|
void |
markUserChange(Serializable id)
Marks the document as being modified by a user change.
|
Node |
move(Node source,
Node parent,
String name)
Moves a node to a new location with a new name.
|
void |
orderBefore(Node parent,
Node source,
Node dest)
Order the given source child node before the destination child node.
|
PartialList<Serializable> |
query(String query,
QueryFilter queryFilter,
boolean countTotal)
Makes a NXQL query to the database.
|
PartialList<Serializable> |
query(String query,
String queryType,
QueryFilter queryFilter,
long countUpTo)
Makes a query to the database.
|
IterableQueryResult |
queryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
boolean distinctDocuments,
Object... params)
Makes a query to the database and returns an iterable (which must be closed when done).
|
IterableQueryResult |
queryAndFetch(String query,
String queryType,
QueryFilter queryFilter,
Object... params)
Makes a query to the database and returns an iterable (which must be closed when done).
|
PartialList<Map<String,Serializable>> |
queryProjection(String query,
String queryType,
QueryFilter queryFilter,
boolean distinctDocuments,
long countUpTo,
Object[] params)
Makes a query to the database.
|
void |
rebuildReadAcls()
Rebuild the read ACLs for the whole repository.
|
boolean |
removeMixinType(Node node,
String mixin)
Removes a mixin from a node.
|
void |
removeNode(Node node)
Removes a node from the storage.
|
void |
removePropertyNode(Node node)
Removes a property node from the storage.
|
void |
requireReadAclsUpdate()
Read ACLs are optimized ACLs for the read permission, they need to be updated after document creation or ACL
change.
|
void |
restore(Node node,
Node version)
Restores a node to a given version.
|
void |
save()
Saves the modifications to persistent storage.
|
ScrollResult<String> |
scroll(String scrollId)
Get the next batch of results containing id of documents, the
scrollId is part of the previous
ScrollResult response. |
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 |
setProxyTarget(Node proxy,
Serializable targetId)
Sets a proxies' target.
|
void |
updateReadAcls()
Update only the read ACLs that have changed.
|
boolean isLive()
true
if the session is liveString getRepositoryName()
void save()
Modifications will be actually written only upon transaction commit.
Node getRootNode()
Node getNodeById(Serializable id)
id
- the idnull
if not foundList<Node> getNodesByIds(List<Serializable> ids)
ids
- the idsnull
if not foundNode getNodeByPath(String path, Node node)
path
- the pathnode
- the node (ignored for absolute paths)null
if not foundboolean addMixinType(Node node, String mixin)
Does nothing if the mixin was already present on the node.
node
- the nodemixin
- the mixin nametrue
if the mixin was added, or false
if it is already presentboolean removeMixinType(Node node, String mixin)
It's not possible to remove a mixin coming from the primary type.
node
- the nodemixin
- the mixintrue
if the mixin was removed, or false
if it isn't present or is present on the type or
does not existScrollResult<String> scroll(String query, int batchSize, int keepAliveSeconds)
keepAliveSeconds
delay.ScrollResult<String> scroll(String scrollId)
scrollId
is part of the previous
ScrollResult
response.Node getParentNode(Node node)
The root has a null
parent.
node
- the nodenull
for the root's parentString getPath(Node node)
node
- the nodeboolean hasChildNode(Node parent, String name, boolean complexProp)
There are two kinds of children, the regular children documents and the complex properties. The boolean
allows a choice between those.
parent
- the parent nodename
- the child namecomplexProp
- whether to check complex properties or regular childrentrue
if a child node with that name existsNode getChildNode(Node parent, String name, boolean complexProp)
parent
- the parent nodename
- the child namecomplexProp
- whether to check complex properties or regular childrennull
is not foundboolean hasChildren(Node parent, boolean complexProp)
parent
- the parent nodecomplexProp
- whether to check complex properties or regular childrentrue
if the parent has childrenList<Node> getChildren(Node parent, String name, boolean complexProp)
parent
- the parent nodename
- the children name to get (for lists of complex properties), or null
for allcomplexProp
- whether to check complex properties or regular childrenNode addChildNode(Node parent, String name, Long pos, String typeName, boolean complexProp)
parent
- the parent to which the child is addedname
- the child namepos
- the child position, or null
typeName
- the child typecomplexProp
- whether this is a complex property (true
) or a regular child (false
)Node addChildNode(Serializable id, Node parent, String name, Long pos, String typeName, boolean complexProp)
id
- the idparent
- the parent to which the child is addedname
- the child namepos
- the child position, or null
typeName
- the child typecomplexProp
- whether this is a complex property (true
) or a regular child (false
)Node addProxy(Serializable targetId, Serializable versionSeriesId, Node parent, String name, Long pos)
targetId
- the target idversionSeriesId
- the version series idparent
- the parent to which the proxy is addedname
- the proxy namepos
- the proxy positionvoid setProxyTarget(Node proxy, Serializable targetId)
proxy
- the proxytargetId
- the new target idvoid removeNode(Node node)
This is much more complex that removing a property node ( removePropertyNode(org.nuxeo.ecm.core.storage.sql.Node)
).
node
- the node to remove#removePropertyNode}
void removePropertyNode(Node node)
This is much less complex that removing a generic document node ( removeNode(org.nuxeo.ecm.core.storage.sql.Node)
).
node
- the property node to remove#removeNode}
void orderBefore(Node parent, Node source, Node dest)
null
, the source node will be appended at the end of the children
list.parent
- the parent nodesource
- the child node to movedest
- the child node before which to place the source node, or null
to move at the endNode move(Node source, Node parent, String name)
A save()
is automatically done first.
source
- the node to moveparent
- the new parent to which the node is movedname
- the new node nameNode copy(Node source, Node parent, String name)
A save()
is automatically done first.
source
- the node to copyparent
- the new parent to which the node is copiedname
- the new node nameNode checkIn(Node node, String label, String checkinComment)
A save()
is automatically done first.
node
- the node to check inlabel
- the label for the versioncheckinComment
- the description for the versionvoid checkOut(Node node)
node
- the node to check outvoid restore(Node node, Node version)
The restored node is checked in.
node
- the node to restoreversion
- the version to restore fromNode getVersionByLabel(Serializable versionSeriesId, String label)
versionSeriesId
- the version series idlabel
- the labelnull
if not foundList<Node> getVersions(Serializable versionSeriesId)
A save()
is automatically done first.
versionSeriesId
- the version series idNode getLastVersion(Serializable versionSeriesId)
A save()
is automatically done first.
versionSeriesId
- the version series idnull
if no versions existList<Node> getProxies(Node document, Node parent)
If the document is a version, then only proxies to that version will be looked up.
Otherwise all proxies to the same version series than the document are retrieved.
A save()
is automatically done first.
document
- the documentparent
- the parent, or null
PartialList<Serializable> query(String query, QueryFilter queryFilter, boolean countTotal)
query
- the queryqueryFilter
- the query filtercountTotal
- if true
, also count the total size without offset/limitPartialList<Serializable> query(String query, String queryType, QueryFilter queryFilter, long countUpTo)
query
- the queryqueryType
- the query typequeryFilter
- the query filtercountUpTo
- if -1
, also count the total size without offset/limit.0
, don't count the total size.n
, count the total number if there are less than n documents otherwise set the size to
-1
.IterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, Object... params)
query
- the queryqueryType
- the query typequeryFilter
- the query filterparams
- optional query-type-dependent parametersIterableQueryResult queryAndFetch(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, Object... params)
query
- the queryqueryType
- the query typequeryFilter
- the query filterdistinctDocuments
- if true
then a maximum of one row per document will be returnedparams
- optional query-type-dependent parametersPartialList<Map<String,Serializable>> queryProjection(String query, String queryType, QueryFilter queryFilter, boolean distinctDocuments, long countUpTo, Object[] params)
query
- the queryqueryType
- the query typequeryFilter
- the query filterdistinctDocuments
- if true
then a maximum of one row per document will be returnedcountUpTo
- if -1
, also count the total size without offset/limit.0
, don't count the total size.n
, count the total number if there are less than n documents otherwise set the size to
-1
.params
- optional query-type-dependent parametersLockManager getLockManager()
void requireReadAclsUpdate()
This method flag the current session, the read ACLs update will be done automatically at save time.
void updateReadAcls()
void rebuildReadAcls()
Map<String,String> getBinaryFulltext(Serializable id)
boolean isChangeTokenEnabled()
void markUserChange(Serializable id)
This causes an additional change token increment and check during save.
id
- the document idCopyright © 2018 Nuxeo. All rights reserved.