本文整理了Java中jenkins.model.Jenkins.getAllItems()
方法的一些代码示例,展示了Jenkins.getAllItems()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.getAllItems()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:getAllItems
[英]Gets all the items recursively.
[中]以递归方式获取所有项。
代码示例来源:origin: jenkinsci/gitlab-plugin
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class);
if (trigger != null) {
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class);
if (trigger != null) {
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Gets all the items recursively.
*
* @since 1.402
*/
public List<Item> getAllItems() {
return getAllItems(Item.class);
}
代码示例来源:origin: groupon/DotCi
private DynamicProject findJob(String jobName) {
final String orgName = jobName.split("/")[0];
final String repoName = jobName.split("/")[1];
return Iterables.find(Jenkins.getInstance().getAllItems(DynamicProject.class), new Predicate<DynamicProject>() {
@Override
public boolean apply(DynamicProject project) {
return project.getParent().getName().equals(orgName) && project.getName().equals(repoName);
}
});
}
代码示例来源:origin: groupon/DotCi
public Iterable<DynamicProject> getJobsFor(final String url) {
return Iterables.filter(Jenkins.getInstance().getAllItems(DynamicProject.class), new Predicate<DynamicProject>() {
@Override
public boolean apply(final DynamicProject input) {
final GitUrl gitUrl = new GitUrl(url);
final String[] orgRepo = gitUrl.getFullRepoName().split("/");
return input.getParent().getName().equalsIgnoreCase(orgRepo[0]) && input.getName().equals(orgRepo[1]);
}
});
}
代码示例来源:origin: jenkinsci/subversion-plugin
@SuppressWarnings("rawtypes")
public List<Job> getAllJobs() {
return Jenkins.getInstance().getAllItems(Job.class);
}
};
代码示例来源:origin: jenkinsci/instant-messaging-plugin
@SuppressWarnings("unchecked")
@Override
public List<AbstractProject<?,?>> getAllJobs() {
@SuppressWarnings("rawtypes")
List items = Jenkins.getInstance().getAllItems(AbstractProject.class);
return items;
}
代码示例来源:origin: jenkinsci/warnings-ng-plugin
/**
* Returns the full names of all available jobs. The full name is given by {@link AbstractItem#getFullName()}.
*
* @return the full names of all jobs
*/
public Set<String> getAllJobs() {
return getJenkins().getAllItems(Job.class).stream()
.map(this::getFullNameOf).collect(Collectors.toSet());
}
代码示例来源:origin: jenkinsci/maven-plugin
/**
* Returns all Maven modules in this Jenkins instance.
*/
protected Collection<MavenModule> getAllMavenModules() {
return Jenkins.getInstance().getAllItems(MavenModule.class);
}
代码示例来源:origin: JoelJ/ez-templates
public static Collection<AbstractProject> findProjectsWithProperty(final Class<? extends JobProperty<?>> property) {
List<AbstractProject> projects = Jenkins.getInstance().getAllItems(AbstractProject.class);
return Collections2.filter(projects, new Predicate<AbstractProject>() {
@Override
public boolean apply(AbstractProject abstractProject) {
return abstractProject.getProperty(property) != null;
}
});
}
代码示例来源:origin: org.jenkins-ci.plugins/security-inspector
@Nonnull
public List<Item> getPossibleJobs() {
return JenkinsHelper.getInstanceOrFail().getAllItems();
}
代码示例来源:origin: jenkinsci/instant-messaging-plugin
@SuppressWarnings("rawtypes")
@Override
public AbstractProject<?, ?> getJobByDisplayName(String displayName) {
List<AbstractProject> allItems = Jenkins.getInstance().getAllItems(AbstractProject.class);
for (AbstractProject job : allItems) {
if (displayName.equals(job.getDisplayName())) {
return job;
}
}
return null;
}
代码示例来源:origin: jenkinsci/tfs-plugin
private AbstractProject validateAndGetJenkinsProject(final ReleaseWebHookResource resource) {
String projectName = resource.getProjectName();
if (StringUtils.isBlank(projectName)) {
throw new InvalidParameterException("Project name is empty");
}
for (final Item project : Jenkins.getActiveInstance().getAllItems()) {
if (project instanceof AbstractProject && project.getName().equalsIgnoreCase(projectName)) {
return (AbstractProject) project;
}
}
throw new InvalidParameterException("Cannot find Jenkins Project with the name " + resource.getProjectName());
}
代码示例来源:origin: Diabol/delivery-pipeline-plugin
public static Set<String> getStageNames() {
List<AbstractProject> projects = JenkinsUtil.getInstance().getAllItems(AbstractProject.class);
Set<String> result = new HashSet<>();
for (AbstractProject project : projects) {
PipelineProperty property = (PipelineProperty) project.getProperty(PipelineProperty.class);
if (property != null && property.getStageName() != null) {
result.add(property.getStageName());
}
}
return result;
}
代码示例来源:origin: vmware/jenkins-reviewbot
public ListBoxModel doFillReviewbotJobNameItems() {
ListBoxModel items = new ListBoxModel();
for (AbstractProject project: Jenkins.getInstance().getAllItems(AbstractProject.class)) {
items.add(project.getName());
}
return items;
}
代码示例来源:origin: org.jenkins-ci.plugins/build-pipeline-plugin
@Override
public void onDeleted(final Item item) {
for (final Project<?, ?> p : Jenkins.getInstance().getAllItems(Project.class)) {
final String oldName = item.getName();
final BuildPipelineTrigger bpTrigger = p.getPublishersList().get(BuildPipelineTrigger.class);
if (bpTrigger != null) {
bpTrigger.removeDownstreamTrigger(bpTrigger, p, oldName);
}
}
}
}
代码示例来源:origin: Diabol/delivery-pipeline-plugin
public static ListBoxModel fillAllProjects(ItemGroup<?> context, Class<? extends Job> type) {
ListBoxModel options = new ListBoxModel();
for (Job p : JenkinsUtil.getInstance().getAllItems(type)) {
options.add(p.getFullDisplayName(), p.getRelativeNameFrom(context));
}
return options;
}
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
@Override public Set<String> call() throws Exception {
Set<String> remaining = new TreeSet<String>();
for (Item i : Jenkins.get().getAllItems()) {
remaining.add(i.getFullName());
if (i instanceof Actionable) {
((Actionable) i).getAllActions();
}
}
return remaining;
}
}).get());
代码示例来源:origin: jenkinsci/junit-plugin
@Before
public void setUp() throws Exception {
List<FreeStyleProject> projects = rule.jenkins.getAllItems(FreeStyleProject.class);
Project theProject = null;
for (Project p : projects) {
if (p.getName().equals(PROJECT_NAME)) theProject = p;
}
assertNotNull("We should have a project named " + PROJECT_NAME, theProject);
project = (FreeStyleProject) theProject;
}
代码示例来源:origin: yuzd/coding.net
public List<Job> reRegisterAllHooks() {
return from(getJenkinsInstance().getAllItems(Job.class))
.filter(isBuildable())
.filter(isAlive()).toList();
}
代码示例来源:origin: jenkinsci/github-plugin
/**
* Calls {@link #registerHookFor(Job)} for every project which have subscriber
*
* @return list of jobs which jenkins tried to register hook
*/
public List<Item> reRegisterAllHooks() {
return from(getJenkinsInstance().getAllItems(Item.class))
.filter(isBuildable())
.filter(isAlive())
.transform(reRegisterHookForJob())
.toList();
}
内容来源于网络,如有侵权,请联系作者删除!