use of org.openlmis.stockmanagement.service.StockCardSummariesV2SearchParams in project openlmis-stockmanagement by OpenLMIS.
the class StockCardSummariesV2Controller method getStockCardSummaries.
/**
* Get stock card summaries by program and facility.
*
* @return Stock card summaries.
*/
@GetMapping
public Page<StockCardSummaryV2Dto> getStockCardSummaries(@RequestParam MultiValueMap<String, String> parameters, @PageableDefault(size = Integer.MAX_VALUE) Pageable pageable) {
Profiler profiler = new Profiler("GET_STOCK_CARDS_V2");
profiler.setLogger(LOGGER);
profiler.start("VALIDATE_PARAMS");
StockCardSummariesV2SearchParams params = new StockCardSummariesV2SearchParams(parameters);
profiler.start("GET_STOCK_CARD_SUMMARIES");
StockCardSummaries summaries = stockCardSummariesService.findStockCards(params);
profiler.start("TO_DTO");
List<StockCardSummaryV2Dto> dtos = stockCardSummariesV2DtoBuilder.build(summaries.getPageOfApprovedProducts(), summaries.getStockCardsForFulfillOrderables(), summaries.getOrderableFulfillMap(), summaries.getAsOfDate());
profiler.start("GET_PAGE");
Page<StockCardSummaryV2Dto> page = Pagination.getPage(dtos, pageable);
profiler.stop().log();
return page;
}
Aggregations