Function<Run, ProjectBuildRepositoryRoot> fn;
fn = new Function<Run, ProjectBuildRepositoryRoot>() {
public ProjectBuildRepositoryRoot apply(Run r) {
return new ProjectBuildRepositoryRoot(ProjectBuildList.this, r, "" + r.getNumber());
}
};
// Transform builds into items
Iterable<ProjectBuildRepositoryRoot> i = Iterables.transform(item.asProject().getBuilds(), fn);
// Remove NULL entries
return Lists.newArrayList(Iterables.filter(i, new Predicate<ProjectBuildRepositoryRoot>() {
public boolean apply(ProjectBuildRepositoryRoot projectBuildRepositoryRoot) {
return projectBuildRepositoryRoot != null;
}
}));
} else {
Map<String, ProjectBuildRepositoryRoot> children = new HashMap<String, ProjectBuildRepositoryRoot>();
log.info("Getting builds from {}", item);
for (Run run : item.asProject().getBuilds()) {
try
{
BuildData bd = run.getAction(BuildData.class);
if (bd != null && run.getResult() == Result.SUCCESS) {
String sha1 = bd.getLastBuiltRevision().getSha1String();
// Most recent, only if successful
if (!children.containsKey(sha1) && run.getResult().isBetterOrEqualTo(Result.SUCCESS)) {
children.put(sha1, new ProjectBuildRepositoryRoot(this, run, sha1));
}
}
}
catch(Exception ex)
{