Pages

Tuesday 24 December 2013

How to identify Version History of a page in CQ


1) Using repository

  • Note that not for all node versions are created.
  • Node has to be of mixin type mix:versionable (node.addMixin("mix:versionable")  
  • Once you are sure that node is of correct mixin type, Find that node using CRX explorer or CRXDELite. 
  • Once node is found find UUID of that node
  • Based on UUID you can find out location of version within repository. Within repository versions are stored like this.
/jcr:system/jcr:versionStorage/<FIRST TWO LETTER OF UUID>/<NEXT TWO LETTER>/<NEXT TWO LETTER>/<UUID>/<VERSION NUMBER>  

For example for UUID ce472450-f567-459e-8adc-6fd7a3d8a4f3 you can find its version under /jcr:system/jcr:versionStorage/ce/47/24/ce472450-f567-459e-8adc-6fd7a3d8a4f3/<Version Number>






2) using API

VersionManager mgr = session.getWorkspace().getVersionManager();
VersionHistory vh = (VersionHistory) node.getParent().getParent();
VersionIterator vit = vh.getAllVersions();
while (vit.hasNext()) {
       Version v = vit.nextVersion();
}


 

No comments:

Post a Comment

Converting InputStream to String

    private String convertToString(InputStream inputStreamObj)             throws IOException {         if (inputStreamObj != null) {     ...