本文整理汇总了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;
}
示例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;
}
示例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;
}