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

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

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

Hudson.getItems介绍

[英]Gets just the immediate children of Hudson.
[中]只得到哈德逊的直系子女。

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * @deprecated
 *      Used only for mapping jobs to URL in a case-insensitive fashion.
 */
@Deprecated
public TopLevelItem getJobCaseInsensitive(String name) {
  String match = Functions.toEmailSafeString(name);
  for(TopLevelItem item : getItems()) {
    if(Functions.toEmailSafeString(item.getName()).equalsIgnoreCase(match)) {
  return item;
}
      }
  return null;
}

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

/**
 * Gets just the immediate children of {@link Hudson} but of the given type.
 */
public <T> List<T> getItems(Class<T> type) {
  List<T> r = new ArrayList<T>();
  for (TopLevelItem i : getItems()) {
    if (type.isInstance(i)) {
      r.add(type.cast(i));
    }
  }
  return r;
}

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

/**
 * Gets just the immediate children of {@link Hudson} but of the given type.
 */
public <T> List<T> getItems(Class<T> type) {
  List<T> r = new ArrayList<T>();
  for (TopLevelItem i : getItems()) {
    if (type.isInstance(i)) {
      r.add(type.cast(i));
    }
  }
  return r;
}

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

/**
 * Gets just the immediate children of {@link Hudson} but of the given type.
 */
public <T> List<T> getItems(Class<T> type) {
  List<T> r = new ArrayList<T>();
  for (TopLevelItem i : getItems()) {
    T t = LazyTopLevelItem.getIfInstanceOf(i, type);
    if (t != null) {
      r.add(t);
    }
  }
  return r;
}

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

@Override
public Collection<TopLevelItem> getItems() {
  List<TopLevelItem> items = new ArrayList<TopLevelItem>();
  for (TopLevelItem item : Hudson.getInstance().getItems()) {
    if (item.hasPermission(Job.CONFIGURE)) {
      items.add(item);
    }
  }
  return Collections.unmodifiableList(items);
}

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

@Override
public Collection<TopLevelItem> getItems() {
  List<TopLevelItem> items = new ArrayList<TopLevelItem>();
  for (TopLevelItem item : Hudson.getInstance().getItems()) {
    if (item.hasPermission(Job.CONFIGURE)) {
      items.add(item);
    }
  }
  return Collections.unmodifiableList(items);
}

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

@Override
public Collection<TopLevelItem> getItems() {
  List<TopLevelItem> items = new ArrayList<TopLevelItem>();
  for (TopLevelItem item : Hudson.getInstance().getItems()) {
    if (item.hasPermission(Job.CONFIGURE)) {
      items.add(item);
    }
  }
  return Collections.unmodifiableList(items);
}

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

public static Collection<MetaProject> list(final Filter filter) {
  List<MetaProject> projects = new ArrayList<MetaProject>();
  for (Item item : Hudson.getInstance().getItems()) {
    if (item instanceof AbstractProject) {
      MetaProject project = new MetaProject((AbstractProject)item);
      if (filter == null || filter.accept(project)) {
        projects.add(project);
      }
    }
  }
  return projects;
}

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

public static Collection<MetaProject> list(final Filter filter) {
  List<MetaProject> projects = new ArrayList<MetaProject>();
  for (Item item : Hudson.getInstance().getItems()) {
    if (item instanceof AbstractProject) {
      MetaProject project = new MetaProject((AbstractProject) item);
      if (filter == null || filter.accept(project)) {
        projects.add(project);
      }
    }
  }
  return projects;
}

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

public static Collection<MetaProject> list(final Filter filter) {
  List<MetaProject> projects = new ArrayList<MetaProject>();
  for (Item item : Hudson.getInstance().getItems()) {
    if (item instanceof AbstractProject) {
      MetaProject project = new MetaProject((AbstractProject)item);
      if (filter == null || filter.accept(project)) {
        projects.add(project);
      }
    }
  }
  return projects;
}

代码示例来源:origin: etsy/jenkins-master-project

@Override
 public void onRenamed(Item item, String oldName, String newName) {
  List<MasterProject> projects =
    Hudson.getInstance().getItems(MasterProject.class);
  for (MasterProject project : projects) {
   project.onRenamed(item, oldName, newName);
  }
 }
};

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

