Search in sources :

Example 1 with JSONBoard

use of de.metas.ui.web.board.json.JSONBoard 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();
}
Also used : JSONNewCardsViewLayout(de.metas.ui.web.board.json.JSONNewCardsViewLayout) PathVariable(org.springframework.web.bind.annotation.PathVariable) RequestParam(org.springframework.web.bind.annotation.RequestParam) JSONDocumentFilterDescriptor(de.metas.ui.web.document.filter.json.JSONDocumentFilterDescriptor) Autowired(org.springframework.beans.factory.annotation.Autowired) ApiParam(io.swagger.annotations.ApiParam) ApiOperation(io.swagger.annotations.ApiOperation) IView(de.metas.ui.web.view.IView) Map(java.util.Map) ViewRowOverridesHelper(de.metas.ui.web.view.ViewRowOverridesHelper) IViewRowOverrides(de.metas.ui.web.view.IViewRowOverrides) ViewLayout(de.metas.ui.web.view.descriptor.ViewLayout) DeleteMapping(org.springframework.web.bind.annotation.DeleteMapping) JSONBoardCardOrderBy(de.metas.ui.web.board.json.JSONBoardCardOrderBy) ViewResult(de.metas.ui.web.view.ViewResult) PostMapping(org.springframework.web.bind.annotation.PostMapping) Predicate(java.util.function.Predicate) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) RestController(org.springframework.web.bind.annotation.RestController) JSONLookupValuesList(de.metas.ui.web.window.datatypes.json.JSONLookupValuesList) JSONBoardCardAddRequest(de.metas.ui.web.board.json.JSONBoardCardAddRequest) UserSession(de.metas.ui.web.session.UserSession) List(java.util.List) IViewsRepository(de.metas.ui.web.view.IViewsRepository) JSONOptions(de.metas.ui.web.window.datatypes.json.JSONOptions) BoardCardChangeRequestBuilder(de.metas.ui.web.board.BoardCardChangeRequest.BoardCardChangeRequestBuilder) WebConfig(de.metas.ui.web.config.WebConfig) GuavaCollectors(org.adempiere.util.GuavaCollectors) JSONDocumentChangedEvent(de.metas.ui.web.window.datatypes.json.JSONDocumentChangedEvent) DocumentId(de.metas.ui.web.window.datatypes.DocumentId) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) JSONViewDataType(de.metas.ui.web.view.json.JSONViewDataType) Multimap(com.google.common.collect.Multimap) PatchMapping(org.springframework.web.bind.annotation.PatchMapping) RequestBody(org.springframework.web.bind.annotation.RequestBody) JSONBoardCard(de.metas.ui.web.board.json.JSONBoardCard) ImmutableList(com.google.common.collect.ImmutableList) JSONBoardBuilder(de.metas.ui.web.board.json.JSONBoard.JSONBoardBuilder) GetMapping(org.springframework.web.bind.annotation.GetMapping) JSONFilterViewRequest(de.metas.ui.web.view.json.JSONFilterViewRequest) JSONBoard(de.metas.ui.web.board.json.JSONBoard) DocumentQueryOrderBy(de.metas.ui.web.window.model.DocumentQueryOrderBy) WeakHashMap(java.util.WeakHashMap) DocumentIdsSelection(de.metas.ui.web.window.datatypes.DocumentIdsSelection) ViewProfileId(de.metas.ui.web.view.ViewProfileId) AdempiereException(org.adempiere.exceptions.AdempiereException) FixedOrderByKeyComparator(org.adempiere.util.comparator.FixedOrderByKeyComparator) JSONViewResult(de.metas.ui.web.view.json.JSONViewResult) JSONBoardLane(de.metas.ui.web.board.json.JSONBoardLane) ViewChangesCollector(de.metas.ui.web.view.event.ViewChangesCollector) CreateViewRequest(de.metas.ui.web.view.CreateViewRequest) Collections(java.util.Collections) ViewId(de.metas.ui.web.view.ViewId) JSONBoardCard(de.metas.ui.web.board.json.JSONBoardCard) JSONBoardBuilder(de.metas.ui.web.board.json.JSONBoard.JSONBoardBuilder) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 Multimap (com.google.common.collect.Multimap)1 BoardCardChangeRequestBuilder (de.metas.ui.web.board.BoardCardChangeRequest.BoardCardChangeRequestBuilder)1 JSONBoard (de.metas.ui.web.board.json.JSONBoard)1 JSONBoardBuilder (de.metas.ui.web.board.json.JSONBoard.JSONBoardBuilder)1 JSONBoardCard (de.metas.ui.web.board.json.JSONBoardCard)1 JSONBoardCardAddRequest (de.metas.ui.web.board.json.JSONBoardCardAddRequest)1 JSONBoardCardOrderBy (de.metas.ui.web.board.json.JSONBoardCardOrderBy)1 JSONBoardLane (de.metas.ui.web.board.json.JSONBoardLane)1 JSONNewCardsViewLayout (de.metas.ui.web.board.json.JSONNewCardsViewLayout)1 WebConfig (de.metas.ui.web.config.WebConfig)1 JSONDocumentFilterDescriptor (de.metas.ui.web.document.filter.json.JSONDocumentFilterDescriptor)1 UserSession (de.metas.ui.web.session.UserSession)1 CreateViewRequest (de.metas.ui.web.view.CreateViewRequest)1 IView (de.metas.ui.web.view.IView)1 IViewRowOverrides (de.metas.ui.web.view.IViewRowOverrides)1 IViewsRepository (de.metas.ui.web.view.IViewsRepository)1 ViewId (de.metas.ui.web.view.ViewId)1 ViewProfileId (de.metas.ui.web.view.ViewProfileId)1 ViewResult (de.metas.ui.web.view.ViewResult)1