use of de.metas.ui.web.view.CreateViewRequest in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewFactory method createView.
/**
* This method is called once for each shipment schedule (left-hand side) and creates the respective picking view (right-hand side)
*
* @param request
* @param allShipmentScheduleIds the shipment schedule IDs to display picking slots for; <br>
* may be {@code null} or empty, in this case we assume that only the given {@code request}'s {@code shipmentScheduleId} is available.
* @return
*/
public PickingSlotView createView(@NonNull final CreateViewRequest request, @Nullable final List<Integer> allShipmentScheduleIds) {
final CreateViewRequest requestEffective = request.unwrapFiltersAndCopy(getFilterDescriptorsProvider());
final ViewId pickingViewId = requestEffective.getParentViewId();
final DocumentId pickingRowId = requestEffective.getParentRowId();
final ViewId pickingSlotViewId = PickingSlotViewsIndexStorage.createViewId(pickingViewId, pickingRowId);
final int shipmentScheduleId = extractCurrentShipmentScheduleId(requestEffective);
final PickingSlotRepoQuery query = createPickingSlotRowsQuery(requestEffective, allShipmentScheduleIds);
final Supplier<List<PickingSlotRow>> rowsSupplier = () -> pickingSlotRepo.retrieveRows(query);
return PickingSlotView.builder().viewId(pickingSlotViewId).parentViewId(pickingViewId).parentRowId(pickingRowId).currentShipmentScheduleId(shipmentScheduleId).rowsSupplier(rowsSupplier).additionalRelatedProcessDescriptors(createAdditionalRelatedProcessDescriptors()).filters(requestEffective.getFilters().getFilters()).build();
}
use of de.metas.ui.web.view.CreateViewRequest in project metasfresh-webui-api by metasfresh.
the class PickingSlotViewsIndexStorage method getOrCreatePickingSlotView.
private PickingSlotView getOrCreatePickingSlotView(@NonNull final ViewId pickingSlotViewId, final boolean create) {
final PackageableView packageableView = getPackageableViewByPickingSlotViewId(pickingSlotViewId);
final DocumentId packageableRowId = extractRowId(pickingSlotViewId);
if (create) {
return packageableView.computePickingSlotViewIfAbsent(packageableRowId, () -> {
final PackageableRow packageableRow = packageableView.getById(packageableRowId);
final CreateViewRequest createViewRequest = CreateViewRequest.builder(PickingConstants.WINDOWID_PickingSlotView, JSONViewDataType.includedView).setParentViewId(packageableView.getViewId()).setParentRowId(packageableRow.getId()).build();
// provide all pickingView's M_ShipmentSchedule_IDs to the factory, because we want to show the same picking slots and picked HU-rows for all of them.
final List<Integer> allShipmentScheduleIds = packageableView.streamByIds(DocumentIdsSelection.ALL).map(PackageableRow::cast).map(PackageableRow::getShipmentScheduleId).collect(Collectors.toList());
return pickingSlotViewFactory.createView(createViewRequest, allShipmentScheduleIds);
});
} else {
return packageableView.getPickingSlotViewOrNull(packageableRowId);
}
}
use of de.metas.ui.web.view.CreateViewRequest in project metasfresh-webui-api by metasfresh.
the class BoardRestController method createNewCardsView.
@PostMapping("/{boardId}/newCardsView")
public JSONViewResult createNewCardsView(@PathVariable("boardId") final int boardId) {
userSession.assertLoggedIn();
final BoardDescriptor boardDescriptor = boardsRepo.getBoardDescriptor(boardId);
final CreateViewRequest request = CreateViewRequest.builder(boardDescriptor.getDocumentWindowId(), JSONViewDataType.list).setStickyFilters(boardDescriptor.getDocumentFilters()).build();
final IView view = viewsRepo.createView(request);
addActiveNewCardsView(boardId, view);
return toJSONCardsViewResult(boardId, view, userSession.getAD_Language());
}
Aggregations