x-path query to get all versions of a node at a given path in JSP
hi need xpath query can list versions of selected node can used restoring version particular one??
i'm not sure xpath query (which deprecated in jcr 2.0), here's how use jcr api retrieve of versions path:
/**
* returns of versions @ specified path list of versions.
*
* @param session
* currect jcr session, must not null
* @param path
* absolute path of node retrieve
* @return list of versions @ specified path
* @throws unsupportedrepositoryoperationexception
* thrown if node @ specified path not versionable
* @throws repositoryexception
* unexpected exception occurs interacting jcr
* repository
*/
public list<javax.jcr.version.version> getversions(final session session,
final string path) throws unsupportedrepositoryoperationexception,
repositoryexception {
final list<version> versions = new arraylist<version>();
final versionmanager versionmgr = session.getworkspace()
.getversionmanager();
final versionhistory versionhistory = versionmgr
.getversionhistory(path);
final versioniterator versioniterator = versionhistory.getallversions();
while (versioniterator.hasnext()) {
versions.add(versioniterator.nextversion());
}
return versions;
}
More discussions in Archived Spaces
adobe
Comments
Post a Comment