@Override
public Set<String> getGroups() {
  Set<String> r = new HashSet<String>();
  r.addAll(super.getGroups());
  for (Job<?,?> j : Hudson.getInstance().getItems(Job.class)) {
    AuthorizationMatrixProperty amp = j.getProperty(AuthorizationMatrixProperty.class);
    if (amp != null)
      r.addAll(amp.getGroups());
  }
  return r;
}

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

@Override
public Set<String> getGroups() {
  Set<String> r = new HashSet<String>();
  r.addAll(super.getGroups());
  for (Job<?,?> j : Hudson.getInstance().getItems(Job.class)) {
    AuthorizationMatrixProperty amp = j.getProperty(AuthorizationMatrixProperty.class);
    if (amp != null)
      r.addAll(amp.getGroups());
  }
  return r;
}

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

/**
 * Finds a {@link AbstractProject} that has the name closest to the given name.
 */
public static AbstractProject findNearest(String name) {
  List<AbstractProject> projects = Hudson.getInstance().getItems(AbstractProject.class);
  String[] names = new String[projects.size()];
  for( int i=0; i<projects.size(); i++ )
    names[i] = projects.get(i).getName();
  String nearest = EditDistance.findNearest(name, names);
  return (AbstractProject)Hudson.getInstance().getItem(nearest);
}

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

public People(Hudson parent) {
  this.parent = parent;
  // for Hudson, really load all users
  Map<User,UserInfo> users = getUserInfo(parent.getItems());
  User unknown = User.getUnknown();
  for (User u : User.getAll()) {
    if(u==unknown)  continue;   // skip the special 'unknown' user
    if(!users.containsKey(u))
      users.put(u,new UserInfo(u,null,null));
  }
  this.users = toList(users);
}

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

/**
 * Returns projects that are tied on this node.
 */
@Exported
public List<AbstractProject> getTiedJobs() {
  List<AbstractProject> r = new ArrayList<AbstractProject>();
  for( AbstractProject p : Util.filter(Hudson.getInstance().getItems(),AbstractProject.class) ) {
    if(this.equals(p.getAssignedLabel()))
      r.add(p);
  }
  return r;
}

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

public People(Hudson parent) {
  this.parent = parent;
  // for Hudson, really load all users
  Map<User,UserInfo> users = getUserInfo(parent.getItems());
  User unknown = User.getUnknown();
  for (User u : User.getAll()) {
    if(u==unknown)  continue;   // skip the special 'unknown' user
    if(!users.containsKey(u))
      users.put(u,new UserInfo(u,null,null));
  }
  this.users = toList(users);
}

代码示例来源:origin: etsy/jenkins-master-project

@Override
protected void submit(StaplerRequest req, StaplerResponse res)
  throws IOException, ServletException, Descriptor.FormException {
 // Handle the job list
 jobNames.clear();
 for (TopLevelItem item : Hudson.getInstance().getItems()) {
  if (req.getParameter(item.getName()) != null) {
   jobNames.add(item.getName());
  }
 }
 super.submit(req, res);
}

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

public People(Hudson parent) {
  this.parent = parent;
  // for Hudson, really load all users
  Map<User,UserInfo> users = getUserInfo(parent.getItems());
  User unknown = User.getUnknown();
  for (User u : User.getAll()) {
    if(u==unknown)  continue;   // skip the special 'unknown' user
    if(!users.containsKey(u))
      users.put(u,new UserInfo(u,null,null));
  }
  this.users = toList(users);
}

代码示例来源:origin: org.hudsonci.plugins/downstream-ext

public AutoCompletionCandidates doAutoCompleteChildProjects(@QueryParameter String value) {
  AutoCompletionCandidates candidates = new AutoCompletionCandidates();
  List<Job> jobs = Hudson.getInstance().getItems(Job.class);
  for (Job job: jobs) {
    if (job.getFullName().startsWith(value)) {
      if (job.hasPermission(Item.READ)) {
        candidates.add(job.getFullName());
      }
    }
  }
  return candidates;
}

相关文章

Hudson类方法