cancel
Showing results for 
Search instead for 
Did you mean: 

change the version of a node

raaftjon
Champ on-the-rise
Champ on-the-rise
hello

It is possible to change the version of a node using the library function, without a new version is created?
For example:
I have a office document with version 3.2 and transfor this document to a pdf.
After that I want to change the version of the pdf to the version 3.2.

I try:
versionService.ensureVersioningEnabled(nodeRef, versionProperties);
or
versionService.createVersion(nodeRef, versionProperties);

But it does not work. Does anyone have any ideas?

I use Alfresco 4.0.d
Thanks,
Jonas
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

do I understand correctly that you transform the office document into a PDF in a different node, so that you end up with two documents that should have the same version but content in different formats?

The thing here is that you cannot directly influence the version number of a version create via "createVersion" from the calling code. Depending on the provided version type ("major" / "minor") Alfresco internally computes the next version number. So in order to reach a version of 3.2, you would need to call "createVersion" 4 times - 2 times with "major" to get from 1.0 to 3.0, and 2 as "minor" more times to get to 3.2.
On the other hand, it is possible to influence the way Alfresco counts versions by providing a version labeling policy. Peter Monks once provided an account of his forray into that matter, which you might find useful since it dealt exactly with your requirement of being able to pre-define the label of the first version of a new document (the transformed PDF).

Regards
Axel