use of de.metas.purchasecandidate.availability.AvailabilityMultiResult in project metasfresh-webui-api by metasfresh.
the class PurchaseRowsLoader method handleResultForAsyncAvailabilityCheck_Success.
private void handleResultForAsyncAvailabilityCheck_Success(final PurchaseRowsList rows, final AvailabilityMultiResult availabilityResults) {
final List<DocumentId> changedRowIds = new ArrayList<>();
for (final TrackingId trackingId : availabilityResults.getTrackingIds()) {
final PurchaseRow lineRow = rows.getPurchaseRowByTrackingId(trackingId);
if (lineRow == null) {
logger.warn("No row found for {}. Skip updating the row with availability results.", trackingId);
continue;
}
final ImmutableList<PurchaseRow> availabilityResultRows = availabilityResults.getByTrackingId(trackingId).stream().map(availabilityResult -> purchaseRowFactory.availabilityDetailSuccessBuilder().lineRow(lineRow).availabilityResult(availabilityResult).build()).collect(ImmutableList.toImmutableList());
lineRow.setAvailabilityInfoRows(availabilityResultRows);
changedRowIds.add(rows.getTopLevelDocumentIdByTrackingId(trackingId, lineRow.getId()));
}
notifyViewOfChanges(changedRowIds);
}
use of de.metas.purchasecandidate.availability.AvailabilityMultiResult in project metasfresh-webui-api by metasfresh.
the class PurchaseRowsLoader method createAndAddAvailabilityResultRows.
@VisibleForTesting
void createAndAddAvailabilityResultRows(final PurchaseRowsList rows) {
try {
final AvailabilityMultiResult availabilityCheckResult = availabilityCheckService.checkAvailability(createAvailabilityRequest(rows));
handleResultForAsyncAvailabilityCheck_Success(rows, availabilityCheckResult);
} catch (final Throwable throwable) {
handleResultForAsyncAvailabilityCheck_Error(rows, throwable);
}
}
Aggregations