@Test public void getTermsNoTermIdsIncluded() { when(this.request.getProperties(TERM_ID)).thenReturn(Collections.emptyList()); final Response response = this.component.getTerms(HPO_NAME); Assert.assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); verify(this.logger, times(1)).info("No content provided."); }
@Override public Response getTerms(@Nonnull final String vocabularyId) { final Vocabulary vocabulary = this.vm.getVocabulary(vocabularyId); if (vocabulary == null) { this.slf4Jlogger.error("The requested vocabulary [{}] was not found", vocabularyId); return Response.status(Response.Status.NOT_FOUND).build(); } final Request request = this.container.getRequest(); final List<Object> termIds = request.getProperties(TERM_ID); termIds.removeIf(Objects::isNull); if (CollectionUtils.isEmpty(termIds)) { this.slf4Jlogger.info("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } this.slf4Jlogger.debug("Retrieving terms with IDs: [{}]", termIds); final JSONObject rep = new JSONObject() .put(ROWS, this.createRows(vocabulary, termIds)) .put(LINKS, this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(rep, MediaType.APPLICATION_JSON_TYPE).build(); }
DefaultVocabularyTermsResource extends XWikiResource implements VocabularyTermsResource { @Override public Response getTerms(@Nonnull final String vocabularyId) { final Vocabulary vocabulary = this.vm.getVocabulary(vocabularyId); if (vocabulary == null) { this.slf4Jlogger.error("The requested vocabulary [{}] was not found", vocabularyId); return Response.status(Response.Status.NOT_FOUND).build(); } final Request request = this.container.getRequest(); final List<Object> termIds = request.getProperties(TERM_ID); termIds.removeIf(Objects::isNull); if (CollectionUtils.isEmpty(termIds)) { this.slf4Jlogger.info("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } this.slf4Jlogger.debug("Retrieving terms with IDs: [{}]", termIds); final JSONObject rep = new JSONObject() .put(ROWS, this.createRows(vocabulary, termIds)) .put(LINKS, this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(rep, MediaType.APPLICATION_JSON_TYPE).build(); } }
DefaultVocabularyTermsResource extends XWikiResource implements VocabularyTermsResource { @Override public Response getTerms(@Nonnull final String vocabularyId) { final Vocabulary vocabulary = this.vm.getVocabulary(vocabularyId); if (vocabulary == null) { this.slf4Jlogger.error("The requested vocabulary [{}] was not found", vocabularyId); return Response.status(Response.Status.NOT_FOUND).build(); } final Request request = this.container.getRequest(); final List<Object> termIds = request.getProperties(TERM_ID); termIds.removeIf(Objects::isNull); if (CollectionUtils.isEmpty(termIds)) { this.slf4Jlogger.info("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } this.slf4Jlogger.debug("Retrieving terms with IDs: [{}]", termIds); final JSONObject rep = new JSONObject() .put(ROWS, this.createRows(vocabulary, termIds)) .put(LINKS, this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(rep, MediaType.APPLICATION_JSON_TYPE).build(); }  }
DefaultVocabularyTermsResource extends XWikiResource implements VocabularyTermsResource { @Override public Response getTerms(@Nonnull final String vocabularyId) { final Vocabulary vocabulary = this.vm.getVocabulary(vocabularyId); if (vocabulary == null) { this.slf4Jlogger.error("The requested vocabulary [{}] was not found", vocabularyId); return Response.status(Response.Status.NOT_FOUND).build(); } final Request request = this.container.getRequest(); final List<Object> termIds = request.getProperties(TERM_ID); termIds.removeIf(Objects::isNull); if (CollectionUtils.isEmpty(termIds)) { this.slf4Jlogger.info("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } this.slf4Jlogger.debug("Retrieving terms with IDs: [{}]", termIds); final JSONObject rep = new JSONObject() .put(ROWS, this.createRows(vocabulary, termIds)) .put(LINKS, this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(rep, MediaType.APPLICATION_JSON_TYPE).build(); }  @Override Response getTerms(@Nonnull final String vocabularyId); }
DefaultVocabularyTermsResource extends XWikiResource implements VocabularyTermsResource { @Override public Response getTerms(@Nonnull final String vocabularyId) { final Vocabulary vocabulary = this.vm.getVocabulary(vocabularyId); if (vocabulary == null) { this.slf4Jlogger.error("The requested vocabulary [{}] was not found", vocabularyId); return Response.status(Response.Status.NOT_FOUND).build(); } final Request request = this.container.getRequest(); final List<Object> termIds = request.getProperties(TERM_ID); termIds.removeIf(Objects::isNull); if (CollectionUtils.isEmpty(termIds)) { this.slf4Jlogger.info("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } this.slf4Jlogger.debug("Retrieving terms with IDs: [{}]", termIds); final JSONObject rep = new JSONObject() .put(ROWS, this.createRows(vocabulary, termIds)) .put(LINKS, this.autolinker.get().forResource(getClass(), this.uriInfo).build()); return Response.ok(rep, MediaType.APPLICATION_JSON_TYPE).build(); }  @Override Response getTerms(@Nonnull final String vocabularyId);  }