AnsweredAssumed Answered

Update document version

Question asked by agz on Jul 8, 2013
Latest reply on Jul 10, 2013 by horia
Hi all,
I need to update a document through Java into Alfresco.

The scenario is:
the document is in Alfresco (4.0.e), with the version number 1.1 for example.
My code is:

File file = <file passed from UI>
Document document= <get Document object from Alresco through id>
ContentStream contentStream = new ContentStreamImpl(documentgetName(), BigInteger.valueOf(file.asBytes()), file.getContentType(), file.asStream());

Map<String, Object> properties = new HashMap<String, Object>();
properties.put("cm:description", "my personal description");
document.updateProperties(properties, false);     
document.setContentStream(contentStream, true, false);

This code updates document correctly (content and properties) but version from 1.1 goes to 1.3.
I tried differents combinations of latest parameter of updateProperties and of setContentStream but the behaviour doesn't change.

Whenever I update the file the version number increases of 2 minor versions.

Someone knows why?
Is there a method to update the document (like the code above) and increment only 1 skip minor version?

Thanks in advance