use of de.metas.purchasecandidate.availability.AvailabilityException in project metasfresh-webui-api by metasfresh.
the class PurchaseRowsLoader method handleThrowableForAsyncAvailabilityCheck.
private void handleThrowableForAsyncAvailabilityCheck(@Nullable final Throwable throwable) {
if (throwable == null) {
return;
}
if (throwable instanceof AvailabilityException) {
final AvailabilityException availabilityException = (AvailabilityException) throwable;
final List<DocumentId> changedRowIds = new ArrayList<>();
final Set<Entry<PurchaseCandidate, Throwable>> entrySet = availabilityException.getPurchaseCandidate2Throwable().entrySet();
for (final Entry<PurchaseCandidate, Throwable> purchaseCandidate2throwable : entrySet) {
final PurchaseRow purchaseRowToAugment = purchaseCandidate2purchaseRow.get(purchaseCandidate2throwable.getKey());
final PurchaseRow availabilityResultRow = purchaseRowFactory.rowFromThrowableBuilder().parentRow(purchaseRowToAugment).throwable(purchaseCandidate2throwable.getValue()).build();
purchaseRowToAugment.setAvailabilityInfoRows(ImmutableList.of(availabilityResultRow));
changedRowIds.add(purchaseRowToAugment.getId());
}
notifyViewOfChanges(changedRowIds);
} else {
// TODO: display an error-message in the webui
}
}
Aggregations