Search in sources :

Example 1 with StockCardSummaries

use of org.openlmis.stockmanagement.service.StockCardSummaries 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;
}
Also used : Profiler(org.slf4j.profiler.Profiler) StockCardSummariesV2SearchParams(org.openlmis.stockmanagement.service.StockCardSummariesV2SearchParams) StockCardSummaries(org.openlmis.stockmanagement.service.StockCardSummaries) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

StockCardSummaries (org.openlmis.stockmanagement.service.StockCardSummaries)1 StockCardSummariesV2SearchParams (org.openlmis.stockmanagement.service.StockCardSummariesV2SearchParams)1 Profiler (org.slf4j.profiler.Profiler)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1