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.
@param recurse {@code false} not to recurse in ItemGroups
true to recurse in ItemGroups
168395
private List<TopLevelItem> getItems(boolean recurse) {
        SortedSet<String> names;
        List<TopLevelItem> items = new ArrayList<>();

        synchronized (this) {
            names = new TreeSet<>(jobNames);
        }

        ItemGroup<? extends TopLevelItem> parent = getOwner().getItemGroup();
        List<TopLevelItem> parentItems = new ArrayList<>(parent.getItems());
        includeItems(parent, parentItems, names);

        Boolean statusFilter = this.statusFilter; // capture the value to isolate us from concurrent update
        Iterable<? extends TopLevelItem> candidates;
        if (recurse) {
            candidates = parent.getAllItems(TopLevelItem.class);
        } else {
            candidates = parent.getItems();
        }
        for (TopLevelItem item : candidates) {
            if (!names.contains(item.getRelativeNameFrom(getOwner().getItemGroup()))) continue;
            // Add if no status filter or filter matches enabled/disabled status:
            if(statusFilter == null || !(item instanceof ParameterizedJobMixIn.ParameterizedJob) // TODO or better to call the more generic Job.isBuildable?
                              || ((ParameterizedJobMixIn.ParameterizedJob)item).isDisabled() ^ statusFilter)
                items.add(item);
        }

        // check the filters
        Iterable<ViewJobFilter> jobFilters = getJobFilters();
        List<TopLevelItem> allItems = new ArrayList<>(parentItems);
        if (recurse) allItems = expand(allItems, new ArrayList<>());
    	for (ViewJobFilter jobFilter: jobFilters) {
    		items = jobFilter.filter(items, allItems, this);
    	}
        // for sanity, trim off duplicates
        items = new ArrayList<>(new LinkedHashSet<>(items));
        
        return items;
    }
1065163
public List<Flow<Job<T>>> getAllFlow()
   {
      List<Flow<Job<T>>> list = new ArrayList<Flow<Job<T>>>();
      List<Node> nodeList = childNode.get("flow");
      for(Node node: nodeList)
      {
         Flow<Job<T>>  type = new FlowImpl<Job<T>>(this, "flow", childNode, node);
         list.add(type);
      }
      return list;
   }
884943
public ICommonsSet <JobKey> getJobKeys (final GroupMatcher <JobKey> matcher) throws SchedulerException
  {
    validateState ();

    return m_aResources.getJobStore ().getJobKeys (_getOrDefault (matcher));
  }
1278036
private static List<File> findFiles(final File parent, boolean recurse) {
        final List<File> result = new ArrayList<>();
        if (parent.isDirectory()) {
            File[] files = parent.listFiles();
            files = (files != null ? files : new File[0]);
            for (File child : files) {
                if (child.isFile() && child.getName().endsWith(".java")) {
                    result.add(child);
                }
            }
            if (recurse) {
                for (File child : files) {
                    if (child.isDirectory() && child.getName().startsWith(".") == false) {
                        result.addAll(findFiles(child, recurse));
                    }
                }
            }
        } else {
            if (parent.getName().endsWith(".java")) {
                result.add(parent);
            }
        }
        return result;
    }
49279
public void setJobSummaryList(java.util.Collection<JobSummary> jobSummaryList) {
        if (jobSummaryList == null) {
            this.jobSummaryList = null;
            return;
        }

        this.jobSummaryList = new java.util.ArrayList<JobSummary>(jobSummaryList);
    }
1287439
@Override
	public Set<JobKey> getJobKeys(String group) throws SchedulerException {
		return scheduler.getJobKeys(GroupMatcher.jobGroupEquals(group));
	}
827220
List<Job> getRemainingJobs() {
    if (mThread.isAlive()) {
      LOG.warn("Internal error: Polling running monitor for jobs");
    }
    synchronized (mJobs) {
      return new ArrayList<Job>(mJobs);
    }
  }
190745
public JobFolder createJobFolder(final String finalJobFolderPath) throws IOException {
    LOG.log(Level.FINE, "Final job submission Directory: " + finalJobFolderPath);
    return new JobFolder(this.fileSystem, new Path(finalJobFolderPath));
  }
305753
public static <J extends Job<J,R>, R extends Run<J,R>> RunList<R> fromJobs(Iterable<? extends J> jobs) {
        List<Iterable<R>> runLists = new ArrayList<>();
        for (Job j : jobs)
            runLists.add(j.getBuilds());
        return new RunList<>(combine(runLists));
    }
206099
@SuppressWarnings("unchecked") // map output key class
  private K[] readPartitions(FileSystem fs, Path p, Class<K> keyClass,
      JobConf job) throws IOException {
    SequenceFile.Reader reader = new SequenceFile.Reader(fs, p, job);
    ArrayList<K> parts = new ArrayList<K>();
    K key = (K) ReflectionUtils.newInstance(keyClass, job);
    NullWritable value = NullWritable.get();
    while (reader.next(key, value)) {
      parts.add(key);
      key = (K) ReflectionUtils.newInstance(keyClass, job);
    }
    reader.close();
    return parts.toArray((K[])Array.newInstance(keyClass, parts.size()));
  }
