How to increment only minor version after Document.RestoreVersion

Hello. After invoke operation Document.RestoreVersion e.g. major version 2 -> major version 1, i need to update document with major version 1 and increment minor version of major version 1, but nuxeo java client return major version 2 after update major version 1. How can i fix this?

0 votes

1 answers

173 views

ANSWER



Hello, if you are using Java Client, did you try to update the version of the document by using the following?

document = nuxeoClient.operation("Document.CreateVersion").param("increment", "MINOR").input(document).execute();

In this case, with “MINOR”, the version 1.0 will generate the version 1.1. You can also change “MINOR” to “MAYOR” in order to increment from 1.0 to 2.0.

Info about the Document.CreateVersion operation: http://explorer.nuxeo.com/nuxeo/site/distribution/Nuxeo%20DM-8.2/viewOperation/Document.CreateVersion

Hope it helps!

0 votes



Hello Rodri. Thank you, but i mean some different things.

For example, i restored document version 2.4 to version 1.1

document = client.operation("Document.RestoreVersion").input(versionDocument).execute();     

Then i need to update this document and increment minor version of current major version (1)

document = client.operation("Document.CreateVersion").input(document).param("increment", "MINOR").param("saveDocument", true).execute();

I expect that document have version 1.2 after this update but version of the document 2.5.

08/07/2019

Well. You can play with "checkout" and "createVersion" parameters of "Document.RestoreVersion" operation. However, I think that the behavior you are expecting is not possible only with those operations. If you want to restore a document from a version, then you can generate a new version with the restored version. For example, if the document has the version 2.4, you can restore the 1.1 version but creating a new version (2.5). So 2.5 = 1.1. In other case, you might have two 1.2 versions and this is not possible. Anyway, I am not sure if this is the only possibility. I am not familiar with "Document.RestoreVersion" operation.
08/07/2019