本文整理匯總了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;
}