@Test public void showEnrichmentTags() throws Exception { ResultActions result = mockMvc.perform(get(DUMP_ENRICHMENT_PATH) .accept(MediaType.APPLICATION_JSON)); assertOk(result); result .andExpect(jsonPath("$.items", hasSize(3))) .andExpect(jsonPath("$.items.[0].id").value(equalsLong(enrichmentTags.get(0).getId()))) .andExpect(jsonPath("$.items.[0].judgmentId").value(equalsLong(enrichmentTags.get(0).getJudgmentId()))) .andExpect(jsonPath("$.items.[0].tagType").value(REFERENCED_REGULATIONS_TAG_TYPE)) .andExpect(jsonPath("$.items.[0].value.[0].journalTitle").value(REFERENCED_REGULATION_TAG_JOURNAL_TITLE)) .andExpect(jsonPath("$.items.[0].value.[0].journalNo").value(REFERENCED_REGULATION_TAG_JOURNAL_NO)) .andExpect(jsonPath("$.items.[0].value.[0].journalYear").value(REFERENCED_REGULATION_TAG_JOURNAL_YEAR)) .andExpect(jsonPath("$.items.[0].value.[0].journalEntry").value(REFERENCED_REGULATION_TAG_JOURNAL_ENTRY)) .andExpect(jsonPath("$.items.[0].value.[0].text").value(REFERENCED_REGULATION_TAG_TEXT)) .andExpect(jsonPath("$.items.[1].id").value(equalsLong(enrichmentTags.get(1).getId()))) .andExpect(jsonPath("$.items.[1].judgmentId").value(equalsLong(enrichmentTags.get(1).getJudgmentId()))) .andExpect(jsonPath("$.items.[1].tagType").value(REFERENCED_COURT_CASES)) .andExpect(jsonPath("$.items.[1].value.[0].caseNumber").value(REFERENCED_COURT_CASES_TAG_FIRST_CASE_NUMBER)) .andExpect(jsonPath("$.items.[1].value.[0].judgmentIds", hasSize(2))) .andExpect(jsonPath("$.items.[1].value.[0].judgmentIds.[0]").value(equalsLong(REFERENCED_COURT_CASES_TAG_FIRST_JUDGMENT_IDS[0]))) .andExpect(jsonPath("$.items.[1].value.[0].judgmentIds.[1]").value(equalsLong(REFERENCED_COURT_CASES_TAG_FIRST_JUDGMENT_IDS[1]))) .andExpect(jsonPath("$.items.[1].value.[1].caseNumber").value(REFERENCED_COURT_CASES_TAG_SECOND_CASE_NUMBER)) .andExpect(jsonPath("$.items.[1].value.[1].judgmentIds", hasSize(0))) .andExpect(jsonPath("$.items.[2].id").value(equalsLong(enrichmentTags.get(2).getId()))) .andExpect(jsonPath("$.items.[2].judgmentId").value(equalsLong(enrichmentTags.get(2).getJudgmentId()))) .andExpect(jsonPath("$.items.[2].tagType").value(THIRD_ENRICHMENT_TAG_TYPE)) .andExpect(jsonPath("$.items.[2].value.keywords.[0]").value(THIRD_ENRICHMENT_TAG_FIRST_ARRAY_VALUE)) .andExpect(jsonPath("$.items.[2].value.keywords.[1]").value(THIRD_ENRICHMENT_TAG_SECOND_ARRAY_VALUE)) .andExpect(jsonPath("$.items.[2].value.keywords.[2]").value(THIRD_ENRICHMENT_TAG_THIRD_ARRAY_VALUE)); }
@RequestMapping(value = "") @RestrictParamsNames @ResponseBody public ResponseEntity<Object> showEnrichmentTags( @RequestHeader(value = "Accept", required = false) String acceptHeader, @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize, @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber, HttpServletRequest request ) throws WrongRequestParameterException { checkRequestMethod(request, HttpMethod.GET); checkAcceptHeader(acceptHeader, MediaType.APPLICATION_JSON); Pagination pagination = parametersExtractor.extractAndValidatePagination(pageSize, pageNumber); EnrichmentTagSearchFilter searchFilter = EnrichmentTagSearchFilter.builder() .limit(pagination.getPageSize()) .offset(pagination.getOffset()) .filter(); SearchResult<EnrichmentTag> searchResult = databaseSearchService.search(searchFilter); DumpEnrichmentTagsView representation = dumpEnrichmentTagsListSuccessRepresentationBuilder .build(searchResult, pagination, linkTo(DumpEnrichmentTagController.class).toUriComponentsBuilder()); HttpHeaders httpHeaders = new HttpHeaders(); return new ResponseEntity<>(representation, httpHeaders, HttpStatus.OK); }
DumpEnrichmentTagController extends ControllersEntityExceptionHandler { @RequestMapping(value = "") @RestrictParamsNames @ResponseBody public ResponseEntity<Object> showEnrichmentTags( @RequestHeader(value = "Accept", required = false) String acceptHeader, @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize, @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber, HttpServletRequest request ) throws WrongRequestParameterException { checkRequestMethod(request, HttpMethod.GET); checkAcceptHeader(acceptHeader, MediaType.APPLICATION_JSON); Pagination pagination = parametersExtractor.extractAndValidatePagination(pageSize, pageNumber); EnrichmentTagSearchFilter searchFilter = EnrichmentTagSearchFilter.builder() .limit(pagination.getPageSize()) .offset(pagination.getOffset()) .filter(); SearchResult<EnrichmentTag> searchResult = databaseSearchService.search(searchFilter); DumpEnrichmentTagsView representation = dumpEnrichmentTagsListSuccessRepresentationBuilder .build(searchResult, pagination, linkTo(DumpEnrichmentTagController.class).toUriComponentsBuilder()); HttpHeaders httpHeaders = new HttpHeaders(); return new ResponseEntity<>(representation, httpHeaders, HttpStatus.OK); } }
DumpEnrichmentTagController extends ControllersEntityExceptionHandler { @RequestMapping(value = "") @RestrictParamsNames @ResponseBody public ResponseEntity<Object> showEnrichmentTags( @RequestHeader(value = "Accept", required = false) String acceptHeader, @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize, @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber, HttpServletRequest request ) throws WrongRequestParameterException { checkRequestMethod(request, HttpMethod.GET); checkAcceptHeader(acceptHeader, MediaType.APPLICATION_JSON); Pagination pagination = parametersExtractor.extractAndValidatePagination(pageSize, pageNumber); EnrichmentTagSearchFilter searchFilter = EnrichmentTagSearchFilter.builder() .limit(pagination.getPageSize()) .offset(pagination.getOffset()) .filter(); SearchResult<EnrichmentTag> searchResult = databaseSearchService.search(searchFilter); DumpEnrichmentTagsView representation = dumpEnrichmentTagsListSuccessRepresentationBuilder .build(searchResult, pagination, linkTo(DumpEnrichmentTagController.class).toUriComponentsBuilder()); HttpHeaders httpHeaders = new HttpHeaders(); return new ResponseEntity<>(representation, httpHeaders, HttpStatus.OK); }  }
DumpEnrichmentTagController extends ControllersEntityExceptionHandler { @RequestMapping(value = "") @RestrictParamsNames @ResponseBody public ResponseEntity<Object> showEnrichmentTags( @RequestHeader(value = "Accept", required = false) String acceptHeader, @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize, @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber, HttpServletRequest request ) throws WrongRequestParameterException { checkRequestMethod(request, HttpMethod.GET); checkAcceptHeader(acceptHeader, MediaType.APPLICATION_JSON); Pagination pagination = parametersExtractor.extractAndValidatePagination(pageSize, pageNumber); EnrichmentTagSearchFilter searchFilter = EnrichmentTagSearchFilter.builder() .limit(pagination.getPageSize()) .offset(pagination.getOffset()) .filter(); SearchResult<EnrichmentTag> searchResult = databaseSearchService.search(searchFilter); DumpEnrichmentTagsView representation = dumpEnrichmentTagsListSuccessRepresentationBuilder .build(searchResult, pagination, linkTo(DumpEnrichmentTagController.class).toUriComponentsBuilder()); HttpHeaders httpHeaders = new HttpHeaders(); return new ResponseEntity<>(representation, httpHeaders, HttpStatus.OK); }  @RequestMapping(value = "") @RestrictParamsNames @ResponseBody ResponseEntity<Object> showEnrichmentTags(
            @RequestHeader(value = "Accept", required = false) String acceptHeader,
            @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize,
            @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber,
            HttpServletRequest request
    ); @Autowired void setParametersExtractor(ParametersExtractor parametersExtractor); @Autowired void setDatabaseSearchService(DatabaseSearchService databaseSearchService); @Autowired void setDumpEnrichmentTagsListSuccessRepresentationBuilder(
            DumpEnrichmentTagsListSuccessRepresentationBuilder dumpEnrichmentTagsListSuccessRepresentationBuilder); }
