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
 Acl applyAcl(ObjectId objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
          Applies an ACL to an object.
 void applyPolicy(ObjectId objectId, ObjectId... policyIds)
          Applies a set of policies to an object.
 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 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.
 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.
 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.
 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.
 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.
 void removePolicy(ObjectId objectId, ObjectId... policyIds)
          Removes a set of policies from an object.
 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).


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

ChangeEvents getContentChanges(String changeLogToken,
                               boolean includeProperties,
                               long maxNumItems)
Returns the content changes.

Parameters:
changeLogToken - the change log token to start from or null
includeProperties - indicates if changed properties should be included in the result
maxNumItems - maximum numbers of events

getContentChanges

ChangeEvents getContentChanges(String changeLogToken,
                               boolean includeProperties,
                               long maxNumItems,
                               OperationContext context)
Returns the content changes.

Parameters:
changeLogToken - the change log token to start from or null
includeProperties - indicates if changed properties should be included in the result
maxNumItems - maximum numbers of events
context - the OperationContext

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)

createDocument

ObjectId createDocument(Map<String,?> properties,
                        ObjectId folderId,
                        ContentStream contentStream,
                        VersioningState versioningState)
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)

createDocumentFromSource

ObjectId createDocumentFromSource(ObjectId source,
                                  Map<String,?> properties,
                                  ObjectId folderId,
                                  VersioningState versioningState)
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)

createFolder

ObjectId createFolder(Map<String,?> properties,
                      ObjectId folderId)
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)

createPolicy

ObjectId createPolicy(Map<String,?> properties,
                      ObjectId folderId)
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

createRelationship

ObjectId createRelationship(Map<String,?> properties)
Creates a new relationship.

Returns:
the object id of the new relationship

getRelationships

ItemIterable<Relationship> getRelationships(ObjectId objectId,
                                            boolean includeSubRelationshipTypes,
                                            RelationshipDirection relationshipDirection,
                                            ObjectType type,
                                            OperationContext context)
Fetches the relationships from or to an object from the repository.


getAcl

Acl getAcl(ObjectId objectId,
           boolean onlyBasicPermissions)
Fetches the ACL of an object from the repository.


applyAcl

Acl applyAcl(ObjectId objectId,
             List<Ace> addAces,
             List<Ace> removeAces,
             AclPropagation aclPropagation)
Applies an ACL to an object.


applyPolicy

void applyPolicy(ObjectId objectId,
                 ObjectId... policyIds)
Applies a set of policies to an object.


removePolicy

void removePolicy(ObjectId objectId,
                  ObjectId... policyIds)
Removes a set of policies from an object.



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