public class

CMISCloudConnector

extends Object
implements CMISFacade
java.lang.Object
   ↳ org.mule.module.cmis.CMISCloudConnector
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

CMIS (Content Management Interoperability Services) is a standard for improving interoperability between ECM systems.

Summary

Fields
private String connectionIdentifier
private CMISFacade facade Reference to a CMISFacade implementation in case you want to use another implementation or initialize the default in a diferent way.
private Object threadSafeLock
Public Constructors
CMISCloudConnector()
Public Methods
Acl applyAcl(CmisObject cmisObject, String objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
Set the permissions associated with an object.
void applyAspect(String objectId, String aspectName, Map<String, String> properties)
Apply and aspect to an object and set some properties of that aspect.
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).
void connect(String username, String password, String baseUrl, String repositoryId, String endpoint, String connectionTimeout, String useAlfrescoExtension, String cxfPortProvider)
Connects to CMIS
ObjectId createDocumentById(String folderId, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties)
Creates a new document in the repository where the content comes directly from the payload and the target folder node is specified by an object ID.
ObjectId createDocumentByIdFromContent(String folderId, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties)
Creates a new document in the repository where the content comes directly from the payload and the target folder node is specified by an object ID.
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 where the content comes directly from the payload and the target folder node is specified by a repository path.
ObjectId createDocumentByPathFromContent(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 where the content is specified as the value of the "content" parameter and the target folder node is specified by a repository path.
ObjectId createFolder(String folderName, String parentObjectId)
Creates a folder.
ObjectId createRelationship(String parentObjectId, String childObjectId, String relationshipType)
Creates a parent/child relationships between two nodes in the repository of the specified relationship object type.
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.
void disconnect()
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.
String getConnectionIdentifier()
ContentStream getContentStream(CmisObject cmisObject, String objectId)
Retrieves the content stream of a Document.
CMISFacade getFacade()
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.
CmisObject getOrCreateFolderByPath(String folderPath)
Creates a new folder in the repository if it doesn't already exist.
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.
boolean isConnected()
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()
Returns all repositories that are available at the endpoint.
RepositoryInfo repositoryInfo()
Returns information about the CMIS repository, the optional capabilities it supports and its Access Control information if applicable.
void setConnectionIdentifier(String connectionIdentifier)
void setFacade(CMISFacade facade)
CmisObject updateObjectProperties(CmisObject cmisObject, String objectId, Map<String, String> properties)
Update an object's properties

[Expand]
Inherited Methods
From class java.lang.Object
From interface org.mule.module.cmis.CMISFacade

Fields

private String connectionIdentifier

private CMISFacade facade

Reference to a CMISFacade implementation in case you want to use another implementation or initialize the default in a diferent way. Using this option make useless the other attributes.

private Object threadSafeLock

Public Constructors

public CMISCloudConnector ()

Public Methods

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

Set the permissions associated with an object.

Parameters
cmisObject The object whose Acl is intended to change.
objectId The id of the object
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 applyAspect (String objectId, String aspectName, Map<String, String> properties)

Apply and aspect to an object and set some properties of that aspect.

Parameters
objectId The object's id.
aspectName The name of the aspect to be applied to the object.
properties The properties to set.
Returns
  • The updated object (a repository might have created a new object)

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
  • a ChangeEvents instance

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 void connect (String username, String password, String baseUrl, String repositoryId, String endpoint, String connectionTimeout, String useAlfrescoExtension, String cxfPortProvider)

Connects to CMIS

Parameters
username CMIS username
password CMIS password
baseUrl URL base for the SOAP connector
repositoryId The identifier for the Repository that this connector instance works with
endpoint The type of endpoint. Values: SOAP or ATOMPUB
connectionTimeout The connection time-out specification
useAlfrescoExtension Specifies whether the Alfresco Object Factory implementation should be utilized, the Alfresco CMIS extension JAR must be included in your Mule application in order for this configuration to work.
cxfPortProvider Specifies CXF port provider, the CMIS connector includes a default implementation but allows to set a custom implementation by extending org.apache.chemistry.opencmis.client.bindings.spi.webservices.AbstractPortProvider
Throws
ConnectionException

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

Creates a new document in the repository where the content comes directly from the payload and the target folder node is specified by an object ID.

Parameters
folderId Folder Object Id
filename Name of the file
content File content as specified in the payload
mimeType Stream content-type
versioningState An enumeration specifying what the versioning 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 createDocumentByIdFromContent (String folderId, String filename, Object content, String mimeType, VersioningState versioningState, String objectType, Map<String, String> properties)

Creates a new document in the repository where the content comes directly from the payload and the target folder node is specified by an object ID. *

Parameters
folderId Folder Object Id
filename Name of the file
content File content
mimeType Stream content-type
versioningState An enumeration specifying what the versioning 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 where the content comes directly from the payload and the target folder node is specified by a repository path. *

Parameters
folderPath Folder in the repository that will hold the document
filename Name of the file
content File content as specified in the payload
mimeType Stream content-type
versioningState An enumeration specifying what the versioning 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 checked-out: 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 createDocumentByPathFromContent (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 where the content is specified as the value of the "content" parameter and the target folder node is specified by a repository path.

Parameters
folderPath Folder in the repository that will hold the document
filename Name of the file
content File content
mimeType Stream content-type
versioningState An enumeration specifying what the versioning state of the newly-created object MUST be. If the repository does not support versioning, the repository MUST ignore the versioningState parameter.
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 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 ObjectId of the created

public ObjectId createRelationship (String parentObjectId, String childObjectId, String relationshipType)

Creates a parent/child relationships between two nodes in the repository of the specified relationship object type.

Parameters
parentObjectId The ID of the parent (or source) object in the relationship.
childObjectId The ID of the child (or target) object in the relationship.
relationshipType The name of the relationship type that should be associated with the objects.
Returns
  • The ObjectId that is the result of the relationship

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 void disconnect ()

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 id of the object
Returns
  • the object's 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 Document.

public String getConnectionIdentifier ()

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 CMISFacade getFacade ()

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 id of the object
Returns
  • list of the object's relationships

public CmisObject getOrCreateFolderByPath (String folderPath)

Creates a new folder in the repository if it doesn't already exist.

Parameters
folderPath Path to the folder
Returns
  • the ObjectId of the created

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 ObjectType

public boolean isConnected ()

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 ()

Returns all repositories that are available at the endpoint.

Returns
  • a list of Repository.

public RepositoryInfo repositoryInfo ()

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

Returns
  • a RepositoryInfo instance

public void setConnectionIdentifier (String connectionIdentifier)

Parameters
connectionIdentifier

public void setFacade (CMISFacade facade)

Parameters
facade

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)