本文整理汇总了Java中hudson.model.Job.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Job.getProperty方法的具体用法?Java Job.getProperty怎么用?Java Job.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hudson.model.Job
的用法示例。
在下文中一共展示了Job.getProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultParametersValues
import hudson.model.Job; //导入方法依赖的package包/类
/**
* @see jenkins.model.ParameterizedJobMixIn#getDefaultParametersValues()
*/
public static List<ParameterValue> getDefaultParametersValues(Job<?, ?> job) {
ParametersDefinitionProperty paramDefProp = job.getProperty(ParametersDefinitionProperty.class);
List<ParameterValue> defValues = new ArrayList<>();
/*
* This check is made ONLY if someone will call this method even if isParametrized() is false.
*/
if (paramDefProp == null) {
return defValues;
}
/* Scan for all parameter with an associated default values */
for (ParameterDefinition paramDefinition : paramDefProp.getParameterDefinitions()) {
ParameterValue defaultValue = paramDefinition.getDefaultParameterValue();
if (defaultValue != null) {
defValues.add(defaultValue);
}
}
return defValues;
}
示例2: getRepoFullName
import hudson.model.Job; //导入方法依赖的package包/类
public GitHubRepositoryName getRepoFullName(Job<?, ?> job) {
if (isNull(repoName)) {
checkNotNull(job, "job object is null, race condition?");
GithubProjectProperty ghpp = job.getProperty(GithubProjectProperty.class);
checkNotNull(ghpp, "GitHub project property is not defined. Can't setup GitHub trigger for job %s",
job.getName());
checkNotNull(ghpp.getProjectUrl(), "A GitHub project url is required");
GitHubRepositoryName repo = GitHubRepositoryName.create(ghpp.getProjectUrl().baseUrl());
checkNotNull(repo, "Invalid GitHub project url: %s", ghpp.getProjectUrl().baseUrl());
setRepoName(repo);
}
return repoName;
}
示例3: onUpdated
import hudson.model.Job; //导入方法依赖的package包/类
private void onUpdated(Job<?, ?> job) {
BranchJobProperty property = job.getProperty(BranchJobProperty.class);
if (property != null && job.getParent() instanceof SCMSourceOwner) {
// TODO: HACK ALERT! There must/should be a nicer way to do this!
updateProperties(job, (SCMSourceOwner) job.getParent(), property.getBranch().getSourceId());
}
}
示例4: updateProperties
import hudson.model.Job; //导入方法依赖的package包/类
private boolean updateProperties(Job<?, ?> job, SCMSourceOwner sourceOwner, String sourceId) {
SCMSource source = sourceOwner.getSCMSource(sourceId);
if (source instanceof GitLabSCMSource) {
String connectionName = ((GitLabSCMSource) source).getSourceSettings().getConnectionName();
GitLabConnectionProperty property = job.getProperty(GitLabConnectionProperty.class);
if (property == null || !connectionName.equals(property.getGitLabConnection())) {
updateProperties(job, connectionName);
return true;
}
}
return false;
}
示例5: forProject
import hudson.model.Job; //导入方法依赖的package包/类
@Nonnull
private static GitHubPRRepository forProject(Job<?, ?> job) throws IOException {
XmlFile configFile = new XmlFile(new File(job.getRootDir(), GitHubPRRepository.FILE));
GitHubPRTrigger trigger = ghPRTriggerFromJob(job);
requireNonNull(trigger, "Can't extract PR trigger from " + job.getFullName());
final GitHubRepositoryName repoFullName = trigger.getRepoFullName(job); // ask with job because trigger may not yet be started
GithubProjectProperty property = job.getProperty(GithubProjectProperty.class);
String githubUrl = property.getProjectUrl().toString();
GitHubPRRepository localRepository;
if (configFile.exists()) {
try {
localRepository = (GitHubPRRepository) configFile.read();
} catch (IOException e) {
LOGGER.info("Can't read saved repository, re-creating new one", e);
localRepository = new GitHubPRRepository(repoFullName.toString(), new URL(githubUrl));
}
} else {
localRepository = new GitHubPRRepository(repoFullName.toString(), new URL(githubUrl));
}
localRepository.setJob(job);
localRepository.setConfigFile(configFile);
try {
localRepository.actualise(trigger.getRemoteRepository());
localRepository.save();
} catch (Throwable ignore) {
//silently try actualise
}
return localRepository;
}
示例6: forProject
import hudson.model.Job; //导入方法依赖的package包/类
@Nonnull
private static GitHubBranchRepository forProject(Job<?, ?> job) throws IOException {
XmlFile configFile = new XmlFile(new File(job.getRootDir(), GitHubBranchRepository.FILE));
GitHubBranchTrigger trigger = ghBranchTriggerFromJob(job);
requireNonNull(trigger, "Can't extract Branch trigger from " + job.getFullName());
final GitHubRepositoryName repoFullName = trigger.getRepoFullName(job); // ask with job because trigger may not yet be started
GithubProjectProperty property = job.getProperty(GithubProjectProperty.class);
String githubUrl = property.getProjectUrl().toString();
GitHubBranchRepository localRepository;
if (configFile.exists()) {
try {
localRepository = (GitHubBranchRepository) configFile.read();
} catch (IOException e) {
LOGGER.info("Can't read saved repository, re-creating new one", e);
localRepository = new GitHubBranchRepository(repoFullName.toString(), new URL(githubUrl));
}
} else {
LOGGER.info("Creating new Branch Repository for '{}'", job.getFullName());
localRepository = new GitHubBranchRepository(repoFullName.toString(), new URL(githubUrl));
}
// set transient cached fields
localRepository.setJob(job);
localRepository.setConfigFile(configFile);
try {
localRepository.actualise(trigger.getRemoteRepository());
localRepository.save();
} catch (Throwable ignore) {
//silently try actualise
}
return localRepository;
}
示例7: StandardJob
import hudson.model.Job; //导入方法依赖的package包/类
public StandardJob(ContainerDriver driver, Job job) {
super(driver, job, (ContainerSetDefinition) job.getProperty(ContainerSetDefinition.class));
}