AnsweredAssumed Answered

VersionService API deal with versionning

Question asked by brasseur on Jan 22, 2007

I have implemented a custom action under Alfresco 1.4 that permits to load metadata from a database and associate them with a document in the framework of importation of documents through the FTP interface.

I have a problem in the case when I try to import several times the same documents in the same space, in fact an error is thrown. I wanted to resolve this by adding the 'Versionnable' aspect to the imported nodes, but it hasn't change anything.

My second idea was to use the API service 'VersionService' and in particular the method 'createVersion' to resolve this. But I didn't find out how to define an imported document (node) as a new version of an existing document (node), when two documents have the same name.

Is there a way to import two documents with the same name in the same space with the versionning feature or the VersionService?

My last idea is to extract the content of the document when its name is the same that a document already imported in Alfresco. Then I can replace the content of the existing document with the extracted content and it should create automatically a new version (if the versionnable aspect is previously added to the first document). Is it a good approach?

Thanks in advance for your suggestions,