/** * Returns an Observable over the Map representing the job to be returned to the user. * * @param ticket The ticket that uniquely identifies the job * * @return An Observable over the Map representing the job to be returned to the user or an Observable wrapping * JobNotFoundException if the Job is not available in the ApiJobStore */ public Observable<Map<String, String>> getJobViewObservable(String ticket) { return apiJobStore.get(ticket) .switchIfEmpty( Observable.error(new JobNotFoundException(ErrorMessageFormat.JOB_NOT_FOUND.format(ticket))) ) .map(jobRow -> jobPayloadBuilder.buildPayload(jobRow, uriInfo)); }