jenkins.model.Jenkins.getItems()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(271)

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

Jenkins.getItems介绍

[英]Gets just the immediate children of Jenkins.
[中]只得到詹金斯的直系子女。

代码示例

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

/**
 * Gets just the immediate children of {@link Jenkins} 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: jenkinsci/jenkins

/** @see Jenkins#getAsynchPeople */
public AsynchPeople(Jenkins parent) {
  this.parent = parent;
  items = parent.getItems();
  unknown = User.getUnknown();
}

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

/**
   * Returns a read-only view of all {@link Job}s in this view.
   *
   * <p>
   * This method returns a separate copy each time to avoid
   * concurrent modification issue.
   */
  public synchronized List<TopLevelItem> getItems() {
    return Jenkins.getInstance().getItems();
//        List<TopLevelItem> items = new ArrayList<TopLevelItem>(jobNames.size());
//        for (String name : jobNames) {
//            TopLevelItem item = Hudson.getInstance().getItem(name);
//            if(item!=null)
//                items.add(item);
//        }
//        return items;
  }

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

public People(Jenkins 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: jenkinsci/jenkins

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

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

jobs = h.getItems();

代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup

protected String createUniqueProjectName() {
  return "test"+jenkins.getItems().size();
}

代码示例来源:origin: jenkinsci/jenkins-test-harness

protected String createUniqueProjectName() {
  return "test"+ jenkins.getItems().size();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Gets just the immediate children of {@link Jenkins} 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.jenkins-ci.main/jenkins-core

/** @see Jenkins#getAsynchPeople */
public AsynchPeople(Jenkins parent) {
  this.parent = parent;
  items = parent.getItems();
  unknown = User.getUnknown();
}

代码示例来源:origin: jenkinsci/instant-messaging-plugin

@Override
@SuppressWarnings("unchecked")
public List<AbstractProject<?,?>> getTopLevelJobs() {
  @SuppressWarnings("rawtypes")
  List items = Jenkins.getInstance().getItems(AbstractProject.class);
  return items;
}

代码示例来源:origin: SonarSource/sonar-scanner-jenkins

@Override
public List getWorkDomain() {
 final List<Project<?, ?>> workDomain = new ArrayList<>();
 for (final Project item : Jenkins.getInstance().getItems(Project.class)) {
  if (!getSonarRunnerBuilders(item).isEmpty()) {
   workDomain.add(item);
  }
 }
 return workDomain;
}

代码示例来源:origin: SonarSource/sonar-scanner-jenkins

@Override
public List<AbstractProject<?, ?>> getWorkDomain() {
 final List<AbstractProject<?, ?>> workDomain = new ArrayList<>();
 for (final AbstractProject item : Jenkins.getInstance().getItems(AbstractProject.class)) {
  if (getSonarPublisher(item) != null) {
   workDomain.add(item);
  }
 }
 return workDomain;
}

代码示例来源:origin: groupon/DotCi

public OrganizationContainer getOrganizationContainer(final String viewName) {
  final List<OrganizationContainer> containers = Jenkins.getInstance().getItems(OrganizationContainer.class);
  for (final OrganizationContainer container : containers) {
    if (container.getName().equalsIgnoreCase(viewName)) {
      return container;
    }
  }
  return null;
}

代码示例来源:origin: org.jenkins-ci.plugins/disk-usage

@Override
  public void onLoaded(){
    for(Item item : Jenkins.getInstance().getItems()){
      DiskUsageUtil.addProperty(item);
    }
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public People(Jenkins 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: jenkinsci/cloudbees-folder-plugin

private Folder createFolder() throws IOException {
  return r.jenkins.createProject(Folder.class, "folder" + r.jenkins.getItems().size());
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

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

代码示例来源:origin: jenkinsci/promoted-builds-plugin

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

代码示例来源:origin: jenkinsci/workflow-multibranch-plugin

@Before
public void cleanOutAllItems() throws Exception {
  for (TopLevelItem i : j.getInstance().getItems()) {
    i.delete();
  }
}

相关文章

Jenkins类方法