Search in sources :

Example 1 with SalesOrderLines

use of de.metas.purchasecandidate.SalesOrderLines in project metasfresh-webui-api by metasfresh.

the class SalesOrder2PurchaseViewFactory method createView.

@Override
public PurchaseView createView(final CreateViewRequest request) {
    final Set<Integer> salesOrderLineIds = request.getFilterOnlyIds();
    Check.assumeNotEmpty(salesOrderLineIds, "salesOrderLineIds is not empty");
    final ViewId viewId = ViewId.random(WINDOW_ID);
    final SalesOrderLines saleOrderLines = SalesOrderLines.builder().salesOrderLineIds(salesOrderLineIds).purchaseCandidateRepository(purchaseCandidatesRepo).build();
    final PurchaseRowsLoader rowsLoader = PurchaseRowsLoader.builder().salesOrderLines(saleOrderLines).viewSupplier(// needed for async stuff
    () -> this.getByIdOrNull(viewId)).purchaseRowFactory(purchaseRowFactory).build();
    final PurchaseRowsSupplier rowsSupplier = () -> {
        final List<PurchaseRow> loadResult = rowsLoader.load();
        if (makeAsynchronousAvailiabilityCheck()) {
            rowsLoader.createAndAddAvailabilityResultRowsAsync();
        } else {
            rowsLoader.createAndAddAvailabilityResultRows();
        }
        return loadResult;
    };
    final PurchaseView view = PurchaseView.builder().viewId(viewId).rowsSupplier(rowsSupplier).additionalRelatedProcessDescriptor(createProcessDescriptor(WEBUI_SalesOrder_Apply_Availability_Row.class)).build();
    return view;
}
Also used : SalesOrderLines(de.metas.purchasecandidate.SalesOrderLines) ViewId(de.metas.ui.web.view.ViewId) List(java.util.List)

Aggregations

SalesOrderLines (de.metas.purchasecandidate.SalesOrderLines)1 ViewId (de.metas.ui.web.view.ViewId)1 List (java.util.List)1