@Test public void getGeneCountsFromPhenotypesNoPresentNorAbsentTermsProvided() { when(this.request.getProperties(PRESENT_TERMS_LABEL)).thenReturn(Collections.emptyList()); when(this.request.getProperties(ABSENT_TERMS_LABEL)).thenReturn(Collections.emptyList()); final Response response = this.component.getGeneCountsFromPhenotypes(); verify(this.logger).error(NO_CONTEXT_PROVIDED_MSG); assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); }
@Override public Response getGeneCountsFromPhenotypes() { final Request request = this.container.getRequest(); final Set<String> presentTerms = extractTerms("present-term", request); final Set<String> absentTerms = extractTerms("absent-term", request); final Set<String> rejectedGenes = extractTerms("rejected-gene", request); final boolean withMatchCount = Boolean.parseBoolean((String) request.getProperty("with-match-count")); if (CollectionUtils.isEmpty(presentTerms) && CollectionUtils.isEmpty(absentTerms) && CollectionUtils.isEmpty(rejectedGenes)) { this.slf4Jlogger.error("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } final int startPage = NumberUtils.toInt((String) request.getProperty(START_PAGE_LABEL), 1); final int numResults = NumberUtils.toInt((String) request.getProperty(RESULTS_LIMIT_LABEL), -1); final int reqNo = NumberUtils.toInt((String) request.getProperty(REQ_NO), 0); try { final PanelData loaderKey = new PanelData(presentTerms, absentTerms, rejectedGenes, withMatchCount); final JSONObject panels = getPageData(this.genePanelLoader.get(loaderKey), startPage, numResults); panels.put(REQ_NO, reqNo); return Response.ok(panels, MediaType.APPLICATION_JSON_TYPE).build(); } catch (final ExecutionException e) { this.slf4Jlogger.warn("No content associated with [present-term: {}, absent-term: {}, rejected-gene: {}].", presentTerms, absentTerms, rejectedGenes); return Response.status(Response.Status.NO_CONTENT).build(); } catch (final IndexOutOfBoundsException e) { this.slf4Jlogger.error("The requested [{}: {}] is out of bounds.", START_PAGE_LABEL, startPage); return Response.status(Response.Status.BAD_REQUEST).build(); } catch (final Exception e) { this.slf4Jlogger.error("Unexpected exception while generating gene panel JSON: {}", e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }
DefaultGenePanelsResourceImpl extends XWikiResource implements GenePanelsResource { @Override public Response getGeneCountsFromPhenotypes() { final Request request = this.container.getRequest(); final Set<String> presentTerms = extractTerms("present-term", request); final Set<String> absentTerms = extractTerms("absent-term", request); final Set<String> rejectedGenes = extractTerms("rejected-gene", request); final boolean withMatchCount = Boolean.parseBoolean((String) request.getProperty("with-match-count")); if (CollectionUtils.isEmpty(presentTerms) && CollectionUtils.isEmpty(absentTerms) && CollectionUtils.isEmpty(rejectedGenes)) { this.slf4Jlogger.error("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } final int startPage = NumberUtils.toInt((String) request.getProperty(START_PAGE_LABEL), 1); final int numResults = NumberUtils.toInt((String) request.getProperty(RESULTS_LIMIT_LABEL), -1); final int reqNo = NumberUtils.toInt((String) request.getProperty(REQ_NO), 0); try { final PanelData loaderKey = new PanelData(presentTerms, absentTerms, rejectedGenes, withMatchCount); final JSONObject panels = getPageData(this.genePanelLoader.get(loaderKey), startPage, numResults); panels.put(REQ_NO, reqNo); return Response.ok(panels, MediaType.APPLICATION_JSON_TYPE).build(); } catch (final ExecutionException e) { this.slf4Jlogger.warn("No content associated with [present-term: {}, absent-term: {}, rejected-gene: {}].", presentTerms, absentTerms, rejectedGenes); return Response.status(Response.Status.NO_CONTENT).build(); } catch (final IndexOutOfBoundsException e) { this.slf4Jlogger.error("The requested [{}: {}] is out of bounds.", START_PAGE_LABEL, startPage); return Response.status(Response.Status.BAD_REQUEST).build(); } catch (final Exception e) { this.slf4Jlogger.error("Unexpected exception while generating gene panel JSON: {}", e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } } }
DefaultGenePanelsResourceImpl extends XWikiResource implements GenePanelsResource { @Override public Response getGeneCountsFromPhenotypes() { final Request request = this.container.getRequest(); final Set<String> presentTerms = extractTerms("present-term", request); final Set<String> absentTerms = extractTerms("absent-term", request); final Set<String> rejectedGenes = extractTerms("rejected-gene", request); final boolean withMatchCount = Boolean.parseBoolean((String) request.getProperty("with-match-count")); if (CollectionUtils.isEmpty(presentTerms) && CollectionUtils.isEmpty(absentTerms) && CollectionUtils.isEmpty(rejectedGenes)) { this.slf4Jlogger.error("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } final int startPage = NumberUtils.toInt((String) request.getProperty(START_PAGE_LABEL), 1); final int numResults = NumberUtils.toInt((String) request.getProperty(RESULTS_LIMIT_LABEL), -1); final int reqNo = NumberUtils.toInt((String) request.getProperty(REQ_NO), 0); try { final PanelData loaderKey = new PanelData(presentTerms, absentTerms, rejectedGenes, withMatchCount); final JSONObject panels = getPageData(this.genePanelLoader.get(loaderKey), startPage, numResults); panels.put(REQ_NO, reqNo); return Response.ok(panels, MediaType.APPLICATION_JSON_TYPE).build(); } catch (final ExecutionException e) { this.slf4Jlogger.warn("No content associated with [present-term: {}, absent-term: {}, rejected-gene: {}].", presentTerms, absentTerms, rejectedGenes); return Response.status(Response.Status.NO_CONTENT).build(); } catch (final IndexOutOfBoundsException e) { this.slf4Jlogger.error("The requested [{}: {}] is out of bounds.", START_PAGE_LABEL, startPage); return Response.status(Response.Status.BAD_REQUEST).build(); } catch (final Exception e) { this.slf4Jlogger.error("Unexpected exception while generating gene panel JSON: {}", e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }  }
DefaultGenePanelsResourceImpl extends XWikiResource implements GenePanelsResource { @Override public Response getGeneCountsFromPhenotypes() { final Request request = this.container.getRequest(); final Set<String> presentTerms = extractTerms("present-term", request); final Set<String> absentTerms = extractTerms("absent-term", request); final Set<String> rejectedGenes = extractTerms("rejected-gene", request); final boolean withMatchCount = Boolean.parseBoolean((String) request.getProperty("with-match-count")); if (CollectionUtils.isEmpty(presentTerms) && CollectionUtils.isEmpty(absentTerms) && CollectionUtils.isEmpty(rejectedGenes)) { this.slf4Jlogger.error("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } final int startPage = NumberUtils.toInt((String) request.getProperty(START_PAGE_LABEL), 1); final int numResults = NumberUtils.toInt((String) request.getProperty(RESULTS_LIMIT_LABEL), -1); final int reqNo = NumberUtils.toInt((String) request.getProperty(REQ_NO), 0); try { final PanelData loaderKey = new PanelData(presentTerms, absentTerms, rejectedGenes, withMatchCount); final JSONObject panels = getPageData(this.genePanelLoader.get(loaderKey), startPage, numResults); panels.put(REQ_NO, reqNo); return Response.ok(panels, MediaType.APPLICATION_JSON_TYPE).build(); } catch (final ExecutionException e) { this.slf4Jlogger.warn("No content associated with [present-term: {}, absent-term: {}, rejected-gene: {}].", presentTerms, absentTerms, rejectedGenes); return Response.status(Response.Status.NO_CONTENT).build(); } catch (final IndexOutOfBoundsException e) { this.slf4Jlogger.error("The requested [{}: {}] is out of bounds.", START_PAGE_LABEL, startPage); return Response.status(Response.Status.BAD_REQUEST).build(); } catch (final Exception e) { this.slf4Jlogger.error("Unexpected exception while generating gene panel JSON: {}", e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }  @Override Response getGeneCountsFromPhenotypes(); }
DefaultGenePanelsResourceImpl extends XWikiResource implements GenePanelsResource { @Override public Response getGeneCountsFromPhenotypes() { final Request request = this.container.getRequest(); final Set<String> presentTerms = extractTerms("present-term", request); final Set<String> absentTerms = extractTerms("absent-term", request); final Set<String> rejectedGenes = extractTerms("rejected-gene", request); final boolean withMatchCount = Boolean.parseBoolean((String) request.getProperty("with-match-count")); if (CollectionUtils.isEmpty(presentTerms) && CollectionUtils.isEmpty(absentTerms) && CollectionUtils.isEmpty(rejectedGenes)) { this.slf4Jlogger.error("No content provided."); return Response.status(Response.Status.NO_CONTENT).build(); } final int startPage = NumberUtils.toInt((String) request.getProperty(START_PAGE_LABEL), 1); final int numResults = NumberUtils.toInt((String) request.getProperty(RESULTS_LIMIT_LABEL), -1); final int reqNo = NumberUtils.toInt((String) request.getProperty(REQ_NO), 0); try { final PanelData loaderKey = new PanelData(presentTerms, absentTerms, rejectedGenes, withMatchCount); final JSONObject panels = getPageData(this.genePanelLoader.get(loaderKey), startPage, numResults); panels.put(REQ_NO, reqNo); return Response.ok(panels, MediaType.APPLICATION_JSON_TYPE).build(); } catch (final ExecutionException e) { this.slf4Jlogger.warn("No content associated with [present-term: {}, absent-term: {}, rejected-gene: {}].", presentTerms, absentTerms, rejectedGenes); return Response.status(Response.Status.NO_CONTENT).build(); } catch (final IndexOutOfBoundsException e) { this.slf4Jlogger.error("The requested [{}: {}] is out of bounds.", START_PAGE_LABEL, startPage); return Response.status(Response.Status.BAD_REQUEST).build(); } catch (final Exception e) { this.slf4Jlogger.error("Unexpected exception while generating gene panel JSON: {}", e.getMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build(); } }  @Override Response getGeneCountsFromPhenotypes();  }