@Test public void test_search() throws IOException, Exception { Pagination<InstrumentAccountCode> page = new Pagination<>(); page.setTotalPages(1); page.setTotalResults(1); page.setCurrentPage(0); page.setPagedData(getInstrumentAccountCodes()); page.getPagedData().get(0).setId("1"); when(instrumentAccountCodeService.search(any(InstrumentAccountCodeSearch.class))).thenReturn(page); mockMvc.perform(post("/instrumentaccountcodes/_search").content(resources.getRequestInfo()) .contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(status().is(200)) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).andExpect(content().json(resources .readResponse("instrumentaccountcode/instrumentaccountcode_search_valid_response.json"))); }
@PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public InstrumentAccountCodeResponse search( @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract, RequestInfo requestInfo, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract); InstrumentAccountCodeContract contract; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); Pagination<InstrumentAccountCode> instrumentaccountcodes = instrumentAccountCodeService.search(domain); if (instrumentaccountcodes.getPagedData() != null) for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) { contract = mapper.toContract(instrumentAccountCode); instrumentAccountCodeContracts.add(contract); } InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse(); response.setInstrumentAccountCodes(instrumentAccountCodeContracts); response.setPage(new PaginationContract(instrumentaccountcodes)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }
InstrumentAccountCodeController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public InstrumentAccountCodeResponse search( @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract, RequestInfo requestInfo, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract); InstrumentAccountCodeContract contract; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); Pagination<InstrumentAccountCode> instrumentaccountcodes = instrumentAccountCodeService.search(domain); if (instrumentaccountcodes.getPagedData() != null) for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) { contract = mapper.toContract(instrumentAccountCode); instrumentAccountCodeContracts.add(contract); } InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse(); response.setInstrumentAccountCodes(instrumentAccountCodeContracts); response.setPage(new PaginationContract(instrumentaccountcodes)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; } }
InstrumentAccountCodeController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public InstrumentAccountCodeResponse search( @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract, RequestInfo requestInfo, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract); InstrumentAccountCodeContract contract; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); Pagination<InstrumentAccountCode> instrumentaccountcodes = instrumentAccountCodeService.search(domain); if (instrumentaccountcodes.getPagedData() != null) for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) { contract = mapper.toContract(instrumentAccountCode); instrumentAccountCodeContracts.add(contract); } InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse(); response.setInstrumentAccountCodes(instrumentAccountCodeContracts); response.setPage(new PaginationContract(instrumentaccountcodes)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  }
InstrumentAccountCodeController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public InstrumentAccountCodeResponse search( @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract, RequestInfo requestInfo, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract); InstrumentAccountCodeContract contract; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); Pagination<InstrumentAccountCode> instrumentaccountcodes = instrumentAccountCodeService.search(domain); if (instrumentaccountcodes.getPagedData() != null) for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) { contract = mapper.toContract(instrumentAccountCode); instrumentAccountCodeContracts.add(contract); } InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse(); response.setInstrumentAccountCodes(instrumentAccountCodeContracts); response.setPage(new PaginationContract(instrumentaccountcodes)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse update(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse delete(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) InstrumentAccountCodeResponse search(
            @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract,
            RequestInfo requestInfo, BindingResult errors); }
InstrumentAccountCodeController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public InstrumentAccountCodeResponse search( @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract, RequestInfo requestInfo, BindingResult errors) { InstrumentAccountCodeMapper mapper = new InstrumentAccountCodeMapper(); InstrumentAccountCodeSearch domain = mapper.toSearchDomain(instrumentAccountCodeSearchContract); InstrumentAccountCodeContract contract; List<InstrumentAccountCodeContract> instrumentAccountCodeContracts = new ArrayList<>(); Pagination<InstrumentAccountCode> instrumentaccountcodes = instrumentAccountCodeService.search(domain); if (instrumentaccountcodes.getPagedData() != null) for (InstrumentAccountCode instrumentAccountCode : instrumentaccountcodes.getPagedData()) { contract = mapper.toContract(instrumentAccountCode); instrumentAccountCodeContracts.add(contract); } InstrumentAccountCodeResponse response = new InstrumentAccountCodeResponse(); response.setInstrumentAccountCodes(instrumentAccountCodeContracts); response.setPage(new PaginationContract(instrumentaccountcodes)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse create(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse update(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_delete") @ResponseStatus(HttpStatus.CREATED) InstrumentAccountCodeResponse delete(@RequestBody InstrumentAccountCodeRequest instrumentAccountCodeRequest,
            BindingResult errors); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) InstrumentAccountCodeResponse search(
            @ModelAttribute InstrumentAccountCodeSearchContract instrumentAccountCodeSearchContract,
            RequestInfo requestInfo, BindingResult errors); static final String ACTION_CREATE; static final String ACTION_UPDATE; static final String ACTION_DELETE; static final String PLACEHOLDER; }