當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。