@Test public void testSearch() throws IOException, Exception { when(chartOfAccountDetailService.search(any(ChartOfAccountDetailSearch.class), any(BindingResult.class))) .thenReturn((getPagination())); mockMvc.perform( post("/chartofaccountdetails/_search?tenantId=default").content(resources.getRequestInfo()).contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(status().is(200)).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(resources.readResponse("chartofaccountdetail/chartofaccountdetail_search_valid_response.json"))); }
@PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public ChartOfAccountDetailResponse search( @ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract, @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { ModelMapper mapper = new ModelMapper(); ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch(); mapper.map(chartOfAccountDetailSearchContract, domain); ChartOfAccountDetailContract contract; ModelMapper model = new ModelMapper(); List<ChartOfAccountDetailContract> chartOfAccountDetailContracts = new ArrayList<>(); Pagination<ChartOfAccountDetail> chartofaccountdetails = chartOfAccountDetailService.search(domain, errors); for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) { contract = new ChartOfAccountDetailContract(); model.map(chartOfAccountDetail, contract); chartOfAccountDetailContracts.add(contract); } ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse(); response.setChartOfAccountDetails(chartOfAccountDetailContracts); response.setPage(new PaginationContract(chartofaccountdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }
ChartOfAccountDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public ChartOfAccountDetailResponse search( @ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract, @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { ModelMapper mapper = new ModelMapper(); ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch(); mapper.map(chartOfAccountDetailSearchContract, domain); ChartOfAccountDetailContract contract; ModelMapper model = new ModelMapper(); List<ChartOfAccountDetailContract> chartOfAccountDetailContracts = new ArrayList<>(); Pagination<ChartOfAccountDetail> chartofaccountdetails = chartOfAccountDetailService.search(domain, errors); for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) { contract = new ChartOfAccountDetailContract(); model.map(chartOfAccountDetail, contract); chartOfAccountDetailContracts.add(contract); } ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse(); response.setChartOfAccountDetails(chartOfAccountDetailContracts); response.setPage(new PaginationContract(chartofaccountdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; } }
ChartOfAccountDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public ChartOfAccountDetailResponse search( @ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract, @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { ModelMapper mapper = new ModelMapper(); ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch(); mapper.map(chartOfAccountDetailSearchContract, domain); ChartOfAccountDetailContract contract; ModelMapper model = new ModelMapper(); List<ChartOfAccountDetailContract> chartOfAccountDetailContracts = new ArrayList<>(); Pagination<ChartOfAccountDetail> chartofaccountdetails = chartOfAccountDetailService.search(domain, errors); for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) { contract = new ChartOfAccountDetailContract(); model.map(chartOfAccountDetail, contract); chartOfAccountDetailContracts.add(contract); } ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse(); response.setChartOfAccountDetails(chartOfAccountDetailContracts); response.setPage(new PaginationContract(chartofaccountdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  }
ChartOfAccountDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public ChartOfAccountDetailResponse search( @ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract, @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { ModelMapper mapper = new ModelMapper(); ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch(); mapper.map(chartOfAccountDetailSearchContract, domain); ChartOfAccountDetailContract contract; ModelMapper model = new ModelMapper(); List<ChartOfAccountDetailContract> chartOfAccountDetailContracts = new ArrayList<>(); Pagination<ChartOfAccountDetail> chartofaccountdetails = chartOfAccountDetailService.search(domain, errors); for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) { contract = new ChartOfAccountDetailContract(); model.map(chartOfAccountDetail, contract); chartOfAccountDetailContracts.add(contract); } ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse(); response.setChartOfAccountDetails(chartOfAccountDetailContracts); response.setPage(new PaginationContract(chartofaccountdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) ChartOfAccountDetailResponse create(@RequestBody ChartOfAccountDetailRequest chartOfAccountDetailRequest,
			BindingResult errors,@RequestParam String tenantId); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) ChartOfAccountDetailResponse update(@RequestBody ChartOfAccountDetailRequest chartOfAccountDetailRequest,
			BindingResult errors,@RequestParam String tenantId); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) ChartOfAccountDetailResponse search(
			@ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract,
			@RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId); }
ChartOfAccountDetailController { @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) public ChartOfAccountDetailResponse search( @ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract, @RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId) { ModelMapper mapper = new ModelMapper(); ChartOfAccountDetailSearch domain = new ChartOfAccountDetailSearch(); mapper.map(chartOfAccountDetailSearchContract, domain); ChartOfAccountDetailContract contract; ModelMapper model = new ModelMapper(); List<ChartOfAccountDetailContract> chartOfAccountDetailContracts = new ArrayList<>(); Pagination<ChartOfAccountDetail> chartofaccountdetails = chartOfAccountDetailService.search(domain, errors); for (ChartOfAccountDetail chartOfAccountDetail : chartofaccountdetails.getPagedData()) { contract = new ChartOfAccountDetailContract(); model.map(chartOfAccountDetail, contract); chartOfAccountDetailContracts.add(contract); } ChartOfAccountDetailResponse response = new ChartOfAccountDetailResponse(); response.setChartOfAccountDetails(chartOfAccountDetailContracts); response.setPage(new PaginationContract(chartofaccountdetails)); response.setResponseInfo(getResponseInfo(requestInfo)); return response; }  @PostMapping("/_create") @ResponseStatus(HttpStatus.CREATED) ChartOfAccountDetailResponse create(@RequestBody ChartOfAccountDetailRequest chartOfAccountDetailRequest,
			BindingResult errors,@RequestParam String tenantId); @PostMapping("/_update") @ResponseStatus(HttpStatus.CREATED) ChartOfAccountDetailResponse update(@RequestBody ChartOfAccountDetailRequest chartOfAccountDetailRequest,
			BindingResult errors,@RequestParam String tenantId); @PostMapping("/_search") @ResponseBody @ResponseStatus(HttpStatus.OK) ChartOfAccountDetailResponse search(
			@ModelAttribute ChartOfAccountDetailSearchContract chartOfAccountDetailSearchContract,
			@RequestBody RequestInfo requestInfo, BindingResult errors,@RequestParam String tenantId);  }