public interface Session extends Serializable
Not all operations might be supported the connected repository. Either
OpenCMIS or the repository will throw an exception if an unsupported
operation is called. The capabilities of the repository can be discovered by
evaluating the repository info (see getRepositoryInfo()
).
Almost all methods might throw exceptions derived from
CmisBaseException
which is a runtime exception.
(Please refer to the CMIS specification for details about the domain model, terms, concepts, base types, properties, ids and query names, query language, etc.)
Modifier and Type | Method and Description |
---|---|
Acl |
applyAcl(ObjectId objectId,
List<Ace> addAces,
List<Ace> removeAces,
AclPropagation aclPropagation)
Applies ACL changes to an object and potentially dependent objects.
|
void |
applyPolicy(ObjectId objectId,
ObjectId... policyIds)
Applies a set of policies to an object.
|
List<BulkUpdateObjectIdAndChangeToken> |
bulkUpdateProperties(List<CmisObject> objects,
Map<String,?> properties,
List<String> addSecondaryTypeIds,
List<String> removeSecondaryTypeIds)
Updates multiple objects in one request.
|
void |
clear()
Clears all cached data.
|
ObjectId |
createDocument(Map<String,?> properties,
ObjectId folderId,
ContentStream contentStream,
VersioningState versioningState)
Creates a new document.
|
ObjectId |
createDocument(Map<String,?> properties,
ObjectId folderId,
ContentStream contentStream,
VersioningState versioningState,
List<Policy> policies,
List<Ace> addAces,
List<Ace> removeAces)
Creates a new document.
|
ObjectId |
createDocumentFromSource(ObjectId source,
Map<String,?> properties,
ObjectId folderId,
VersioningState versioningState)
Creates a new document from a source document.
|
ObjectId |
createDocumentFromSource(ObjectId source,
Map<String,?> properties,
ObjectId folderId,
VersioningState versioningState,
List<Policy> policies,
List<Ace> addAces,
List<Ace> removeAces)
Creates a new document from a source document.
|
ObjectId |
createFolder(Map<String,?> properties,
ObjectId folderId)
Creates a new folder.
|
ObjectId |
createFolder(Map<String,?> properties,
ObjectId folderId,
List<Policy> policies,
List<Ace> addAces,
List<Ace> removeAces)
Creates a new folder.
|
ObjectId |
createItem(Map<String,?> properties,
ObjectId folderId)
Creates a new item.
|
ObjectId |
createItem(Map<String,?> properties,
ObjectId folderId,
List<Policy> policies,
List<Ace> addAces,
List<Ace> removeAces)
Creates a new item.
|
ObjectId |
createObjectId(String id)
Creates an object id from a String.
|
OperationContext |
createOperationContext()
Creates a new operation context object.
|
OperationContext |
createOperationContext(Set<String> filter,
boolean includeAcls,
boolean includeAllowableActions,
boolean includePolicies,
IncludeRelationships includeRelationships,
Set<String> renditionFilter,
boolean includePathSegments,
String orderBy,
boolean cacheEnabled,
int maxItemsPerPage)
Creates a new operation context object with the given properties.
|
ObjectId |
createPolicy(Map<String,?> properties,
ObjectId folderId)
Creates a new policy.
|
ObjectId |
createPolicy(Map<String,?> properties,
ObjectId folderId,
List<Policy> policies,
List<Ace> addAces,
List<Ace> removeAces)
Creates a new policy.
|
QueryStatement |
createQueryStatement(String statement)
Creates a query statement.
|
ObjectId |
createRelationship(Map<String,?> properties)
Creates a new relationship.
|
ObjectId |
createRelationship(Map<String,?> properties,
List<Policy> policies,
List<Ace> addAces,
List<Ace> removeAces)
Creates a new relationship.
|
ObjectType |
createType(TypeDefinition type)
Creates a new type.
|
void |
delete(ObjectId objectId)
Deletes an object and, if it is a document, all versions in the version
series.
|
void |
delete(ObjectId objectId,
boolean allVersions)
Deletes an object.
|
void |
deleteType(String typeId)
Deletes a type.
|
Acl |
getAcl(ObjectId objectId,
boolean onlyBasicPermissions)
Fetches the ACL of an object from the repository.
|
CmisBinding |
getBinding()
Returns the underlying binding object.
|
ItemIterable<Document> |
getCheckedOutDocs()
Returns all checked out documents.
|
ItemIterable<Document> |
getCheckedOutDocs(OperationContext context)
Returns all checked out documents with the given
OperationContext
. |
ChangeEvents |
getContentChanges(String changeLogToken,
boolean includeProperties,
long maxNumItems)
Returns the content changes.
|
ChangeEvents |
getContentChanges(String changeLogToken,
boolean includeProperties,
long maxNumItems,
OperationContext context)
Returns the content changes.
|
ContentStream |
getContentStream(ObjectId docId)
Retrieves the main content stream of a document
|
ContentStream |
getContentStream(ObjectId docId,
String streamId,
BigInteger offset,
BigInteger length)
Retrieves the content stream of a document
|
OperationContext |
getDefaultContext()
Returns the current default operation parameters for filtering, paging
and caching.
|
Locale |
getLocale()
Get the current locale to be used for this session.
|
CmisObject |
getObject(ObjectId objectId)
Returns a CMIS object from the session cache.
|
CmisObject |
getObject(ObjectId objectId,
OperationContext context)
Returns a CMIS object from the session cache.
|
CmisObject |
getObject(String objectId)
Returns a CMIS object from the session cache.
|
CmisObject |
getObject(String objectId,
OperationContext context)
Returns a CMIS object from the session cache.
|
CmisObject |
getObjectByPath(String path)
Returns a CMIS object from the session cache.
|
CmisObject |
getObjectByPath(String path,
OperationContext context)
Returns a CMIS object from the session cache.
|
ObjectFactory |
getObjectFactory()
Gets a factory object that provides methods to create the objects used by
this API.
|
ItemIterable<Relationship> |
getRelationships(ObjectId objectId,
boolean includeSubRelationshipTypes,
RelationshipDirection relationshipDirection,
ObjectType type,
OperationContext context)
Fetches the relationships from or to an object from the repository.
|
RepositoryInfo |
getRepositoryInfo()
Returns the repository info of the repository associated with this
session.
|
Folder |
getRootFolder()
Gets the root folder of the repository.
|
Folder |
getRootFolder(OperationContext context)
Gets the root folder of the repository with the given
OperationContext . |
ItemIterable<ObjectType> |
getTypeChildren(String typeId,
boolean includePropertyDefinitions)
Returns the type children of the given type id.
|
ObjectType |
getTypeDefinition(String typeId)
Returns the type definition of the given type id.
|
List<Tree<ObjectType>> |
getTypeDescendants(String typeId,
int depth,
boolean includePropertyDefinitions)
Returns the type descendants of the given type id.
|
ItemIterable<QueryResult> |
query(String statement,
boolean searchAllVersions)
Sends a query to the repository.
|
ItemIterable<QueryResult> |
query(String statement,
boolean searchAllVersions,
OperationContext context)
Sends a query to the repository using the given
OperationContext . |
ItemIterable<CmisObject> |
queryObjects(String typeId,
String where,
boolean searchAllVersions,
OperationContext context) |
void |
removeObjectFromCache(ObjectId objectId)
Removes the given object from the cache.
|
void |
removeObjectFromCache(String objectId)
Removes the given object from the cache.
|
void |
removePolicy(ObjectId objectId,
ObjectId... policyIds)
Removes a set of policies from an object.
|
Acl |
setAcl(ObjectId objectId,
List<Ace> aces)
Removes the direct ACEs of an object and sets the provided ACEs.
|
void |
setDefaultContext(OperationContext context)
Sets the current session parameters for filtering, paging and caching.
|
ObjectType |
updateType(TypeDefinition type)
Updates an existing type.
|
void clear()
CmisBinding getBinding()
OperationContext getDefaultContext()
Please note: The returned object is not thread-safe and should
only be modified right after the session has been created and before the
session object has been used. In order to change the default context in
thread-safe manner, create a new OperationContext
object and use
setDefaultContext(OperationContext)
to apply it.
void setDefaultContext(OperationContext context)
context
- the OperationContext
to be used for the session;
if null
, a default context is usedOperationContext createOperationContext()
OperationContext createOperationContext(Set<String> filter, boolean includeAcls, boolean includeAllowableActions, boolean includePolicies, IncludeRelationships includeRelationships, Set<String> renditionFilter, boolean includePathSegments, String orderBy, boolean cacheEnabled, int maxItemsPerPage)
OperationContext
Locale getLocale()
RepositoryInfo getRepositoryInfo()
ObjectFactory getObjectFactory()
ObjectType getTypeDefinition(String typeId)
ItemIterable<ObjectType> getTypeChildren(String typeId, boolean includePropertyDefinitions)
List<Tree<ObjectType>> getTypeDescendants(String typeId, int depth, boolean includePropertyDefinitions)
ObjectType createType(TypeDefinition type)
ObjectType updateType(TypeDefinition type)
void deleteType(String typeId)
Folder getRootFolder()
Folder getRootFolder(OperationContext context)
OperationContext
.ItemIterable<Document> getCheckedOutDocs()
Folder.getCheckedOutDocs()
ItemIterable<Document> getCheckedOutDocs(OperationContext context)
OperationContext
.Folder.getCheckedOutDocs(OperationContext)
CmisObject getObject(ObjectId objectId)
OperationContext
, it
will load the object from the repository and puts it into the cache.objectId
- the object idgetObject(String)
CmisObject getObject(ObjectId objectId, OperationContext context)
OperationContext
has caching turned off, it
will load the object from the repository and puts it into the cache.objectId
- the object idcontext
- the OperationContext
to usegetObject(String, OperationContext)
CmisObject getObject(String objectId)
OperationContext
, it
will load the object from the repository and puts it into the cache.objectId
- the object idgetObject(ObjectId)
CmisObject getObject(String objectId, OperationContext context)
OperationContext
has caching turned off, it
will load the object from the repository and puts it into the cache.objectId
- the object idcontext
- the OperationContext
to usegetObject(ObjectId, OperationContext)
CmisObject getObjectByPath(String path)
OperationContext
, it
will load the object from the repository and puts it into the cache.path
- the object pathCmisObject getObjectByPath(String path, OperationContext context)
OperationContext
has caching turned off, it
will load the object from the repository and puts it into the cache.path
- the object pathcontext
- the OperationContext
to usevoid removeObjectFromCache(ObjectId objectId)
objectId
- object idvoid removeObjectFromCache(String objectId)
objectId
- object idItemIterable<QueryResult> query(String statement, boolean searchAllVersions)
statement
- the query statement (CMIS query language)searchAllVersions
- specifies if the latest and non-latest versions of document
objects should be includedItemIterable<QueryResult> query(String statement, boolean searchAllVersions, OperationContext context)
OperationContext
.
(See CMIS spec "2.1.10 Query".)statement
- the query statement (CMIS query language)searchAllVersions
- specifies if the latest and non-latest versions of document
objects should be includedcontext
- the OperationContextItemIterable<CmisObject> queryObjects(String typeId, String where, boolean searchAllVersions, OperationContext context)
type
- the id of the object typewhere
- the WHERE part of the querysearchAllVersions
- specifies if the latest and non-latest versions of document
objects should be includedcontext
- the OperationContextQueryStatement createQueryStatement(String statement)
statement
- the query statement with placeholders ('?').QueryStatement
ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long maxNumItems)
changeLogToken
- the change log token to start from or null
includeProperties
- indicates if changed properties should be included in the
resultmaxNumItems
- maximum numbers of eventsChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long maxNumItems, OperationContext context)
changeLogToken
- the change log token to start from or null
includeProperties
- indicates if changed properties should be included in the
resultmaxNumItems
- maximum numbers of eventscontext
- the OperationContextObjectId createDocument(Map<String,?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
contentStream
is consumed but not closed by
this method.Folder.createDocument(Map, ContentStream, VersioningState, List,
List, List, OperationContext)
ObjectId createDocument(Map<String,?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState)
contentStream
is consumed but not closed by
this method.Folder.createDocument(Map, ContentStream, VersioningState, List,
List, List, OperationContext)
ObjectId createDocumentFromSource(ObjectId source, Map<String,?> properties, ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
Folder.createDocumentFromSource(ObjectId, Map, VersioningState,
List, List, List, OperationContext)
ObjectId createDocumentFromSource(ObjectId source, Map<String,?> properties, ObjectId folderId, VersioningState versioningState)
Folder.createDocumentFromSource(ObjectId, Map, VersioningState,
List, List, List, OperationContext)
ObjectId createFolder(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
Folder.createFolder(Map, List, List, List, OperationContext)
ObjectId createFolder(Map<String,?> properties, ObjectId folderId)
Folder.createFolder(Map, List, List, List, OperationContext)
ObjectId createPolicy(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
Folder.createPolicy(Map, List, List, List, OperationContext)
ObjectId createPolicy(Map<String,?> properties, ObjectId folderId)
Folder.createPolicy(Map, List, List, List, OperationContext)
ObjectId createItem(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
Folder.createItem(Map, List, List, List, OperationContext)
ObjectId createItem(Map<String,?> properties, ObjectId folderId)
Folder.createItem(Map, List, List, List, OperationContext)
ObjectId createRelationship(Map<String,?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
ObjectId createRelationship(Map<String,?> properties)
ItemIterable<Relationship> getRelationships(ObjectId objectId, boolean includeSubRelationshipTypes, RelationshipDirection relationshipDirection, ObjectType type, OperationContext context)
List<BulkUpdateObjectIdAndChangeToken> bulkUpdateProperties(List<CmisObject> objects, Map<String,?> properties, List<String> addSecondaryTypeIds, List<String> removeSecondaryTypeIds)
void delete(ObjectId objectId)
objectId
- the id of the objectvoid delete(ObjectId objectId, boolean allVersions)
objectId
- the id of the objectallVersions
- if this object is a document this parameter defines if only
this version or all versions should be deletedContentStream getContentStream(ObjectId docId)
docId
- the id of the documentnull
if the document has no
content streamContentStream getContentStream(ObjectId docId, String streamId, BigInteger offset, BigInteger length)
docId
- the id of the documentstreamId
- the stream idoffset
- the offset of the stream or null
to read the
stream from the beginninglength
- the maximum length of the stream or null
to read
to the end of the streamnull
if the document has no
content streamAcl getAcl(ObjectId objectId, boolean onlyBasicPermissions)
objectId
- the id the objectonlyBasicPermissions
- if true
the repository should express the ACL
only with the basic permissions defined in the CMIS
specification; if false
the repository can
express the ACL with basic and repository specific permissionsAcl applyAcl(ObjectId objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
objectId
- the id the objectaddAces
- list of ACEs to be added or null
if no ACEs
should be addedremoveAces
- list of ACEs to be removed or null
if no ACEs
should be removedaclPropagation
- value that defines the propagation of the ACE changes;
null
is equal to
AclPropagation.REPOSITORYDETERMINED
Acl setAcl(ObjectId objectId, List<Ace> aces)
objectId
- the id the objectaces
- list of ACEs to be setvoid applyPolicy(ObjectId objectId, ObjectId... policyIds)
objectId
- the id the objectpolicyIds
- the ids of the policies to be appliedCopyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.