当前位置: 首页>>代码示例>>Java>>正文


Java Job.getProperty方法代码示例

本文整理汇总了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;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:26,代码来源:JobHelper.java

示例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;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:19,代码来源:GitHubTrigger.java

示例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());
    }
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:8,代码来源:GitLabSCMItemListener.java

示例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;
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:14,代码来源:GitLabSCMItemListener.java

示例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;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:36,代码来源:GitHubPRRepositoryFactory.java

示例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;
}
 
开发者ID:KostyaSha,项目名称:github-integration-plugin,代码行数:38,代码来源:GitHubBranchRepositoryFactory.java

示例7: StandardJob

import hudson.model.Job; //导入方法依赖的package包/类
public StandardJob(ContainerDriver driver, Job job) {
    super(driver, job, (ContainerSetDefinition) job.getProperty(ContainerSetDefinition.class));
}
 
开发者ID:hyperhq,项目名称:hyper-slaves-plugin,代码行数:4,代码来源:HyperProvisionerFactory.java


注:本文中的hudson.model.Job.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。