Source:
<code>private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) <START> .depth(3) END> .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }</code><technical_language>awesome</technical_language>

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String buildTreeContent = "id,fullDisplayName,number,url,building,result,duration,timestamp,actions[causes[shortDescription],failCount,totalCount,skipCount]"; String jobTreeContent = String.format( "buildable,color,description,displayName,healthReport[score,description],inQueue,lastBuild[%s],name,url", buildTreeContent); String tree = String.format("jobs[%1$s,activeConfigurations[%1$s]]", jobTreeContent); String url = HudsonUrl.create(folderUrl).tree(tree).include("/*/job").match("name", ids).toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<>(); List<Object> jobsNodes = hudson.getJob(); Set<String> urls = new HashSet<>(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonMatrixMatrixProject.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); if (!urls.contains(jobUrl)) { job.setUrl(jobUrl); buildPlans.add(job); urls.add(jobUrl); } } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }