Hi Dev Team,

I am trying to create a document against the inmemory CMIS instance that is
locally running in my machine.

I get the below error, when I try to create a document with
VersioningState.MAJOR

Does my in memory instance need to be setup with any specify operation
context to support versioning? or is there any other setup required ?
Based on the apache documentation, seems like versioning is automatically
supported.

Below is my createDocument method for reference

Thanks
Kar

private static Document createDocument(UserSession userSession, Folder
parentFolder, String documentName, byte[] data, String mimeType,
Map<String, Object> metadata ) throws ActionNotEntitledException {
    Document document;
    if(isActionEntitled(Action.CAN_CREATE_DOCUMENT,
parentFolder.getAllowableActions().getAllowableActions())){
        ByteArrayInputStream stream = new ByteArrayInputStream(data);
        ContentStream contentStream =
userSession.getSession().getObjectFactory().createContentStream(documentName,
data.length, mimeType, stream);

        // prepare properties
        Map<String, Object> documentProperties = new HashMap<>();
        documentProperties.put(PropertyIds.NAME, documentName);
        documentProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
        document = parentFolder.createDocument(documentProperties,
contentStream,  VersioningState.MAJOR, null, null,null, );
        //Add secondary properties such as aspect properties
        if(metadata != null && !metadata.isEmpty()){
            document.updateProperties(metadata);
        }
    }
    else{
        throw new ActionNotEntitledException("User " +
userSession.getUserName() + " not entitled to create Document");
    }
    return document;
}

Reply via email to