Kar,
Did you forget to include the error you are seeing?
Jeff
On Tue, Sep 4, 2018 at 10:23 AM Kar Tech wrote:
> 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 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 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;
> }
>