本文整理汇总了Java中hudson.triggers.TriggerDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java TriggerDescriptor类的具体用法?Java TriggerDescriptor怎么用?Java TriggerDescriptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TriggerDescriptor类属于hudson.triggers包,在下文中一共展示了TriggerDescriptor类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixBuildTriggers
import hudson.triggers.TriggerDescriptor; //导入依赖的package包/类
private static void fixBuildTriggers(AbstractProject implementationProject, Map<TriggerDescriptor, Trigger> oldTriggers) {
List<Trigger<?>> triggersToReplace = ProjectUtils.getTriggers(implementationProject);
if (triggersToReplace == null) {
throw new NullPointerException("triggersToReplace");
}
if (!triggersToReplace.isEmpty() || !oldTriggers.isEmpty()) {
//noinspection SynchronizationOnLocalVariableOrMethodParameter
synchronized (triggersToReplace) {
triggersToReplace.clear();
for (Trigger trigger : oldTriggers.values()) {
triggersToReplace.add(trigger);
}
}
}
}
示例2: getTrigger
import hudson.triggers.TriggerDescriptor; //导入依赖的package包/类
@CheckForNull
public static DockerHubTrigger getTrigger(ParameterizedJobMixIn.ParameterizedJob job) {
Jenkins jenkins = Jenkins.getInstance();
if (jenkins != null) {
DockerHubTrigger.DescriptorImpl descriptor = jenkins.getDescriptorByType(DockerHubTrigger.DescriptorImpl.class);
if (descriptor != null) {
Map<TriggerDescriptor, Trigger<?>> triggers = job.getTriggers();
return (DockerHubTrigger)triggers.get(descriptor);
}
}
return null;
}
示例3: getParameter
import hudson.triggers.TriggerDescriptor; //导入依赖的package包/类
/**
* Overrides certain parameter names with certain values needed when setting the configuration for
* template projects. Otherwise, relies on the standard implementation.
* <br>
* {@inheritDoc}
*/
@Override
public String getParameter(String name) {
// Sanitize the following parameters
if ("name".equals(name)) {
// Don't set the name
return null;
} else if ("description".equals(name)) {
// Don't set the description
return null;
} else if ("disable".equals(name)) {
// Mark disabled
return "";
}
/*
* Parameters for conflicting triggers should return null if the
* corresponding JSON was not provided. Otherwise, NPEs occur when
* trying to update the triggers for the template project.
*/
DescriptorExtensionList<Trigger<?>, TriggerDescriptor> triggerDescriptors = Trigger.all();
for (TriggerDescriptor triggerDescriptor : triggerDescriptors) {
String safeName = triggerDescriptor.getJsonSafeClassName();
try {
if (name.equals(safeName) && getSubmittedForm().getJSONObject(safeName).isNullObject()) {
return null;
}
} catch (ServletException e) {
throw new IllegalStateException("Exception getting data from submitted JSON", e);
}
}
// Fallback to standard functionality
return super.getParameter(name);
}
示例4: getRawTriggers
import hudson.triggers.TriggerDescriptor; //导入依赖的package包/类
public Map<TriggerDescriptor,Trigger<?>> getRawTriggers() {
return super.getTriggers();
}
示例5: getTriggers
import hudson.triggers.TriggerDescriptor; //导入依赖的package包/类
/**
* Returns all triggers defined on this project; or if detected to be
* necessary, also all parents.
* <p>
* @return a map of triggers, might be empty, but never null
*/
@Override
public Map<TriggerDescriptor,Trigger<?>> getTriggers() {
return this.getTriggers(IMode.AUTO);
}