You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Florian Müller (JIRA)" <ji...@apache.org> on 2015/02/03 17:40:35 UTC

[jira] [Commented] (CMIS-889) CmisObjectNotFoundException when creating if document is deleted in transaction

    [ https://issues.apache.org/jira/browse/CMIS-889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14303550#comment-14303550 ] 

Florian Müller commented on CMIS-889:
-------------------------------------

Use {{[Session.createDocument()|https://chemistry.apache.org/java/0.12.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Session.html#createDocument%28java.util.Map,%20org.apache.chemistry.opencmis.client.api.ObjectId,%20org.apache.chemistry.opencmis.commons.data.ContentStream,%20org.apache.chemistry.opencmis.commons.enums.VersioningState%29]}} instead of {{Folder.createDocument()}}.

{{Folder.createDocument()}} tries to load the document after it has been created to return a {{Document}} object. {{Session.createDocument()}} only returns the document ID and does not need to load the document.

Alternatively, use {{[Folder.createDocument()|https://chemistry.apache.org/java/0.12.0/maven/apidocs/org/apache/chemistry/opencmis/client/api/Folder.html#createDocument%28java.util.Map,%20org.apache.chemistry.opencmis.commons.data.ContentStream,%20org.apache.chemistry.opencmis.commons.enums.VersioningState,%20java.util.List,%20java.util.List,%20java.util.List,%20org.apache.chemistry.opencmis.client.api.OperationContext%29]}} and supply {{null}} as the operation context. That also prevents loading the newly created document.

> CmisObjectNotFoundException when creating if document is deleted in transaction
> -------------------------------------------------------------------------------
>
>                 Key: CMIS-889
>                 URL: https://issues.apache.org/jira/browse/CMIS-889
>             Project: Chemistry
>          Issue Type: Bug
>          Components: opencmis-client
>    Affects Versions: OpenCMIS 0.12.0
>         Environment: CMIS Workbench Groovy Console
>            Reporter: Igor Blanco
>            Priority: Minor
>
> I'm using Folder object's createDocument method to upload a file to an Alfresco folder. I have a rule on that folder tha takes some information from the file and then deletes it.
> Everything works in Alfresco as expected but the createDocument method throws a CmisObjectNotFoundException. I suppose this is due to the fact that the document that it is trying to return is already a deleted content by the time the call ends. 
> Is there any reasonable way of doing this apart from catching the exception ?  I thought about not deleting the file in Alfresco and letting cmis do so but that would imply that 2 transactions would be used and potentially the operation could end in the middle of both of them.
> I'm aware this is more a question for a forum than a bug but couldn't find a proper forum for OpenCMIS and writing it to the developer mailing list was IMHO an even worse option.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)