public class SessionImpl extends Object implements Session
| Constructor and Description |
|---|
SessionImpl(Map<String,String> parameters,
ObjectFactory objectFactory,
AuthenticationProvider authenticationProvider,
Cache cache)
Constructor.
|
| 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.
|
void |
clear()
Clears all cached data.
|
void |
connect()
Connect session object to the provider.
|
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.
|
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.
|
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.
|
Acl |
getAcl(ObjectId objectId,
boolean onlyBasicPermissions)
Fetches the ACL of an object from the repository.
|
CmisBinding |
getBinding()
Returns the underlying binding object.
|
Cache |
getCache() |
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.
|
String |
getRepositoryId()
Returns the repository id.
|
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.
|
String |
setExtensionContext(String context) |
ExtensionHandler |
setExtensionHandler(String context,
ExtensionHandler extensionHandler) |
public SessionImpl(Map<String,String> parameters, ObjectFactory objectFactory, AuthenticationProvider authenticationProvider, Cache cache)
public void clear()
Sessionpublic ObjectFactory getObjectFactory()
SessiongetObjectFactory in interface Sessionpublic ItemIterable<Document> getCheckedOutDocs()
SessiongetCheckedOutDocs in interface SessionFolder.getCheckedOutDocs()public ItemIterable<Document> getCheckedOutDocs(OperationContext context)
SessionOperationContext
.getCheckedOutDocs in interface SessionFolder.getCheckedOutDocs(OperationContext)public ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long maxNumItems)
SessiongetContentChanges in interface SessionchangeLogToken - the change log token to start from or nullincludeProperties - indicates if changed properties should be included in the
resultmaxNumItems - maximum numbers of eventspublic ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long maxNumItems, OperationContext context)
SessiongetContentChanges in interface SessionchangeLogToken - the change log token to start from or nullincludeProperties - indicates if changed properties should be included in the
resultmaxNumItems - maximum numbers of eventscontext - the OperationContextpublic OperationContext getDefaultContext()
Session
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
Session.setDefaultContext(OperationContext) to apply it.
getDefaultContext in interface Sessionpublic void setDefaultContext(OperationContext context)
SessionsetDefaultContext in interface Sessioncontext - the OperationContext to be used for the session;
if null, a default context is usedpublic OperationContext createOperationContext(Set<String> filter, boolean includeAcls, boolean includeAllowableActions, boolean includePolicies, IncludeRelationships includeRelationships, Set<String> renditionFilter, boolean includePathSegments, String orderBy, boolean cacheEnabled, int maxItemsPerPage)
SessioncreateOperationContext in interface SessionOperationContextpublic OperationContext createOperationContext()
SessioncreateOperationContext in interface Sessionpublic ObjectId createObjectId(String id)
SessioncreateObjectId in interface Sessionpublic Locale getLocale()
Sessionpublic CmisObject getObject(ObjectId objectId)
SessionOperationContext, it
will load the object from the repository and puts it into the cache.getObject in interface SessionobjectId - the object idSession.getObject(String)public CmisObject getObject(ObjectId objectId, OperationContext context)
SessionOperationContext has caching turned off, it
will load the object from the repository and puts it into the cache.getObject in interface SessionobjectId - the object idcontext - the OperationContext to useSession.getObject(String, OperationContext)public CmisObject getObject(String objectId)
SessionOperationContext, it
will load the object from the repository and puts it into the cache.getObject in interface SessionobjectId - the object idSession.getObject(ObjectId)public CmisObject getObject(String objectId, OperationContext context)
SessionOperationContext has caching turned off, it
will load the object from the repository and puts it into the cache.getObject in interface SessionobjectId - the object idcontext - the OperationContext to useSession.getObject(ObjectId, OperationContext)public CmisObject getObjectByPath(String path)
SessionOperationContext, it
will load the object from the repository and puts it into the cache.getObjectByPath in interface Sessionpath - the object pathpublic CmisObject getObjectByPath(String path, OperationContext context)
SessionOperationContext has caching turned off, it
will load the object from the repository and puts it into the cache.getObjectByPath in interface Sessionpath - the object pathcontext - the OperationContext to usepublic void removeObjectFromCache(ObjectId objectId)
SessionremoveObjectFromCache in interface SessionobjectId - object idpublic void removeObjectFromCache(String objectId)
SessionremoveObjectFromCache in interface SessionobjectId - object idpublic RepositoryInfo getRepositoryInfo()
SessiongetRepositoryInfo in interface Sessionpublic Folder getRootFolder()
SessiongetRootFolder in interface Sessionpublic Folder getRootFolder(OperationContext context)
SessionOperationContext.getRootFolder in interface Sessionpublic ItemIterable<ObjectType> getTypeChildren(String typeId, boolean includePropertyDefinitions)
SessiongetTypeChildren in interface Sessionpublic ObjectType getTypeDefinition(String typeId)
SessiongetTypeDefinition in interface Sessionpublic List<Tree<ObjectType>> getTypeDescendants(String typeId, int depth, boolean includePropertyDefinitions)
SessiongetTypeDescendants in interface Sessionpublic ItemIterable<QueryResult> query(String statement, boolean searchAllVersions)
Sessionpublic ItemIterable<QueryResult> query(String statement, boolean searchAllVersions, OperationContext context)
SessionOperationContext.
(See CMIS spec "2.1.10 Query".)public ItemIterable<CmisObject> queryObjects(String typeId, String where, boolean searchAllVersions, OperationContext context)
queryObjects in interface Sessionwhere - the WHERE part of the querysearchAllVersions - specifies if the latest and non-latest versions of document
objects should be includedcontext - the OperationContextpublic QueryStatement createQueryStatement(String statement)
SessioncreateQueryStatement in interface Sessionstatement - the query statement with placeholders ('?').QueryStatementpublic ExtensionHandler setExtensionHandler(String context, ExtensionHandler extensionHandler)
public void connect()
In dependency of the parameter set an AtomPub, a
WebService or an InMemory provider is selected.
public CmisBinding getBinding()
SessiongetBinding in interface Sessionpublic Cache getCache()
public String getRepositoryId()
public ObjectId createDocument(Map<String,?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
SessioncontentStream is consumed but not closed by
this method.createDocument in interface SessionFolder.createDocument(Map, ContentStream, VersioningState, List,
List, List, OperationContext)public ObjectId createDocumentFromSource(ObjectId source, Map<String,?> properties, ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
SessioncreateDocumentFromSource in interface SessionFolder.createDocumentFromSource(ObjectId, Map, VersioningState,
List, List, List, OperationContext)public ObjectId createFolder(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
SessioncreateFolder in interface SessionFolder.createFolder(Map, List, List, List, OperationContext)public ObjectId createPolicy(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
SessioncreatePolicy in interface SessionFolder.createPolicy(Map, List, List, List, OperationContext)public ObjectId createRelationship(Map<String,?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
SessioncreateRelationship in interface Sessionpublic ObjectId createDocument(Map<String,?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState)
SessioncontentStream is consumed but not closed by
this method.createDocument in interface SessionFolder.createDocument(Map, ContentStream, VersioningState, List,
List, List, OperationContext)public ObjectId createDocumentFromSource(ObjectId source, Map<String,?> properties, ObjectId folderId, VersioningState versioningState)
SessioncreateDocumentFromSource in interface SessionFolder.createDocumentFromSource(ObjectId, Map, VersioningState,
List, List, List, OperationContext)public ObjectId createFolder(Map<String,?> properties, ObjectId folderId)
SessioncreateFolder in interface SessionFolder.createFolder(Map, List, List, List, OperationContext)public ObjectId createPolicy(Map<String,?> properties, ObjectId folderId)
SessioncreatePolicy in interface SessionFolder.createPolicy(Map, List, List, List, OperationContext)public ObjectId createRelationship(Map<String,?> properties)
SessioncreateRelationship in interface Sessionpublic ItemIterable<Relationship> getRelationships(ObjectId objectId, boolean includeSubRelationshipTypes, RelationshipDirection relationshipDirection, ObjectType type, OperationContext context)
SessiongetRelationships in interface Sessionpublic void delete(ObjectId objectId)
Sessionpublic void delete(ObjectId objectId, boolean allVersions)
Sessionpublic ContentStream getContentStream(ObjectId docId)
SessiongetContentStream in interface SessiondocId - the id of the documentnull if the document has no
content streampublic ContentStream getContentStream(ObjectId docId, String streamId, BigInteger offset, BigInteger length)
SessiongetContentStream in interface SessiondocId - 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 streampublic Acl getAcl(ObjectId objectId, boolean onlyBasicPermissions)
SessiongetAcl in interface SessionobjectId - 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 permissionspublic Acl applyAcl(ObjectId objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
SessionapplyAcl in interface SessionobjectId - 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.REPOSITORYDETERMINEDpublic Acl setAcl(ObjectId objectId, List<Ace> aces)
Sessionpublic void applyPolicy(ObjectId objectId, ObjectId... policyIds)
SessionapplyPolicy in interface SessionobjectId - the id the objectpolicyIds - the ids of the policies to be appliedpublic void removePolicy(ObjectId objectId, ObjectId... policyIds)
SessionremovePolicy in interface SessionobjectId - the id the objectpolicyIds - the ids of the policies to be removedCopyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.