use of de.metas.ui.web.board.json.JSONBoard.JSONBoardBuilder in project metasfresh-webui-api by metasfresh.
the class BoardRestController method getBoard.
@GetMapping("/{boardId}")
public JSONBoard getBoard(@PathVariable("boardId") final int boardId) {
userSession.assertLoggedIn();
final String adLanguage = userSession.getAD_Language();
final BoardDescriptor boardDescriptor = boardsRepo.getBoardDescriptor(boardId);
final Multimap<Integer, JSONBoardCard> cardsByLaneId = boardsRepo.getCards(boardId).stream().map(card -> JSONBoardCard.of(card, adLanguage)).collect(GuavaCollectors.toImmutableListMultimap(JSONBoardCard::getLaneId));
final JSONBoardBuilder jsonBoard = JSONBoard.builder().boardId(boardId).caption(boardDescriptor.getCaption().translate(adLanguage)).websocketEndpoint(boardDescriptor.getWebsocketEndpoint());
boardDescriptor.getLanes().values().stream().map(lane -> JSONBoardLane.builder().laneId(lane.getLaneId()).caption(lane.getCaption().translate(adLanguage)).cards(cardsByLaneId.get(lane.getLaneId())).build()).forEach(jsonBoard::lane);
return jsonBoard.build();
}
Aggregations