hudson.model.Hudson.getItemByFullName()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中hudson.model.Hudson.getItemByFullName()方法的一些代码示例,展示了Hudson.getItemByFullName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hudson.getItemByFullName()方法的具体详情如下:
包路径:hudson.model.Hudson
类名称:Hudson
方法名:getItemByFullName

Hudson.getItemByFullName介绍

[英]Gets the Item object by its full name. Full names are like path names, where each name of Item is combined by '/'.
[中]按项目对象的全名获取该项目对象。全名类似于路径名,其中项目的每个名称由“/”组合而成。

代码示例

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Override
public Object fromString(String string) {
  Object item = Hudson.getInstance().getItemByFullName(string);
  if(item==null)  throw new NoSuchElementException("No such job exists: "+string);
  return item;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

@Override
public Object fromString(String string) {
  Object item = Hudson.getInstance().getItemByFullName(string);
  if (item == null) {
    throw new NoSuchElementException("No such job exists: " + string);
  }
  return item;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
public Object fromString(String string) {
  Object item = Hudson.getInstance().getItemByFullName(string);
  if(item==null)  throw new NoSuchElementException("No such job exists: "+string);
  return item;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Gets the {@link Job} that this pointer points to, or null if such a
 * job no longer exists.
 */
public AbstractProject getJob() {
  return Hudson.getInstance().getItemByFullName(name, AbstractProject.class);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the {@link Job} that this pointer points to,
 * or null if such a job no longer exists.
 */
public AbstractProject getJob() {
  return Hudson.getInstance().getItemByFullName(name,AbstractProject.class);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
public Object fromString(String string) {
  String[] split = string.split("#");
  String projectName = split[0];
  int buildNumber = Integer.parseInt(split[1]);
  Job<?,?> job = (Job<?,?>) Hudson.getInstance().getItemByFullName(projectName);
  if(job==null)  throw new NoSuchElementException("No such job exists: "+projectName);
  Run<?,?> run = job.getBuildByNumber(buildNumber);
  if(run==null)  throw new NoSuchElementException("No such build: "+string);
  return run;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Override
public Object fromString(String string) {
  String[] split = string.split("#");
  String projectName = split[0];
  int buildNumber = Integer.parseInt(split[1]);
  Job<?,?> job = (Job<?,?>) Hudson.getInstance().getItemByFullName(projectName);
  if(job==null)  throw new NoSuchElementException("No such job exists: "+projectName);
  Run<?,?> run = job.getBuildByNumber(buildNumber);
  if(run==null)  throw new NoSuchElementException("No such build: "+string);
  return run;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the jobs to be monitored.
 */
public Collection<AbstractProject> getJobs() {
  List<AbstractProject> r = new ArrayList<AbstractProject>();
  for (String job : Util.tokenize(jobs,",")) {
    AbstractProject j = Hudson.getInstance().getItemByFullName(job.trim(), AbstractProject.class);
    if(j!=null)
      r.add(j);
  }
  return r;
}

代码示例来源:origin: hudson/hudson-2.x

@Override
public Object fromString(String string) {
  String[] split = string.split("#");
  String projectName = split[0];
  int buildNumber = Integer.parseInt(split[1]);
  Job<?,?> job = (Job<?,?>) Hudson.getInstance().getItemByFullName(projectName);
  if(job==null)  throw new NoSuchElementException("No such job exists: "+projectName);
  Run<?,?> run = job.getBuildByNumber(buildNumber);
  if(run==null)  throw new NoSuchElementException("No such build: "+string);
  return run;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Gets the jobs to be monitored.
 */
public Collection<AbstractProject> getJobs() {
  List<AbstractProject> r = new ArrayList<AbstractProject>();
  for (String job : Util.tokenize(jobs,",")) {
    AbstractProject j = Hudson.getInstance().getItemByFullName(job.trim(), AbstractProject.class);
    if(j!=null)
      r.add(j);
  }
  return r;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-service

public AbstractProject<?, ?> findProjectByFullName(final String projectName) {
  checkProjectName(projectName);
  AbstractProject<?, ?> p = getHudson().getItemByFullName(projectName, AbstractProject.class);
  if (p != null) {
    this.securityService.checkPermission(p, Item.READ);
  }
  return p;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public FormValidation doCheck(@AncestorInPath AbstractProject project, @QueryParameter String value) {
  // Require CONFIGURE permission on this project
  if(!project.hasPermission(Item.CONFIGURE))  return FormValidation.ok();
  for (String name : Util.tokenize(fixNull(value), ",")) {
    name = name.trim();
    if(Hudson.getInstance().getItemByFullName(name)==null)
      return FormValidation.error(hudson.tasks.Messages.BuildTrigger_NoSuchProject(name,AbstractProject.findNearest(name).getName()));
  }
  
  return FormValidation.ok();
}

代码示例来源:origin: org.eclipse.hudson/hudson-service

public AbstractProject<?, ?> findProjectByFullName(final String projectName) {
  checkProjectName(projectName);
  AbstractProject<?, ?> p = getHudson().getItemByFullName(projectName, AbstractProject.class);
  if (p != null) {
    this.securityService.checkPermission(p, Item.READ);
  }
  return p;
}

代码示例来源:origin: org.jenkins-ci.plugins/global-build-stats

protected static AbstractBuild retrieveBuildFromJobBuildResult(JobBuildResult jbr){
  Job job = (Job)Hudson.getInstance().getItemByFullName(jbr.getJobName());
  if(job != null){
    return (AbstractBuild)job.getBuildByNumber(jbr.getBuildNumber());
  }
  return null;
}

代码示例来源:origin: org.jenkins-ci.plugins/global-build-stats

protected static AbstractBuild retrieveBuildFromJobBuildResult(JobBuildResult jbr){
  Job job = (Job)Hudson.getInstance().getItemByFullName(jbr.getJobName());
  if(job != null){
    return (AbstractBuild)job.getBuildByNumber(jbr.getBuildNumber());
  }
  return null;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Override
public int parseArguments(Parameters params) throws CmdLineException {
  Hudson h = Hudson.getInstance();
  String src = params.getParameter(0);
  AbstractProject s = h.getItemByFullName(src,AbstractProject.class);
  if (s==null)
    throw new CmdLineException(owner, "No such job '"+src+"' perhaps you meant "+ AbstractProject.findNearest(src)+"?");
  setter.addValue(s);
  return 1;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
   * Used for CLI binding.
   */
  @CLIResolver
  public static AbstractProject resolveForCLI(
      @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException {
    AbstractProject item = Hudson.getInstance().getItemByFullName(name, AbstractProject.class);
    if (item==null)
      throw new CmdLineException(null,Messages.AbstractItem_NoSuchJobExists(name,AbstractProject.findNearest(name).getFullName()));
    return item;
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
   * Used for CLI binding.
   */
  @CLIResolver
  public static AbstractItem resolveForCLI(
      @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException {
    AbstractItem item = Hudson.getInstance().getItemByFullName(name, AbstractItem.class);
    if (item==null)
      throw new CmdLineException(null,Messages.AbstractItem_NoSuchJobExists(name,AbstractProject.findNearest(name).getFullName()));
    return item;
  }
}

代码示例来源:origin: hudson/hudson-2.x

/**
   * Used for CLI binding.
   */
  @CLIResolver
  public static AbstractItem resolveForCLI(
      @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException {
    AbstractItem item = Hudson.getInstance().getItemByFullName(name, AbstractItem.class);
    if (item==null)
      throw new CmdLineException(null,Messages.AbstractItem_NoSuchJobExists(name,AbstractProject.findNearest(name).getFullName()));
    return item;
  }
}

代码示例来源:origin: hudson/hudson-2.x

/**
   * Used for CLI binding.
   */
  @CLIResolver
  public static AbstractProject resolveForCLI(
      @Argument(required=true,metaVar="NAME",usage="Job name") String name) throws CmdLineException {
    AbstractProject item = Hudson.getInstance().getItemByFullName(name, AbstractProject.class);
    if (item==null)
      throw new CmdLineException(null,Messages.AbstractItem_NoSuchJobExists(name,AbstractProject.findNearest(name).getFullName()));
    return item;
  }
}

相关文章

Hudson类方法