Skip to content

Commit

Permalink
Merge pull request #1 from david-resnick/JENKINS-5761
Browse files Browse the repository at this point in the history
[FIXED JENKINS-5761]
  • Loading branch information
olamy committed Jun 21, 2011
2 parents c0ce12c + 8a3f323 commit 1244237
Showing 1 changed file with 6 additions and 28 deletions.
Expand Up @@ -29,7 +29,6 @@
import hudson.model.Hudson;
import hudson.model.Result;
import hudson.model.Run;
import hudson.tasks.BuildTrigger;

import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -47,20 +46,14 @@ public class DownstreamBuildViewAction extends AbstractDownstreamBuildViewAction

public DownstreamBuildViewAction(AbstractBuild<?, ?> build) {
super(build);
BuildTrigger buildTrigger = build.getProject().getPublishersList().get(BuildTrigger.class);
if (buildTrigger != null) {
List<AbstractProject> childs = buildTrigger.getChildProjects();

for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
AbstractProject project = iterator.next();
addDownstreamBuilds(project.getName(),0);
}
// downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
List<AbstractProject> childs = build.getProject().getDownstreamProjects();
for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
AbstractProject project = iterator.next();
addDownstreamBuilds(project.getName(),0);
}
rootURL = Hudson.getInstance().getRootUrl();
}


private List<DownstreamBuilds> findDownstream(List<AbstractProject> childs, int depth,List<Integer> parentChildSize,String upProjectName,int upBuildNumber) {
List<DownstreamBuilds> childList = new ArrayList<DownstreamBuilds>();
for (Iterator<AbstractProject> iterator = childs.iterator(); iterator.hasNext();) {
Expand Down Expand Up @@ -106,19 +99,15 @@ public class DownstreamBuilds {
private List<Integer> parentChildSize;
private transient AbstractProject project;
private transient Run<?, ?> run;


private void initilize(){
project = Hudson.getInstance().getItemByFullName(projectName, AbstractProject.class);
run = project.getBuildByNumber(buildNumber);
}


public List<Integer> getParentChildSize() {
return parentChildSize;
}



public void setParentChildSize(List<Integer> parentChildSize) {
this.parentChildSize = parentChildSize;
Expand Down Expand Up @@ -154,7 +143,6 @@ public String currentBuildNumber() {
}
return Integer.toString(buildNumber);
}


public int getDepth() {
return depth;
Expand Down Expand Up @@ -195,8 +183,6 @@ public void setDepth(int depth) {
this.depth = depth;
}



public String getStatusMessage() {
if(project == null ){
initilize();
Expand Down Expand Up @@ -231,20 +217,12 @@ public String getRootURL() {
}

public List<DownstreamBuilds> getDownstreamBuildList() {
BuildTrigger buildTrigger = build.getProject().getPublishersList().get(BuildTrigger.class);
if (buildTrigger != null) {
List<AbstractProject> childs = buildTrigger.getChildProjects();
downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
}
List<AbstractProject> childs = build.getProject().getDownstreamProjects();
downstreamBuildList = findDownstream(childs, 1, new ArrayList<Integer>(),build.getParent().getName(),build.getNumber());
return downstreamBuildList;
}

public void setDownstreamBuildList(List<DownstreamBuilds> downstreamBuildList) {
this.downstreamBuildList = downstreamBuildList;
}





}

0 comments on commit 1244237

Please sign in to comment.