/** * visit everything in order. * * @param visitor */ public static void traverse(HudsonVisitor visitor) { for (BuildableItemWithBuildWrappers item : Hudson.getInstance().getAllItems(BuildableItemWithBuildWrappers.class)) { visitor.visitProject(item); List<? extends Run> runs = item.asProject().getBuilds(); for (Run run : runs) { traverse(visitor, run); } } }
/** Visit projects and builds */ public static void traverseProjectsAndBuilds(HudsonVisitor visitor) { for (BuildableItemWithBuildWrappers item : Hudson.getInstance().getAllItems(BuildableItemWithBuildWrappers.class)) { visitor.visitProject(item); List<? extends Run> runs = item.asProject().getBuilds(); for (Run run : runs) { if (run instanceof MavenModuleSetBuild) { MavenModuleSetBuild mmsb = (MavenModuleSetBuild) run; visitor.visitModuleSet(mmsb); } } } }