public void postWritingDestinationValue(DozerEvent event) {
logger.debug("post writing destination value, SourceObject: " + event.getSourceObject());
if(event.getDestinationObject() instanceof FoCartItemPojo){
if(event.getFieldMap().getDestFieldName().equals("productSkuCode")){
// INJECT BACKOFFICE URLS
CartItem cartItem = (CartItem) event.getSourceObject();
FoCartItemPojo cartItemPojo = (FoCartItemPojo) event.getDestinationObject();
try {
final RequestData requestData = requestUtil.getRequestData(httpServletRequest);
final MarketArea marketArea = requestData.getMarketArea();
final Retailer retailer = requestData.getMarketAreaRetailer();
final Localization localization = requestData.getMarketAreaLocalization();
final String localizationCode = localization.getCode();
final Asset defaultPackshotImage = cartItem.getProductSku().getDefaultPackshotImage(ImageSize.SMALL.name());
if (defaultPackshotImage != null) {
String summaryImage = engineSettingService.getProductMarketingImageWebPath(defaultPackshotImage);
cartItemPojo.setSummaryImage(summaryImage);
} else {
cartItemPojo.setSummaryImage("");
}
cartItemPojo.setI18nName(cartItem.getProductSku().getI18nName(localizationCode));
cartItemPojo.setProductDetailsUrl(urlService.generateUrl(FoUrls.PRODUCT_DETAILS, requestData, cartItem.getCatalogCategory(), cartItem.getProductMarketing(), cartItem.getProductSku()));
cartItemPojo.setPriceWithStandardCurrencySign(cartItem.getPriceWithStandardCurrencySign(marketArea.getId(), retailer.getId()));
cartItemPojo.setTotalAmountWithStandardCurrencySign(cartItem.getTotalAmountWithStandardCurrencySign(marketArea.getId(), retailer.getId()));
} catch (Exception e) {
logger.error("postWritingDestinationValue error with FoCartItemPojo", e);
}
}