use of org.pentaho.platform.api.repository2.unified.VersionSummary in project pentaho-platform by pentaho.
the class JcrRepositoryFileUtils method getVersionSummaries.
public static Object getVersionSummaries(final Session session, final PentahoJcrConstants pentahoJcrConstants, final Serializable fileId, final boolean includeAclOnlyChanges) throws RepositoryException {
Node fileNode = session.getNodeByIdentifier(fileId.toString());
VersionHistory versionHistory = session.getWorkspace().getVersionManager().getVersionHistory(fileNode.getPath());
// get root version but don't include it in version summaries; from JSR-170 specification section 8.2.5:
// [root version] is a dummy version that serves as the starting point of the version graph. Like all version
// nodes,
// it has a subnode called jcr:frozenNode. But, in this case that frozen node does not contain any state
// information
// about N
Version version = versionHistory.getRootVersion();
Version[] successors = version.getSuccessors();
List<VersionSummary> versionSummaries = new ArrayList<VersionSummary>();
while (successors != null && successors.length > 0) {
// branching not supported
version = successors[0];
VersionSummary sum = toVersionSummary(pentahoJcrConstants, versionHistory, version);
if (!sum.isAclOnlyChange() || (includeAclOnlyChanges && sum.isAclOnlyChange())) {
versionSummaries.add(sum);
}
successors = version.getSuccessors();
}
return versionSummaries;
}
Aggregations