Search in sources :

Example 1 with ICascadingJob

use of org.hudsonci.api.model.ICascadingJob in project hudson-2.x by hudson.

the class CascadingUtil method unlinkProjectFromCascadingParents.

/**
     * Recursively unlink specified project from cascading hierarchy.
     *
     * @param cascadingProject cascading project to start from.
     * @param projectToUnlink project that should be unlinked.
     * @return true if project was unlinked, false - if cascadingProject or projectToUnlink is Null
     * @throws java.io.IOException if cascading project couldn't be saved.
     */
public static boolean unlinkProjectFromCascadingParents(ICascadingJob cascadingProject, String projectToUnlink) throws IOException {
    if (null != cascadingProject && null != projectToUnlink) {
        Job job = Functions.getItemByName(Hudson.getInstance().getAllItems(Job.class), projectToUnlink);
        if (null != job) {
            Set<String> set = new HashSet<String>(job.getCascadingChildrenNames());
            set.add(projectToUnlink);
            return unlinkProjectFromCascadingParents(cascadingProject, set);
        }
    }
    return false;
}
Also used : ICascadingJob(org.hudsonci.api.model.ICascadingJob) Job(hudson.model.Job) HashSet(java.util.HashSet)

Aggregations

Job (hudson.model.Job)1 HashSet (java.util.HashSet)1 ICascadingJob (org.hudsonci.api.model.ICascadingJob)1