当前位置: 首页>>代码示例>>Java>>正文


Java Jenkins.getAllItems方法代码示例

本文整理汇总了Java中jenkins.model.Jenkins.getAllItems方法的典型用法代码示例。如果您正苦于以下问题:Java Jenkins.getAllItems方法的具体用法?Java Jenkins.getAllItems怎么用?Java Jenkins.getAllItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jenkins.model.Jenkins的用法示例。


在下文中一共展示了Jenkins.getAllItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jobLoaded

import jenkins.model.Jenkins; //导入方法依赖的package包/类
@Initializer(before = InitMilestone.COMPLETED, after = InitMilestone.JOB_LOADED)
public static void jobLoaded() throws IOException
{
	m_logger.fine("Initialization milestone: All jobs have been loaded"); //$NON-NLS-1$
	Jenkins jenkins = Jenkins.getInstance();
	for (AbstractProject<?, ?> project : jenkins.getAllItems(AbstractProject.class))
	{
		try
		{
			SCM scmConfig = project.getScm();
			if (scmConfig instanceof AbstractConfiguration && ((AbstractConfiguration) scmConfig).isMigrated())
			{
				project.save();

				m_logger.info(String.format(
								"Project %s has been migrated.", //$NON-NLS-1$
								project.getFullName()));
			}
		}
		catch (IOException e)
		{
			m_logger.log(Level.SEVERE, String.format("Failed to upgrade job %s", project.getFullName()), e); //$NON-NLS-1$
		}
	}
}
 
开发者ID:jenkinsci,项目名称:compuware-scm-downloader-plugin,代码行数:26,代码来源:AbstractConfiguration.java

示例2: find

import jenkins.model.Jenkins; //导入方法依赖的package包/类
/**
 * Search in Jenkins for a item with type T based on the job name
 * @param jobName job to find, for jobs inside a folder use : {@literal <folder>/<folder>/<jobName>}
 * @return the Job matching the given name, or {@code null} when not found
 */
static <T extends Item> T find(String jobName, Class<T> type) {
	Jenkins jenkins = Jenkins.getActiveInstance();
	// direct search, can be used to find folder based items <folder>/<folder>/<jobName>
	T item = jenkins.getItemByFullName(jobName, type);
	if (item == null) {
		// not found in a direct search, search in all items since the item might be in a folder but given without folder structure
		// (to keep it backwards compatible)
		for (T allItem : jenkins.getAllItems(type)) {
			 if (allItem.getName().equals(jobName)) {
			 	item = allItem;
			 	break;
			 }
		}
	}
	return item;
}
 
开发者ID:jenkinsci,项目名称:gogs-webhook-plugin,代码行数:22,代码来源:GogsUtils.java


注:本文中的jenkins.model.Jenkins.getAllItems方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。