AnsweredAssumed Answered

change old version properties of a document

Question asked by ingon on Dec 21, 2012
Latest reply on Dec 21, 2012 by ingon
Hi all,

I'm trying to change an older version document properties and add some tags, but I'm unable to make it work.

Here is my code:

      NodeRef nodeRef = new NodeRef(stringNodeRef);
      VersionHistory versionHistory = versionService.getVersionHistory(nodeRef);
      Collection<Version> versions = versionHistory.getAllVersions();
      Iterator<Version> iterator = versions.iterator();
      while (iterator.hasNext()) {
         Version version = iterator.next();
         NodeRef versionNodeRef = version.getVersionedNodeRef();
         taggingService.addTag(versionNodeRef, "new tag version " + version.getVersionLabel());
         QName qname = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "description");
         nodeService.setProperty(versionNodeRef, qname, "Description version " + version.getVersionLabel());
      }

where stringNodeRef is the document current version nodeRef.

The problem is that this always chages the last version properties, since version.getVersionedNodeRef() always returns ne current version nodeRef.

Any ideas why it isn't working? Or am I doing something wrong?

Thank you very much in advance!

Outcomes