DumpEnrichmentTagController extends ControllersEntityExceptionHandler { @RequestMapping(value = "") @RestrictParamsNames @ResponseBody public ResponseEntity<Object> showEnrichmentTags( @RequestHeader(value = "Accept", required = false) String acceptHeader, @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize, @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber, HttpServletRequest request ) throws WrongRequestParameterException { checkRequestMethod(request, HttpMethod.GET); checkAcceptHeader(acceptHeader, MediaType.APPLICATION_JSON); Pagination pagination = parametersExtractor.extractAndValidatePagination(pageSize, pageNumber); EnrichmentTagSearchFilter searchFilter = EnrichmentTagSearchFilter.builder() .limit(pagination.getPageSize()) .offset(pagination.getOffset()) .filter(); SearchResult<EnrichmentTag> searchResult = databaseSearchService.search(searchFilter); DumpEnrichmentTagsView representation = dumpEnrichmentTagsListSuccessRepresentationBuilder .build(searchResult, pagination, linkTo(DumpEnrichmentTagController.class).toUriComponentsBuilder()); HttpHeaders httpHeaders = new HttpHeaders(); return new ResponseEntity<>(representation, httpHeaders, HttpStatus.OK); }  @RequestMapping(value = "") @RestrictParamsNames @ResponseBody ResponseEntity<Object> showEnrichmentTags(
            @RequestHeader(value = "Accept", required = false) String acceptHeader,
            @RequestParam(value = PAGE_SIZE, required = false, defaultValue = Pagination.DEFAULT_PAGE_SIZE) int pageSize,
            @RequestParam(value = PAGE_NUMBER, required = false, defaultValue = "0") int pageNumber,
            HttpServletRequest request
    ); @Autowired void setParametersExtractor(ParametersExtractor parametersExtractor); @Autowired void setDatabaseSearchService(DatabaseSearchService databaseSearchService); @Autowired void setDumpEnrichmentTagsListSuccessRepresentationBuilder(
            DumpEnrichmentTagsListSuccessRepresentationBuilder dumpEnrichmentTagsListSuccessRepresentationBuilder);  }