Search in sources :

Example 1 with ViewResult

use of de.metas.ui.web.view.ViewResult in project metasfresh-webui-api by metasfresh.

the class BoardRestController method getNewCardsView.

@GetMapping("/{boardId}/newCardsView/{viewId}")
public JSONViewResult getNewCardsView(@PathVariable("boardId") final int boardId, @PathVariable("viewId") final String viewIdStr, @RequestParam("firstRow") final int firstRow, @RequestParam("pageLength") final int pageLength, @RequestParam(name = "orderBy", required = false) final String orderBysListStr) {
    userSession.assertLoggedIn();
    final ViewResult viewResult = viewsRepo.getView(viewIdStr).getPageWithRowIdsOnly(firstRow, pageLength, DocumentQueryOrderBy.parseOrderBysList(orderBysListStr));
    final List<Integer> boardCardIds = boardsRepo.retrieveCardIds(boardId);
    return toJSONCardsViewResult(boardId, viewResult, // language
    userSession.getAD_Language(), // filter out cards which already exist in our board
    cardId -> !boardCardIds.contains(cardId));
}
Also used : ViewResult(de.metas.ui.web.view.ViewResult) JSONViewResult(de.metas.ui.web.view.json.JSONViewResult) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with ViewResult

use of de.metas.ui.web.view.ViewResult in project metasfresh-webui-api by metasfresh.

the class BoardRestController method toJSONCardsViewResult.

private final JSONViewResult toJSONCardsViewResult(final int boardId, final IView view, final String adLanguage) {
    final ViewResult viewResult = ViewResult.ofView(view);
    final IViewRowOverrides rowOverrides = ViewRowOverridesHelper.getViewRowOverrides(view);
    return JSONViewResult.of(viewResult, rowOverrides, adLanguage);
}
Also used : IViewRowOverrides(de.metas.ui.web.view.IViewRowOverrides) ViewResult(de.metas.ui.web.view.ViewResult) JSONViewResult(de.metas.ui.web.view.json.JSONViewResult)

Aggregations

ViewResult (de.metas.ui.web.view.ViewResult)2 JSONViewResult (de.metas.ui.web.view.json.JSONViewResult)2 IViewRowOverrides (de.metas.ui.web.view.IViewRowOverrides)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1