Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ninian/master
FIXED JENKINS-18455 - remove extra maven modules from all slicing FIXED JENKINS-20082 FIXED JENKINS-21556 FIXED JENKINS-23766
- Loading branch information
Showing
17 changed files
with
88 additions
and
51 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/main/java/configurationslicing/TopLevelItemSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package configurationslicing; | ||
|
||
import hudson.model.TopLevelItem; | ||
import hudson.model.AbstractProject; | ||
import hudson.model.Hudson; | ||
|
||
import java.util.List; | ||
|
||
import org.apache.commons.collections.CollectionUtils; | ||
import org.apache.commons.collections.Predicate; | ||
/** | ||
* Helper class to provide all top level items configured in Jenkins, excluding other items | ||
* held in folders, such as maven modules | ||
* | ||
*/ | ||
public class TopLevelItemSelector { | ||
|
||
// private constructor since we don't expect this class to be instantiated | ||
private TopLevelItemSelector() { | ||
|
||
} | ||
|
||
/** | ||
* Provide all top level items configured in Jenkins | ||
* @param clazz the type to search the ItemGroup for | ||
* @return all items in the Jenkins ItemGroup tree which are of type TopLevelItem | ||
*/ | ||
@SuppressWarnings({ "unchecked", "rawtypes" }) | ||
public static List<AbstractProject<?,?>> getAllTopLevelItems(Class clazz) { | ||
List<AbstractProject<?,?>> list = (List)Hudson.getInstance().getAllItems(clazz); | ||
CollectionUtils.filter(list, new Predicate() { | ||
public boolean evaluate(Object object) { | ||
// exclude MatrixConfiguration, MavenModule, etc | ||
return object instanceof TopLevelItem; | ||
} | ||
}); | ||
return list; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.