use of de.metas.ui.web.order.sales.purchasePlanning.view.PurchaseView in project metasfresh-webui-api by metasfresh.
the class WEBUI_SalesOrder_Apply_Availability_Row method extractLineRow2availabilityRows.
private Multimap<PurchaseRow, PurchaseRow> extractLineRow2availabilityRows() {
final PurchaseView view = getView();
final ListMultimap<PurchaseRow, PurchaseRow> lineRow2AvailabilityRows = getSelectedRowIds().stream().map(// map to PurchaseRowIds
PurchaseRowId::fromDocumentId).filter(PurchaseRowId::isAvailabilityRowId).filter(availabilityRowId -> availabilityRowId.getAvailabilityType().equals(Type.AVAILABLE)).map(availabilityRowId -> // map to pair (availabilityRowId, availabilityRow)
ImmutablePair.of(availabilityRowId, view.getById(availabilityRowId.toDocumentId()))).filter(availabilityRowId2row -> Util.coalesce(availabilityRowId2row.getRight().getQtyToPurchase(), BigDecimal.ZERO).signum() > 0).map(availabilityRowId2row -> // map to pair (lineRow, availabilityRow)
ImmutablePair.of(view.getById(availabilityRowId2row.getLeft().toLineRowId().toDocumentId()), availabilityRowId2row.getRight())).filter(lineRow2availabilityRow -> !lineRow2availabilityRow.getLeft().isProcessed()).collect(Multimaps.toMultimap(IPair::getLeft, IPair::getRight, MultimapBuilder.hashKeys().arrayListValues()::build));
return ImmutableMultimap.copyOf(lineRow2AvailabilityRows);
}
Aggregations