Source:
public QueryResponse getSources(@PathVariable("variantCoreString") String variantCoreString, @RequestParam(name = "species") String species, @RequestParam(name = "assembly") String assembly, @RequestParam(name = "annot-vep-version", required = false) String annotationVepVersion, @RequestParam(name = "annot-vep-cache-version", required = false) String annotationVepCacheVersion, HttpServletResponse response) throws IllegalArgumentException { initializeQuery(); try { checkParameters(variantCoreString, annotationVepVersion, annotationVepCacheVersion, species, assembly); } catch (IllegalArgumentException e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setErrorQueryResponse(e.getMessage()); } MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species + "_" + assembly)); Optional<VariantWithSamplesAndAnnotation> variantEntity; try { variantEntity = getVariantByCoordinatesAndAnnotationVersion(variantCoreString, annotationVepVersion, annotationVepCacheVersion); } catch (AnnotationMetadataNotFoundException ex) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(ex.getMessage()); } catch (IllegalArgumentException ex) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(ex.getMessage()); } List<VariantSourceEntryWithSampleNames> variantSources = new ArrayList<>(); if (!variantEntity.isPresent()) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return setQueryResponse(buildQueryResult(variantSources, 0)); } variantEntity.get().getSourceEntries().forEach(sourceEntry -> { variantSources.add(sourceEntry); }); QueryResult<VariantSourceEntryWithSampleNames> queryResult = buildQueryResult(variantSources, variantSources.size()); return setQueryResponse(queryResult); }

Target:
public QueryResponse getSources(@PathVariable("variantCoreString") String variantCoreString, @RequestParam(name = "species") String species, @RequestParam(name = "assembly") String assembly, @RequestParam(name = "annot-vep-version", required = false) String annotationVepVersion, @RequestParam(name = "annot-vep-cache-version", required = false) String annotationVepCacheVersion, HttpServletResponse response) throws IllegalArgumentException { initializeQuery(); try { checkParameters(variantCoreString, annotationVepVersion, annotationVepCacheVersion, species, assembly); } catch (IllegalArgumentException e) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setErrorQueryResponse(e.getMessage()); } MultiMongoDbFactory.setDatabaseNameForCurrentThread(DBAdaptorConnector.getDBName(species + "_" + assembly)); Optional<VariantWithSamplesAndAnnotation> variantEntity; try { variantEntity = getVariantByCoordinatesAndAnnotationVersion(variantCoreString, annotationVepVersion, annotationVepCacheVersion); } catch (AnnotationMetadataNotFoundException | IllegalArgumentException ex) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return setQueryResponse(ex.getMessage()); } List<VariantSourceEntryWithSampleNames> variantSources = new ArrayList<>(); if (!variantEntity.isPresent()) { response.setStatus(HttpServletResponse.SC_NOT_FOUND); return setQueryResponse(buildQueryResult(variantSources, 0)); } variantEntity.get().getSourceEntries().forEach(sourceEntry -> { variantSources.add(sourceEntry); }); QueryResult<VariantSourceEntryWithSampleNames> queryResult = buildQueryResult(variantSources, variantSources.size()); return setQueryResponse(queryResult); }