767438
public Map<String, Job> getJobs(FolderJob folder) throws IOException {
        return getJobs(folder, null);
    }
783567
def get_jobs(self, recursive=True):
        
        if recursive:
            ret_dict = self.jobs.copy()
            ret_dict.update(self._scatter_link.get_jobs(recursive))
            return ret_dict
        return self.jobs
1064127
public Stage rerunJobs(final Stage stage, final List<String> jobNames, final HttpOperationResult result) {
        final StageIdentifier identifier = stage.getIdentifier();
        HealthStateType healthStateForStage = HealthStateType.general(HealthStateScope.forStage(identifier.getPipelineName(), identifier.getStageName()));

        if (jobNames == null || jobNames.isEmpty()) {
            String message = "No job was selected to re-run.";
            result.badRequest(message, message, healthStateForStage);
            return null;
        }
        try {
            Stage resultStage = lockAndRerunStage(identifier.getPipelineName(), identifier.getPipelineCounter(), identifier.getStageName(), (pipelineName, stageName, context) -> {
                StageConfig stageConfig = goConfigService.stageConfigNamed(identifier.getPipelineName(), identifier.getStageName());
                String latestMd5 = goConfigService.getCurrentConfig().getMd5();
                try {
                    return instanceFactory.createStageForRerunOfJobs(stage, jobNames, context, stageConfig, timeProvider, latestMd5);
                } catch (CannotRerunJobException e) {
                    result.notFound(e.getMessage(), e.getMessage(), healthStateForStage);
                    throw e;
                }
            }, new ResultUpdatingErrorHandler(result));

            result.accepted(String.format("Request to rerun jobs accepted", identifier), "", healthStateForStage);
            return resultStage;
        } catch (RuntimeException e) {
            if (result.canContinue()) {
                String message = String.format("Job rerun request for job(s) [%s] could not be completed because of unexpected failure. Cause: %s", StringUtils.join(jobNames.toArray(), ", "),
                        e.getMessage());
                result.internalServerError(message, healthStateForStage);
                LOGGER.error(message, e);
            }
            return null;
        }
    }
578362
@SuppressWarnings("unused") // called through reflection by RequestServer
  public JobsV3 list(int version, JobsV3 s) {
    Job[] jobs = Job.jobs();
    // Jobs j = new Jobs();
    // j._jobs = Job.jobs();
    // PojoUtils.copyProperties(s, j, PojoUtils.FieldNaming.ORIGIN_HAS_UNDERSCORES);
    s.jobs = new JobV3[jobs.length];

    int i = 0;
    for (Job j : jobs) {
      try { s.jobs[i] = (JobV3) SchemaServer.schema(version, j).fillFromImpl(j); }
      // no special schema for this job subclass, so fall back to JobV3
      catch (H2ONotFoundArgumentException e) { s.jobs[i] = new JobV3().fillFromImpl(j); }
      i++; // Java does the increment before the function call which throws?!
    }
    return s;
  }
361136
public void getPlanNodeList_recurse(ArrayList<AbstractPlanNode> collected,
            HashSet<AbstractPlanNode> visited) {
        if (visited.contains(this)) {
            assert(false): "do not expect loops in plangraph.";
            return;
        }
        visited.add(this);

        for (AbstractPlanNode n : m_children) {
            n.getPlanNodeList_recurse(collected, visited);
        }
        collected.add(this);
    }
1362747
public List<LogEvent> getLogs(LogLevel level, boolean recurse)
    {
        List<LogEvent> levelLogs = new LinkedList<LogEvent>();

        for (LogEvent log : this) {
            if (log.getLevel() == level) {
                levelLogs.add(log);
            }

            if (recurse && log instanceof LogTreeNode) {
                levelLogs.addAll(((LogTreeNode) log).getLogs(level, true));
            }
        }

        return levelLogs;
    }
64215
public List<CmsRole> getChildren(boolean recursive) {

        List<CmsRole> children = new ArrayList<CmsRole>();
        Iterator<CmsRole> itChildren = m_children.iterator();
        while (itChildren.hasNext()) {
            CmsRole child = itChildren.next();
            if (child.isOrganizationalUnitIndependent()) {
                child = child.forOrgUnit(null);
            } else {
                child = child.forOrgUnit(m_ouFqn);
            }
            children.add(child);
            if (recursive) {
                for (CmsRole grandChild : child.getChildren(true)) {
                    if (!children.contains(grandChild)) {
                        children.add(grandChild);
                    }
                }
            }
        }
        return children;
    }