Skip to content

convertigo/c8oprj-lib-opencmis

Repository files navigation

lib_OpenCMIS

CMIS connector to Alfresco

This is the CMIS connector for Convertigo enabling to read and put file in CMIS repositories such as Alfresco. The Connector relies on the Apache OpenCMIS library.

For more technical informations : documentation

Installation

  1. In your Convertigo Studio click on to import a project in the treeview

  2. In the import wizard

    paste the text below into the Project remote URL field:

    UsageClick the copy button at the end of the line
    To contribute
    lib_OpenCMIS=https://github.com/convertigo/c8oprj-lib-opencmis.git:branch=master
    
    To simply use
    lib_OpenCMIS=https://github.com/convertigo/c8oprj-lib-opencmis/archive/master.zip
    
  3. Click the Finish button. This will automatically import the lib_OpenCMIS project

Sequences

CheckConnect

Check if the CMIS session is still alive.

Will return isConnected true/false and the session name if available.

Output

{
  "result": {
    "isConnected": true,
    "session": "Session 9b6cc4b7-5b83-43f0-a2ad-d5d1939a378b",
    "name": "",
    "id": "-default-",
    "description": "",
    "version": "1.1",
    "vendor": "Alfresco",
    "product": "Alfresco Community",
    "root": "4d92ecbb-c391-452a-92ec-bbc391852a98"
  }
}

Connect

Establish a Session between Convertigo and the Target CMIS (Alfresco)

Has to be called before any other Sequence. The session will be automatically held in the Convertigo Session.

Will return the list of folders of the users root Directory with folder name, id and folder path.

Output

{
  "folders": [
    {
      "name": "Shared",
      "path": "/Shared",
      "id": "16cfc56d-eb6c-4420-8fc5-6deb6c0420c5"
    },
    {
      "name": "Imap Attachments",
      "path": "/Imap Attachments",
      "id": "78f06647-0b12-4dea-b066-470b12bdeae5"
    },
    ...
  ]
}

variables

namecomment
bindingTypeProtocol used to communicate with a CMIS repository. By default, auto-detected with the url. Allowed values : AtomPub, Browser, auto.
passwordPassword to access the CMIS
repoIDThe repository ID to access. use '-default-' for Alfresco
session_parametersThe parameters added to the session creation. In the array, add a string formated like this : "key;value"
urlTarget CMIS URL, for example use http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom for Alfresco
userUser name to acess the CMIS

DeleteObject

Deletes a file or a folder from a CMIS repository.

Use docPath variable to search a document by its Path. Or Use docID variable to search a document by its Id. Do not fill both variables or you will have an error.

Output

{
  "result": [{
    "id": "2f9c8608-c2ca-435a-9c86-08c2ca235ab1;1.0",
    "name": "camera4.gif",
    "creator": "admin",
    "creationDate": "2025-06-04T16:33:17Z",
    "fileSize": 22982,
    "mimeType": "image/gif",
    "properties": [
      {
        "id": "alfcmis:nodeRef",
        "name": "Alfresco Node Ref",
        "value": "workspace://SpacesStore/2f9c8608-c2ca-435a-9c86-08c2ca235ab1"
      },
      {
        "id": "cmis:isImmutable",
        "name": "Is Immutable",
        "value": false
      },
      ...
    ]
  }]
}

variables

namecomment
allVersionsIf true, deletes all the document versions.
If false, deletes only the last version or only the provided version with the docID like: '5d47bb40-e241-4fe7-87bb-40e2416fe76a;1.0'
docIDCMIS ID of the file to delete. For example '30d4ef19-c3c2-4611-94ef-19c3c2e6114e'
docPathCMIS Path of the file to delete. For example '/MyFolder/Myfile.doc'

GetFile

Gets a file from CMIS repository. The file will be retrieved and saved in a temp directory. When you finish using this file you should delete it. The sequence will return the full path of the output file.

Use docPath variable to search a document by its Path. Or Use docID variable to search a document by its Id. Do not fill both variables or you will have an error.

Can directly perform a download of the file if called with .bin requester.

Output

JSON requester:

{
  "result": [{
    "filePath": "C:\\Users\\grego\\AppData\\Local\\Temp\\C8oCMIS_11422265988976522516_camera4.gif",
    "id": "2f9c8608-c2ca-435a-9c86-08c2ca235ab1;1.0",
    "name": "camera4.gif",
    "creator": "admin",
    "creationDate": "2025-06-04T16:33:17Z",
    "fileSize": 22982,
    "mimeType": "image/gif",
    "properties": [
      {
        "id": "alfcmis:nodeRef",
        "name": "Alfresco Node Ref",
        "value": "workspace://SpacesStore/2f9c8608-c2ca-435a-9c86-08c2ca235ab1"
      },
      {
        "id": "cmis:isImmutable",
        "name": "Is Immutable",
        "value": false
      },
      ...
    ]
  }]
}

BIN requester:

{
  "attachment": {
    "text": "",
    "attr": {
      "content-type": "application/octet-stream",
      "local-url": "C:\\Users\\grego\\AppData\\Local\\Temp\\C8oCMIS_4184593159847966614_myFile.pdf",
      "name": "myFile.pdf",
      "type": "attachment"
    }
  }
}

