/** * Get a single Job from the server. * * @return A single Job, null if not present * @throws IOException */ public JobWithDetails getJob(String jobName) throws IOException { try { JobWithDetails job = client.get("/job/"+encode(jobName),JobWithDetails.class); job.setClient(client); return job; } catch (HttpResponseException e) { if(e.getStatusCode() == 404) { return null; } throw e; } }
/** * Get a single Job from the given folder. * * @param folder {@link FolderJob} * @param jobName name of the job to get details of. * @return A single Job, null if not present * @throws IOException in case of an error. */ public JobWithDetails getJob(FolderJob folder, String jobName) throws IOException { try { JobWithDetails job = client.get(UrlUtils.toJobBaseUrl(folder, jobName), JobWithDetails.class); job.setClient(client); return job; } catch (HttpResponseException e) { LOGGER.debug("getJob(folder={}, jobName={}) status={}", folder, jobName, e.getStatusCode()); if (e.getStatusCode() == HttpStatus.SC_NOT_FOUND) { // TODO: Think hard about this. return null; } throw e; } }