Package com.etsy.jenkins

Source Code of com.etsy.jenkins.SubProjectsAction

package com.etsy.jenkins;

import com.etsy.jenkins.finder.ProjectFinder;

import hudson.model.AbstractProject;
import hudson.model.Action;

import com.google.common.collect.Sets;
import com.google.inject.Inject;

import java.util.Set;

public class SubProjectsAction implements Action {

  @Inject static ProjectFinder projectFinder;

  private Set<String> subProjects;
  private Set<String> excludeProjects;

  public SubProjectsAction(
      Set<String> subProjects,
      Set<String> excludeProjects) {
    this.subProjects = subProjects;
    this.excludeProjects = excludeProjects;
  }

  public String getDisplayName() {
    return "Selected Sub-jobs";
  }

  public String getIconFileName() {
    return null;
  }

  public String getUrlName() {
    return "subJobs";
  }

  public Set<String> getSubProjectNames() {
    return subProjects;
  }

  public Set<String> getExcludeProjectNames() {
    return excludeProjects;
  }

  public Set<AbstractProject> getSubProjects() {
    Set<AbstractProject> projects = Sets.<AbstractProject>newHashSet();
    for (String subProject : subProjects) {
      AbstractProject project = projectFinder.findProject(subProject);
      projects.add(project);
    }
    return projects;
  }

}
TOP

Related Classes of com.etsy.jenkins.SubProjectsAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.