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;
}
Aggregations