Java 类hudson.model.PermalinkProjectAction.Permalink 实例源码

项目:run-selector-plugin    文件:PermalinkRunSelector.java   
@Override
@CheckForNull
public Run<?, ?> getBuild(@Nonnull Job<?, ?> job, @Nonnull RunSelectorContext context) {
    String resolvedId = context.getEnvVars().expand(id);
    if (resolvedId.startsWith("$")) {
        context.logDebug("Unresolved variable {0}", resolvedId);
        return null;
    }

    Permalink p = job.getPermalinks().get(resolvedId);
    if (p == null) {
        context.logDebug("No permalink found for {0}", resolvedId);
        return null;
    }

    Run<?, ?> run = p.resolve(job);
    if (run == null) {
        context.logDebug("No such build {0} in {1}", id, job.getFullName());
        return null;
    }

    return run;
}
项目:run-selector-plugin    文件:PermalinkRunSelector.java   
public ComboBoxModel doFillIdItems(@AncestorInPath Job<?, ?> copyingJob, @RelativePath("..") @QueryParameter("projectName") String projectName) {
    Job<?, ?> j = null;
    Jenkins jenkins = Jenkins.getInstance();
    if (projectName != null && jenkins != null) {
        j = jenkins.getItem(projectName, copyingJob, Job.class);
    }
    ComboBoxModel r = new ComboBoxModel();
    for (Permalink p : j != null ? j.getPermalinks() : Permalink.BUILTIN) {
        r.add(p.getId());
    }
    return r;
}