public class

ChemistryCMISFacade

extends Object
implements CMISFacade
java.lang.Object
   ↳ org.mule.module.cmis.ChemistryCMISFacade

Class Overview

Implementation of CMISFacade that use Apache Chemistry Project.

Summary

Fields
private Map<String, String> connectionParameters
private Session session
Public Constructors
ChemistryCMISFacade(String username, String password, String repositoryId, String baseURL, boolean useAtomPub)
Public Methods
Acl applyAcl(CmisObject cmisObject, String objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
Set the permissions associated with an object.
void applyPolicy(CmisObject cmisObject, String objectId, List<ObjectId> policyIds)
Applies policies to this object.
void cancelCheckOut(CmisObject document, String documentId)
If applied to a PWC (private working copy) of the document, the check out will be reversed.
ChangeEvents changelog(String changeLogToken, boolean includeProperties)
Gets repository changes.
ObjectId checkIn(CmisObject document, String documentId, Object content, String filename, String mimeType, boolean major, String checkinComment, Map<String, String> properties)
If applied to a PWC (private working copy) it performs a check in.
ObjectId checkOut(CmisObject document, String documentId)
Checks out the document and returns the object id of the PWC (private working copy).
static ContentStream createContentStream(String filename, String mimeType, Object content)
ObjectId createDocumentById(String objectId, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties)
Creates a new document in the repository.
ObjectId createDocumentByPath(String folderPath, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties, boolean force)
Creates a new document in the repository.
ObjectId createFolder(String folderName, String parentObjectId)
Creates a folder.
void delete(CmisObject cmisObject, String objectId, boolean allVersions)
Remove an object
List<String> deleteTree(CmisObject folder, String folderId, boolean allversions, UnfileObject unfile, boolean continueOnFailure)
Deletes a folder and all subfolders.
Object folder(Folder folder, String folderId, NavigationOptions get, Integer depth, String filter, String orderBy)
Navigates the folder structure.
Acl getAcl(CmisObject cmisObject, String objectId)
Returns the ACL if it has been fetched for an object.
List<Document> getAllVersions(CmisObject document, String documentId, String filter, String orderBy)
Retrieve an object's version history
List<Policy> getAppliedPolicies(CmisObject cmisObject, String objectId)
Get the policies that are applied to an object.
ItemIterable<Document> getCheckoutDocs(String filter, String orderBy)
Retrieve list of checked out documents.
ContentStream getContentStream(CmisObject cmisObject, String objectId)
Retrieves the content stream of a Document.
CmisObject getObjectById(String objectId)
Returns a CMIS object from the repository and puts it into the cache.
CmisObject getObjectByPath(String path)
Returns a CMIS object from the repository and puts it into the cache.
List<Relationship> getObjectRelationships(CmisObject cmisObject, String objectId)
Returns the relationships if they have been fetched for an object.
List<Folder> getParentFolders(CmisObject cmisObject, String objectId)
Retrieves the parent folders of a fileable cmis object
ObjectType getTypeDefinition(String typeId)
Returns the type definition of the given type id.
FileableCmisObject moveObject(FileableCmisObject cmisObject, String objectId, String sourceFolderId, String targetFolderId)
Moves a fileable cmis object from one location to another.
ItemIterable<QueryResult> query(String statement, Boolean searchAllVersions, String filter, String orderBy)
Sends a query to the repository
List<Repository> repositories()
RepositoryInfo repositoryInfo()
Returns information about the CMIS repository, the optional capabilities it supports and its Access Control information if applicable.
CmisObject updateObjectProperties(CmisObject cmisObject, String objectId, Map<String, String> properties)
Update an object's properties
Protected Methods
ObjectId createDocument(CmisObject folder, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> extraProperties)
create a document
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.mule.module.cmis.CMISFacade

Fields

private Map<String, String> connectionParameters

private Session session

Public Constructors

public ChemistryCMISFacade (String username, String password, String repositoryId, String baseURL, boolean useAtomPub)

Parameters
username
password
repositoryId
baseURL
useAtomPub

Public Methods

public Acl applyAcl (CmisObject cmisObject, String objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)

Set the permissions associated with an object.

<cmis:get-acl objectId="workspace://SpacesStore/64b078f5-3024-403b-b133-fa87d0060f28" />

Parameters
cmisObject The object whose Acl is intended to change.
objectId The object's id. Can be null if "cmisObject" is set.
addAces Added access control entities
removeAces Removed access control entities
aclPropagation Wheter to propagate changes or not. can be REPOSITORYDETERMINED | OBJECTONLY | PROPAGATE
Returns
  • the new access control list

public void applyPolicy (CmisObject cmisObject, String objectId, List<ObjectId> policyIds)

Applies policies to this object.

Parameters
cmisObject The document from which to get the stream. Can be null if "objectId" is set.
objectId Id of the document from which to get the stream. Can be null if "object" is set.
policyIds Policy ID's to apply

public void cancelCheckOut (CmisObject document, String documentId)

If applied to a PWC (private working copy) of the document, the check out will be reversed. Otherwise, an exception will be thrown.

Parameters
document The checked out document. Can be null if "documentId" is set.
documentId Id of the checked out document. Can be null if "document" is set.

public ChangeEvents changelog (String changeLogToken, boolean includeProperties)

Gets repository changes.

Parameters
changeLogToken The change log token to start from or null
includeProperties Indicates if changed properties should be included in the result
Returns
  • the changelog events

public ObjectId checkIn (CmisObject document, String documentId, Object content, String filename, String mimeType, boolean major, String checkinComment, Map<String, String> properties)

If applied to a PWC (private working copy) it performs a check in. Otherwise, an exception will be thrown.

Parameters
document The document to check-in. Can be null if "documentId" is set.
documentId Id of the document to check-in. Can be null if "document" is set.
content File content (no byte array or input stream for now)
filename Name of the file
mimeType Stream content-type
major Whether it is major
checkinComment Check-in comment
properties Custom properties
Returns
  • the ObjectId of the checkedin document

public ObjectId checkOut (CmisObject document, String documentId)

Checks out the document and returns the object id of the PWC (private working copy).

Parameters
document The document to be checked out. Can be null if "documentId" is set.
documentId Id of the document to be checked out. Can be null if "document" is set.
Returns
  • PWC ObjectId

public static ContentStream createContentStream (String filename, String mimeType, Object content)

Parameters
filename
mimeType
content

public ObjectId createDocumentById (String objectId, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties)

Creates a new document in the repository.

Parameters
objectId Folder Object Id
filename Name of the file
content File content (no byte array or input stream for now)
mimeType Stream content-type
versioningState An enumeration specifying what the versioing state of the newly-created object MUST be. If the repository does not support versioning, the repository MUST ignore the versioningState parameter. Valid values are: o none: The document MUST be created as a non-versionable document. o checkedout: The document MUST be created in the checked-out state. o major (default): The document MUST be created as a major version o minor: The document MUST be created as a minor version.
objectType The type of the object
properties The properties optional document properties to set
Returns
  • the object id ObjectId of the created

public ObjectId createDocumentByPath (String folderPath, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties, boolean force)

Creates a new document in the repository.

Parameters
folderPath Folder in the repository that will hold the document
filename Name of the file
content File content (no byte array or input stream for now)
mimeType Stream content-type
versioningState An enumeration specifying what the versioing state of the newly-created object MUST be. If the repository does not support versioning, the repository MUST ignore the versioningState parameter. Valid values are: o none: The document MUST be created as a non-versionable document. o checkedout: The document MUST be created in the checked-out state. o major (default): The document MUST be created as a major version o minor: The document MUST be created as a minor version.
objectType The type of the object
properties The properties optional document properties to set
force If should folder structure must be created when there are missing intermediate folders
Returns
  • the object id ObjectId of the created

public ObjectId createFolder (String folderName, String parentObjectId)

Creates a folder. Note that this is not recusive creation. You just create one folder

Parameters
folderName Folder name (eg: "my documents")
parentObjectId Parent folder for the folder being created (eg: repository.rootFolder)
Returns
  • the object id ObjectId of the created

public void delete (CmisObject cmisObject, String objectId, boolean allVersions)

Remove an object

Parameters
cmisObject The object to be deleted. Can be null if "objectId" is set.
objectId The object's id. Can be null if "cmisObject" is set.
allVersions If true, deletes all version history of the object. Defaults to "false".

public List<String> deleteTree (CmisObject folder, String folderId, boolean allversions, UnfileObject unfile, boolean continueOnFailure)

Deletes a folder and all subfolders.

Parameters
folder Folder Object. Can be null if "folderId" is set.
folderId Folder Object id. Can be null if "folder" is set.
allversions If true, then delete all versions of the document. If false, delete only the document object specified.
unfile Specifies how the repository must process file-able child- or descendant-objects.
continueOnFailure Specified whether to continue attempting to perform this operation even if deletion of a child- or descendant-object in the specified folder cannot be deleted or not.
Returns
  • a list of object ids which failed to be deleted.

public Object folder (Folder folder, String folderId, NavigationOptions get, Integer depth, String filter, String orderBy)

Navigates the folder structure.

Parameters
folder Folder Object. Can be null if "folderId" is set.
folderId Folder Object id. Can be null if "folder" is set.
get NavigationOptions that specifies whether to get the parent folder, the list of immediate children or the whole descendants tree
depth If "get" value is DESCENDANTS, represents the depth of the descendants tree
filter Comma-separated list of properties to filter (only for CHILDREN or DESCENDANTS navigation)
orderBy Comma-separated list of query names and the ascending modifier "ASC" or the descending modifier "DESC" for each query name (only for CHILDREN or DESCENDANTS navigation)
Returns
  • the following, depending on the value of "get" parameter:
    • PARENT: returns the parent Folder
    • CHILDREN: returns a CmisObject ItemIterable with objects contained in the current folder
    • DESCENDANTS: List> representing the whole descentants tree of the current folder
    • TREE: List> representing the directory structure under the current folder.

public Acl getAcl (CmisObject cmisObject, String objectId)

Returns the ACL if it has been fetched for an object.

Parameters
cmisObject The object whose Acl is needed
objectId The object's id. Can be null if "cmisObject" is set.
Returns
  • the object's Acl Acl

public List<Document> getAllVersions (CmisObject document, String documentId, String filter, String orderBy)

Retrieve an object's version history

Parameters
document The document whose versions are to be retrieved
documentId Id of the document whose versions are to be retrieved
filter Comma-separated list of properties to filter (only for CHILDREN or DESCENDANTS navigation)
orderBy Comma-separated list of query names and the ascending modifier "ASC" or the descending modifier "DESC" for each query name (only for CHILDREN or DESCENDANTS navigation)
Returns
  • versions of the document.

public List<Policy> getAppliedPolicies (CmisObject cmisObject, String objectId)

Get the policies that are applied to an object.

Parameters
cmisObject The document from which to get the stream. Can be null if "objectId" is set.
objectId Id of the document from which to get the stream. Can be null if "object" is set.
Returns
  • List of applied policies

public ItemIterable<Document> getCheckoutDocs (String filter, String orderBy)

Retrieve list of checked out documents.

Parameters
filter Comma-separated list of properties to filter
orderBy Comma-separated list of query names and the ascending modifier "ASC" or the descending modifier "DESC" for each query name
Returns
  • list of documents

public ContentStream getContentStream (CmisObject cmisObject, String objectId)

Retrieves the content stream of a Document.

Parameters
cmisObject The document from which to get the stream. Can be null if "objectId" is set.
objectId Id of the document from which to get the stream. Can be null if "object" is set.
Returns
  • The content stream of the document.

public CmisObject getObjectById (String objectId)

Returns a CMIS object from the repository and puts it into the cache.

Parameters
objectId The object id
Returns
  • a CmisObject instance

public CmisObject getObjectByPath (String path)

Returns a CMIS object from the repository and puts it into the cache.

Parameters
path Path of the object to retrieve
Returns
  • a CmisObject instance

public List<Relationship> getObjectRelationships (CmisObject cmisObject, String objectId)

Returns the relationships if they have been fetched for an object.

Parameters
cmisObject The object whose relationships are needed
objectId The object's id. Can be null if "cmisObject" is set.
Returns
  • list of Relationship the object's relationships

public List<Folder> getParentFolders (CmisObject cmisObject, String objectId)

Retrieves the parent folders of a fileable cmis object

Parameters
cmisObject The object whose parent folders are needed. can be null if "objectId" is set.
objectId Id of the object whose parent folders are needed. can be null if "object" is set.
Returns
  • a list of the object's parent folders.

public ObjectType getTypeDefinition (String typeId)

Returns the type definition of the given type id.

Parameters
typeId Object type Id
Returns
  • type of object

public FileableCmisObject moveObject (FileableCmisObject cmisObject, String objectId, String sourceFolderId, String targetFolderId)

Moves a fileable cmis object from one location to another. Take into account that a fileable object may be filled in several locations. Thats why you must specify a source folder.

Parameters
cmisObject The object to move. Can be null if "objectId" is set.
objectId The object's id. Can be null if "cmisObject" is set.
sourceFolderId Id of the source folder
targetFolderId Id of the target folder
Returns
  • The object moved (FileableCmisObject)

public ItemIterable<QueryResult> query (String statement, Boolean searchAllVersions, String filter, String orderBy)

Sends a query to the repository

Parameters
statement The query statement (CMIS query language)
searchAllVersions Specifies if the latest and non-latest versions of document objects should be included
filter Comma-separated list of properties to filter
orderBy Comma-separated list of query names and the ascending modifier "ASC" or the descending modifier "DESC" for each query name
Returns
  • an iterable of QueryResult

public List<Repository> repositories ()

public RepositoryInfo repositoryInfo ()

Returns information about the CMIS repository, the optional capabilities it supports and its Access Control information if applicable.

Returns
  • a RepositoryInfo object

public CmisObject updateObjectProperties (CmisObject cmisObject, String objectId, Map<String, String> properties)

Update an object's properties

Parameters
cmisObject Object to be updated. Can be null if "objectId" is set.
objectId The object's id. Can be null if "cmisObject" is set.
properties The properties to update
Returns
  • The updated object (a repository might have created a new object)

Protected Methods

protected ObjectId createDocument (CmisObject folder, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> extraProperties)

create a document

Parameters
folder
filename
content
mimeType
versioningState
objectType
extraProperties