@Nonnull
public Iterator<VersionDelegate> getAllVersions()
throws RepositoryException {
SortedMap<Calendar, String> versions = new TreeMap<Calendar, String>();
for (Iterator<NodeDelegate> it = getChildren(); it.hasNext(); ) {
NodeDelegate n = it.next();
String primaryType = n.getProperty(JcrConstants.JCR_PRIMARYTYPE).getValue().getString();
if (primaryType.equals(VersionConstants.NT_VERSION)) {
PropertyDelegate created = n.getProperty(JcrConstants.JCR_CREATED);
if (created != null) {
versions.put(created.getValue().getDate(), n.getName());
}
}
}
final Tree thisTree = getTree();
return Iterators.transform(versions.values().iterator(), new Function<String, VersionDelegate>() {