Hi team,


Question is regarding versioning of node,



Step 1) If a Custom node which is of type mix:versionable and with custom
properties is added as child of root node. using

  Node node=rootNode.addNode(name, type);

  node.addMixin("mix:versionable");

  setFolderNodeAttributes(cutomMetadataObj, node, type);  api.



Step 2 ) and if second version is created and saved on same node but with
Different attributes for eg. below



final VersionManager versionManager =
session.getWorkspace().getVersionManager();

        Node node = RootNode.getNode(name);

                                versionManager.checkout(node.getPath());

                                setCustomNodeAttributes(newMetadataObj,
node, type);

                                session.save();

        versionManager.checkin(node.getPath());



Now Version hsitory object gives me two version

1) jcr:rootVersion

2) First Version naming 1.0



This version 1.0, has currenlty updated Custom attributes, and root version
doesnt have any custom attributes.

So for first commit or 0the version of node, which was created in step 1,
custom attributes are lost(In DB they are present), but through
VersionManager api i'm not able to read the 0th commit attributes.



Im using following code for iterating over versions



final VersionHistory versionHistory =
versionManager.getVersionHistory(node.getPath());

final VersionIterator versionItrator = versionHistory.getAllVersions();

while(versionItrator.hasNext()){

final Version version = versionItrator.nextVersion();

final Node idNode = version.getFrozenNode();

if (idNode.hasProperty("<Custom Property>")){  // For JCR:rootVersion its
not present and for version 1.0 it printing latest checkedin property

//Print It

}

}



Thanks In advanced,

Reply via email to