variables

namecomment
autoDelFileAutomatically delete file from temporary folder when user session expires. Default is false.
docIDCMIS ID of the file to retrieve. For example '30d4ef19-c3c2-4611-94ef-19c3c2e6114e'
docPathCMIS Path of the file to retrieve. For example '/MyFolder/Myfile.doc'

GetFolders

Get children folders from folderID or folderPath folder.

Output

{
  "folders": {
    "parentFolder": "Company Home",
    "isRootFolder": true,
    "children": [
      {
        "id": "28759eee-6181-45ee-b59e-ee618185ee3d",
        "name": "Shared",
        "path": "/Shared",
        "description": "Folder to store shared stuff",
        "isRootFolder": false,
        "creator": "System",
        "creationDate": "2025-06-06T17:01:07Z"
      },
      ...
  	]
  }
}

variables

namecomment
folderIDTarget ID in the CMIS. For example '16cfc56d-eb6c-4420-8fc5-6deb6c0420c5'
folderPathTarget path in the CMIS. For example '/MyFolder'
typeType of Document to display. Can be "folder" only, "file" only or "both".

PutFiles

Puts a file in a CMIS repository.

The Sequence will return the folder where the file has been placed.

Use folderPath variable to put a document in a folder by its Path. Or Use folderID variable to put a document in a folder by its Id. Do not fill both variables or you will have an error.

Set one or multiple values for the filePaths variable to upload one or multiple documents.

If you set the fileNames values for each document, this will change the default file names from the filePaths variable. Set 'null' or empty if you don't want to change file name.

You can add document properties using the properties variable. Set 'null' or empty if you don't want to add properties for a file. Set an array of objects with name/value key value pairs. For example: [{"name": "cmis:description", "value": "sample PDF file created by GV"}]

Output

{
  "result": [{
    "filePath": "/Shared/myFile.pdf",
    "id": "1e1d7d10-a8cd-4e8f-9d7d-10a8cd2e8f10;1.0",
    "name": "myFile.pdf",
    "creator": "admin",
    "creationDate": "2025-06-06T15:37:05Z",
    "fileSize": 19475,
    "mimeType": "application/pdf",
    "properties": [
        {
          "id": "alfcmis:nodeRef",
          "name": "Alfresco Node Ref",
          "value": "workspace://SpacesStore/2f60771b-92bc-4ac4-a077-1b92bc5ac4b4"
        },
        ...
  }, ...]
}

variables

namecomment
fileNames(Optional) File names of the files to upload to CMIS. If none is provided, it will use the default file names from filePaths variable.
filePathsFull Paths of the files to upload to CMIS.
folderIDTarget ID in the CMIS. For example '16cfc56d-eb6c-4420-8fc5-6deb6c0420c5'
folderPathTarget path in the CMIS. For example '/MyFolder'
properties(Optional) Properties array for the files. Each entry is a JSON object with the properties to set for the file.
{
	name: property_name,
	value: property_value
}

Set 'null' or empty if you don't want to add properties for a file.

returnPropsIf true, will return all props for each files added
secondaries(Optional) Secondary Types array for the files. Each entry is a JSON array with the aspects to add for the file.

For example:

[
	"P:cm:titled",
	"P:custom:prop"
]

Set 'null' or empty if you don't want to add secondary Types for a file.

UpdateProperties

Updates file properties in a CMIS repository.

Use docPath variable to search a document by its Path. Or Use docID variable to search a document by its Id. Do not fill both variables or you will have an error.

You can pudate document properties using the properties variable. Set an array of objects with name/value key value pairs. For example: [{"name": "cmis:description", "value": "sample PDF file created by GV"}]

Output

{
  "result": [{
    "filePath": "/Shared/myFile.pdf",
    "id": "1e1d7d10-a8cd-4e8f-9d7d-10a8cd2e8f10;1.0",
    "name": "myFile.pdf",
    "creator": "admin",
    "creationDate": "2025-06-06T15:37:05Z",
    "fileSize": 19475,
    "mimeType": "application/pdf",
    "properties": [
        {
          "id": "alfcmis:nodeRef",
          "name": "Alfresco Node Ref",
          "value": "workspace://SpacesStore/2f60771b-92bc-4ac4-a077-1b92bc5ac4b4"
        },
        ...
  }, ...]
}

variables

namecomment
docIDCMIS Id of the file whose properties are to be updated. For example '30d4ef19-c3c2-4611-94ef-19c3c2e6114e'
docPathCMIS Path of the file whose properties are to be updated. For example '/MyFolder/Myfile.doc'
properties(Optional) Properties array for the file. Each entry is a JSON object with the properties to update for the file.

[ { name: property_name, value: property_value } ]

secondaries(Optional) Secondary Types array for the files. JSON array with the aspects to add for the file.

About

This is the CMIS connector for Convertigo enabling to read, and put file in CMIS repositories such as Alfresco. The Connector relies on the Apache OpenCMIS library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors