Skip to content

Commit

Permalink
Merge pull request #445 from EBISPOT/issue-435
Browse files Browse the repository at this point in the history
issue-435: handle properly searching of non-existent terms
  • Loading branch information
serjoshua authored Jul 28, 2023
2 parents aa37fa7 + 9cf708a commit d12865e
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ private HttpEntity<PagedModel<V1Term>> getTerms(
terms = termRepository.findAllByShortForm(shortForm, lang, pageable);
} else if (oboId != null) {
terms = termRepository.findAllByOboId(oboId, lang, pageable);
} else {
terms = termRepository.findAll(lang, pageable);
if (terms == null) throw new ResourceNotFoundException("Ontology not found");
}
} else {
terms = termRepository.findAllByIri(id, lang, pageable);
Expand All @@ -80,10 +83,6 @@ private HttpEntity<PagedModel<V1Term>> getTerms(
}
}
}
if (terms == null || terms.getContent().isEmpty()) {
terms = termRepository.findAll(lang, pageable);
if (terms == null) throw new ResourceNotFoundException("Ontology not found");
}

return new ResponseEntity<>(assembler.toModel(terms, termAssembler), HttpStatus.OK);
}
Expand Down

0 comments on commit d12865e

Please sign in to comment.