Creating CMIS Workbench Folder using Groovy Script Workbench App
In this article, we will discuss how to create a folder in CMIS Workbench using Groovy Script Workbench App. We will cover the key concepts related to CMIS (Content Management Interoperability Services) and Groovy Script Workbench App. We will also provide detailed instructions on how to create a folder in CMIS Workbench using Groovy Script Workbench App.
What is CMIS?
CMIS (Content Management Interoperability Services) is a standard that enables interoperability between content management systems. It allows different content management systems to share data and work together seamlessly. CMIS provides a set of bindings and services that enable applications to interact with content management systems.
What is Groovy Script Workbench App?
Groovy Script Workbench App is a tool that allows users to write and execute Groovy scripts. Groovy is a powerful and dynamic programming language that is built on top of the Java Virtual Machine (JVM). Groovy Script Workbench App provides a user-friendly interface that enables users to write and execute Groovy scripts without having to install any additional software.
Creating a Folder in CMIS Workbench using Groovy Script Workbench App
To create a folder in CMIS Workbench using Groovy Script Workbench App, follow the steps below:
- Open Groovy Script Workbench App and create a new script.
- Import the necessary libraries for CMIS.
@Grab('org.apache.chemistry.opencmis:chemistry-opencmis-client-api:1.1.0')
import org.apache.chemistry.opencmis.client.api.*
import org.apache.chemistry.opencmis.client.runtime.*
import org.apache.chemistry.opencmis.commons.SessionParameter
import org.apache.chemistry.opencmis.commons.enums.*
- Define the CMIS repository and session.
def repository = "My Repository"
def username = "myusername"
def password = "mypassword"
def url = "http://localhost:8080/chemistry-opencmis/browser"
def parameters = [SessionParameter.ATOMPUB_URL: url,
SessionParameter.BINDING_TYPE: BindingType.ATOMPUB,
SessionParameter.REPOSITORY_ID: repository,
SessionParameter.USER: username,
SessionParameter.PASSWORD: password]
def session = SessionFactory.newInstance().createSession(parameters)
- Create a new folder in CMIS Workbench.
def parentFolder = session.getRootFolder()
def folderName = "My Folder"
def folderProperties = new HashMap()
folderProperties.put(PropertyIds.OBJECT_TYPE_ID, Folder.FOLDER_TYPE_ID)
folderProperties.put(PropertyIds.NAME, folderName)
def folder = parentFolder.createFolder(folderProperties)
- Save and execute the script.
The above script will create a new folder named "My Folder" in the root folder of the CMIS Workbench.
Key Concepts
- CMIS (Content Management Interoperability Services) is a standard that enables interoperability between content management systems.
- Groovy Script Workbench App is a tool that allows users to write and execute Groovy scripts.
- The above script imports the necessary libraries for CMIS, defines the CMIS repository and session, creates a new folder in CMIS Workbench, and saves and executes the script.
Summary
In this article, we discussed how to create a folder in CMIS Workbench using Groovy Script Workbench App. We covered the key concepts related to CMIS and Groovy Script Workbench App. We also provided detailed instructions on how to create a folder in CMIS Workbench using Groovy Script Workbench App.
References
- Apache Chemistry OpenCMIS: https://chemistry.apache.org/java/opencmis.html
- Groovy Script Workbench App: https://groovy.jfrog.io/artifactory/libs-releases-local/org/codehaus/groovy/groovy-script-workbench/2.0.0/groovy-script-workbench-2.0.0.jar