You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by Kar Tech <ka...@gmail.com> on 2018/09/04 15:07:27 UTC
Inmemory cmis instance does not support creating document with
version state
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;
}
Re: Inmemory cmis instance does not support creating document with
version state
Posted by Jeff Potts <je...@gmail.com>.
Kar,
Did you forget to include the error you are seeing?
Jeff
On Tue, Sep 4, 2018 at 10:23 AM Kar Tech <ka...@gmail.com> 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<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;
> }
>