Cmis
Overview
Module
- package:
@aerokit/sdk/cms - source: cms/cmis.ts
- last updated:
This module provides a set of classes and constants for interacting with a CMIS (Content Management Interoperability Services) repository within the Dirigible environment. It allows developers to establish sessions with the repository, navigate and manipulate folders and documents, and manage content streams. The module also defines standard CMIS properties and versioning states for consistent interaction with CMIS-compliant repositories.
Key Features
- Establishing sessions with CMIS repositories
- Navigating folder structures and managing documents
- Handling content streams for document creation and retrieval
- Defining standard CMIS properties and versioning states for consistent API usage
Use Cases
- Integrating with enterprise content management systems that support CMIS
- Building applications that require document management capabilities, such as file storage, versioning, and metadata handling
- Automating content management tasks within a CMIS repository, such as bulk uploads, organization, and cleanup
Example Usage
import { Cmis } from "@aerokit/sdk/cms";
const session = Cmis.getSession();
const rootFolder = session.getRootFolder();
const newFolder = rootFolder.createFolder({ "cmis:name": "New Folder" });
const contentStream = session.getObjectFactory().createContentStream("example.txt", 11, "text/plain", new streams.ByteArrayInputStream("Hello World".getBytes()));
const newDocument = newFolder.createDocument({ "cmis:name": "Example Document" }, contentStream, Cmis.VERSIONING_STATE_MAJOR);
console.log(`Created document with ID: ${newDocument.getId()} and name: ${newDocument.getName()}`);Classes
Cmis
getSession()
Gets a new CMIS session instance to interact with the repository.
tsstatic getSession(): Session;Returns
- Type:
Session- Description: A new Session instance.
getAccessDefinitions()
Retrieves access control definitions for a specific path and method.
tsstatic getAccessDefinitions(path: string, method: string): void;
Parameter Type Description pathstringThe path of the CMIS object. methodstringThe operation method (e.g., Cmis.METHOD_READ, Cmis.METHOD_WRITE). Returns
- Type:
void- Description: A list of access definitions.
Folder
getId()
Gets the unique identifier of the folder.
tsgetId(): string;Returns
- Type:
string- Description: The folder ID.
getName()
Gets the name of the folder.
tsgetName(): string;Returns
- Type:
string- Description: The folder name.
createFolder()
Creates a new folder within this folder.
tscreateFolder(properties: any): Folder;
Parameter Type Description propertiesanyA map of CMIS properties for the new folder (must include Cmis.NAME). Returns
- Type:
Folder- Description: The newly created Folder object.
createDocument()
Creates a new document within this folder.
tscreateDocument(properties: any, contentStream: ContentStream, versioningState: string): Document;
Parameter Type Description propertiesanyA map of CMIS properties for the new document (must include Cmis.NAME). contentStreamContentStreamThe content stream containing the document's binary data. versioningStatestringThe versioning state (e.g., Cmis.VERSIONING_STATE_MAJOR). Returns
- Type:
Document- Description: The newly created Document object.
getChildren()
Retrieves the children of this folder.
tsgetChildren(): void;Returns
- Type:
void- Description: A list of generic CmisObject wrappers for the children.
getPath()
Gets the path of the folder.
tsgetPath(): string;Returns
- Type:
string- Description: The folder path.
isRootFolder()
Checks if this folder is the root folder of the repository.
tsisRootFolder(): boolean;Returns
- Type:
boolean- Description: True if it is the root folder, false otherwise.
getFolderParent()
Gets the parent folder of this folder.
tsgetFolderParent(): Folder;Returns
- Type:
Folder- Description: The parent Folder object.
delete()
Deletes this folder (must be empty to succeed).
tsdelete(): void;Returns
- Type:
void- Description:
rename()
Renames this folder.
tsrename(newName: string): void;
Parameter Type Description newNamestringThe new name for the folder. Returns
- Type:
void- Description:
deleteTree()
Deletes this folder and all its contents recursively.
tsdeleteTree(): void;Returns
- Type:
void- Description:
getType()
Gets the type definition of the folder.
tsgetType(): TypeDefinition;Returns
- Type:
TypeDefinition- Description: The folder's TypeDefinition.
Document
getId()
Gets the unique identifier of the document.
tsgetId(): string;Returns
- Type:
string- Description: The document ID.
getName()
Gets the name of the document.
tsgetName(): string;Returns
- Type:
string- Description: The document name.
getType()
Gets the type definition of the document.
tsgetType(): TypeDefinition;Returns
- Type:
TypeDefinition- Description: The document's TypeDefinition.
getPath()
Gets the path of the document.
tsgetPath(): string;Returns
- Type:
string- Description: The document path.
delete()
Deletes this document.
tsdelete(): void;Returns
- Type:
void- Description:
getContentStream()
Gets the binary content stream of the document.
tsgetContentStream(): ContentStream;Returns
- Type:
ContentStream- Description: The ContentStream object, or
nullif the document has no content.
getSize()
Gets the size of the document's content stream in bytes.
tsgetSize(): number;Returns
- Type:
number- Description: The size in bytes.
rename()
Renames this document.
tsrename(newName: string): void;
Parameter Type Description newNamestringThe new name for the document. Returns
- Type:
void- Description:
