org.apache.chemistry.opencmis.client.api
Interface Session


public interface Session

A session is a connection to a CMIS repository with a specific authenticated user.

Not all operations are supported by 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 discover 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.)


Method Summary
 void cancel()
          Cancels all pending actions for this session.
 void clear()
          Clears all cached data.
 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, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new document from a source document.
 ObjectId createFolder(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new folder.
 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, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new policy.
 ObjectId createRelationship(Map<String,?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new relationship.
 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 .
 ItemIterable<ChangeEvent> getContentChanges(String changeLogToken)
          Returns the content changes.
 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 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.
 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.
 void save()
          Saves all pending actions for this session.
 void setDefaultContext(OperationContext context)
          Sets the current session parameters for filtering, paging and caching.
 

Method Detail

clear

void clear()
Clears all cached data. This implies that all data will be reloaded from the repository (depending on the implementation, reloading might be done immediately or be deferred).


save

void save()
Saves all pending actions for this session. Corresponds to a commit if the CMIS provider supports transactions. If transactions are not supported by the CMIS provider, changes might be applied only partially. Not all session implementations require this method!


cancel

void cancel()
Cancels all pending actions for this session. Corresponds to a rollback if the CMIS provider supports transactions. If transactions are not supported by the CMIS provider, some changes might already be applied and therefore not rolled back. Not all session implementations require this method!


getBinding

CmisBinding getBinding()
Returns the underlying binding object.


getDefaultContext

OperationContext getDefaultContext()
Returns the current default operation parameters for filtering, paging and caching.


setDefaultContext

void setDefaultContext(OperationContext context)
Sets the current session parameters for filtering, paging and caching.

Parameters:
context - the OperationContext to be used for the session; if null, a default context is used

createOperationContext

OperationContext createOperationContext()
Creates a new operation context object.


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)
Creates a new operation context object with the given properties.

See Also:
OperationContext

createObjectId

ObjectId createObjectId(String id)
Creates an object id from a String.


getLocale

Locale getLocale()
Get the current locale to be used for this session.


getRepositoryInfo

RepositoryInfo getRepositoryInfo()
Returns the repository info of the repository associated with this session.


getObjectFactory

ObjectFactory getObjectFactory()
Gets a factory object that provides methods to create the objects used by this API.


getTypeDefinition

ObjectType getTypeDefinition(String typeId)
Returns the type definition of the given type id.


getTypeChildren

ItemIterable<ObjectType> getTypeChildren(String typeId,
                                         boolean includePropertyDefinitions)
Returns the type children of the given type id.


getTypeDescendants

List<Tree<ObjectType>> getTypeDescendants(String typeId,
                                          int depth,
                                          boolean includePropertyDefinitions)
Returns the type descendants of the given type id.


getRootFolder

Folder getRootFolder()
Gets the root folder of the repository.


getRootFolder

Folder getRootFolder(OperationContext context)
Gets the root folder of the repository with the given OperationContext.


getCheckedOutDocs

ItemIterable<Document> getCheckedOutDocs()
Returns all checked out documents.

See Also:
Folder.getCheckedOutDocs()

getCheckedOutDocs

ItemIterable<Document> getCheckedOutDocs(OperationContext context)
Returns all checked out documents with the given OperationContext .

See Also:
Folder.getCheckedOutDocs(OperationContext)

getObject

CmisObject getObject(ObjectId objectId)
Returns a CMIS object from the session cache. If the object is not in the cache or the cache is turned off per default OperationContext, it will load the object from the repository and puts it into the cache.

Parameters:
objectId - the object id

getObject

CmisObject getObject(ObjectId objectId,
                     OperationContext context)
Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext has caching turned off, it will load the object from the repository and puts it into the cache.

Parameters:
objectId - the object id
context - the OperationContext to use

getObjectByPath

CmisObject getObjectByPath(String path)
Returns a CMIS object from the session cache. If the object is not in the cache or the cache is turned off per default OperationContext, it will load the object from the repository and puts it into the cache.

Parameters:
path - the object path

getObjectByPath

CmisObject getObjectByPath(String path,
                           OperationContext context)
Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext has caching turned off, it will load the object from the repository and puts it into the cache.

Parameters:
path - the object path
context - the OperationContext to use

query

ItemIterable<QueryResult> query(String statement,
                                boolean searchAllVersions)
Sends a query to the repository. (See CMIS spec "2.1.10 Query".)

Parameters:
statement - the query statement (CMIS query language)
searchAllVersions - specifies if the latest and non-latest versions of document objects should be included

query

ItemIterable<QueryResult> query(String statement,
                                boolean searchAllVersions,
                                OperationContext context)
Sends a query to the repository using the given OperationContext. (See CMIS spec "2.1.10 Query".)

Parameters:
statement - the query statement (CMIS query language)
searchAllVersions - specifies if the latest and non-latest versions of document objects should be included
context - the OperationContext

getContentChanges

ItemIterable<ChangeEvent> getContentChanges(String changeLogToken)
Returns the content changes. (See CMIS spec "2.1.11 Change Log".)


createDocument

ObjectId createDocument(Map<String,?> properties,
                        ObjectId folderId,
                        ContentStream contentStream,
                        VersioningState versioningState,
                        List<Policy> policies,
                        List<Ace> addAces,
                        List<Ace> removeAces)
Creates a new document.

Returns:
the object id of the new document
See Also:
Folder.createDocument(Map, ContentStream, VersioningState, List, List, List, OperationContext)

createDocumentFromSource

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.

Returns:
the object id of the new document
See Also:
Folder.createDocumentFromSource(ObjectId, Map, VersioningState, List, List, List, OperationContext)

createFolder

ObjectId createFolder(Map<String,?> properties,
                      ObjectId folderId,
                      List<Policy> policies,
                      List<Ace> addAces,
                      List<Ace> removeAces)
Creates a new folder.

Returns:
the object id of the new folder
See Also:
Folder.createFolder(Map, List, List, List, OperationContext)

createPolicy

ObjectId createPolicy(Map<String,?> properties,
                      ObjectId folderId,
                      List<Policy> policies,
                      List<Ace> addAces,
                      List<Ace> removeAces)
Creates a new policy.

Returns:
the object id of the new policy
See Also:
Folder.createPolicy(Map, List, List, List, OperationContext)

createRelationship

ObjectId createRelationship(Map<String,?> properties,
                            List<Policy> policies,
                            List<Ace> addAces,
                            List<Ace> removeAces)
Creates a new relationship.

Returns:
the object id of the new relationship


Copyright © 2009-2010 The Apache Software Foundation. All Rights Reserved.