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


Java AbstractProject.getTrigger方法代码示例

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


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

示例1: triggerFrom

import hudson.model.AbstractProject; //导入方法依赖的package包/类
/**
 * support matrix plugin.
 *
 * @see JobInfoHelpers#triggerFrom(hudson.model.Job, java.lang.Class)
 */
@CheckForNull
public static <T extends Trigger> T triggerFrom(final Job<?, ?> job, Class<T> tClass) {
    Job<?, ?> guessJob;
    if (job instanceof MatrixConfiguration) {
        guessJob = ((MatrixConfiguration) job).getParent();
    } else {
        guessJob = job;
    }

    if (guessJob instanceof AbstractProject<?, ?>) {
        final AbstractProject<?, ?> abstractProject = (AbstractProject<?, ?>) guessJob;
        return abstractProject.getTrigger(tClass);
    } else if (guessJob instanceof ParameterizedJobMixIn.ParameterizedJob) {
        ParameterizedJobMixIn.ParameterizedJob pJob = (ParameterizedJobMixIn.ParameterizedJob) guessJob;

        for (Trigger candidate : pJob.getTriggers().values()) {
            if (tClass.isInstance(candidate)) {
                return tClass.cast(candidate);
            }
        }
    }
    return null;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:29,代码来源:JobHelper.java

示例2: getWebHooks

import hudson.model.AbstractProject; //导入方法依赖的package包/类
private Set<GhprcWebHook> getWebHooks() {
    final Set<GhprcWebHook> webHooks = new HashSet<GhprcWebHook>();

    // We need this to get access to list of repositories
    Authentication old = SecurityContextHolder.getContext().getAuthentication();
    SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);

    try {
        for (AbstractProject<?, ?> job : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
            GhprcTrigger trigger = job.getTrigger(GhprcTrigger.class);
            if (trigger == null || trigger.getWebHook() == null) {
                continue;
            }
            webHooks.add(trigger.getWebHook());
        }
    } finally {
        SecurityContextHolder.getContext().setAuthentication(old);
    }

    if (webHooks.size() == 0) {
        logger.log(Level.WARNING, "No projects found using GitHub pull request trigger");
    }

    return webHooks;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:26,代码来源:GhprcRootAction.java

示例3: extractTrigger

import hudson.model.AbstractProject; //导入方法依赖的package包/类
public static GhprcTrigger extractTrigger(AbstractProject<?, ?> p) {
    GhprcTrigger trigger = p.getTrigger(GhprcTrigger.class);
    if (trigger == null) {
        return null;
    }
    return trigger;
}
 
开发者ID:bratchenko,项目名称:jenkins-github-pull-request-comments,代码行数:8,代码来源:Ghprc.java


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