cancel
Showing results for 
Search instead for 
Did you mean: 

Updating document by specifying different content model

mr_t
Champ in-the-making
Champ in-the-making
Hi,

I'd like to know the correct behavior when trying to up date a document using different content model via CMIS.
I have a document created based on a content model and I'm updating/replacing the document using the same name but using a different content model.
If I set the update option on existing document to use major or minor version, it triggers an error indicating the content type is not valid or not one one of the secondary types.
If I set the option to overwrite the existing document, the updating document process succeeds. However, the content of the document is not changed at all, keeping the same content model and the properties and values. Only the modified date/time indicates that it's been modified.
In case of using major/minor version for updating, I can understand that the process fails with the message since the content model is different. But I'm puzzled with the behavior when overwriting option is selected since I'm more expecting an error or the document gets replaced with the specified new content model, and not like nothing gets updated except the modified date/time or with no error.
Is this the normal behavior?
I'm using Alfresco Enterprise v4.1.5.
If anyone can clarify on this, I truly appreciate it.
3 REPLIES 3

mitpatoliya
Star Collaborator
Star Collaborator
By "different content model" you mean different content type?
You are getting this error "content type is not valid or not one one of the secondary types"

may be because your new content type is not inheriting any of the out of box basic content types.(cm:content or cm:folder)

mr_t
Champ in-the-making
Champ in-the-making
Thank you for you reply, mitpatoliya.

Yes, they are content types (generic document types based on cm:content) .

I understand that I'm getting an error if I try to update an existing document based on a content type to another document with different content type because the documents are not based on the same or secondary content types.
The point that I'm puzzled is that if I choose the option (for CMIS) to overwrite in case of existing document, even though the document I'm sending has different content type, I do not get any error but succeed to upload the document. However, only the thing updated on the Alfresco is the document's modified date/time. The document retains whatever it had before the update including the content type and all the properties and the values.

The content types that I use are custom content types that I've added and all of them have cm:content as their parent.
Additionally, if I try to use other existing content types to update existing documents, exact same behavior is observed. i.e. if I use major/minor version option for updating document, I get the error (as expected). But if I use the overwrite option for updating, I don't get error but document is not replaced with the new one.

So I need to know if this is a behavior as designed, a known behavior which to be modified/fixed, etc. in order to create a specification for an application that I'm working on since it requires CMIS connection to Alfresco.

Regards,

mr_t
Champ in-the-making
Champ in-the-making
I just confirmed that the updated document file content was also updated.
So the the clarification that I need is whether I should get an error when trying to update a document by overwriting it with a document based on different content type.