use of de.metas.ui.web.view.ViewHeaderProperties.ViewHeaderPropertiesBuilder in project metasfresh-webui-api by metasfresh.
the class ProductsProposalRowsLoader method load.
public ProductsProposalRowsData load() {
List<ProductsProposalRow> rows = loadRows();
logger.debug("loaded {} productsProposalRows for priceListVersionIds={}", rows.size(), priceListVersionIds);
rows = updateLastShipmentDays(rows);
final PriceListVersionId singlePriceListVersionId = priceListVersionIds.size() == 1 ? priceListVersionIds.iterator().next() : null;
final PriceListVersionId basePriceListVersionId;
if (singlePriceListVersionId != null) {
final ZonedDateTime datePromised = order == null ? SystemTime.asZonedDateTime() : order.getDatePromised();
basePriceListVersionId = priceListsRepo.getBasePriceListVersionIdForPricingCalculationOrNull(singlePriceListVersionId, datePromised);
logger.debug("singlePriceListVersionId={} and datePromised={}; -> basePriceListVersionId={}", PriceListVersionId.toRepoId(singlePriceListVersionId), datePromised, PriceListVersionId.toRepoId(basePriceListVersionId));
} else {
basePriceListVersionId = null;
}
//
final ViewHeaderPropertiesBuilder headerProperties = ViewHeaderProperties.builder();
if (order != null) {
logger.debug("order!=null; -> add bpartnerName={} to headerProperties", order.getBpartnerName());
headerProperties.entry(ViewHeaderProperty.builder().caption(msgBL.translatable("C_BPartner_ID")).value(order.getBpartnerName()).build());
}
return ProductsProposalRowsData.builder().nextRowIdSequence(nextRowIdSequence).campaignPriceProvider(campaignPriceProvider).singlePriceListVersionId(singlePriceListVersionId).basePriceListVersionId(basePriceListVersionId).order(order).bpartnerId(bpartnerId).soTrx(soTrx).headerProperties(headerProperties.build()).rows(rows).build();
}
Aggregations