public CartPojo handleCartMapping(final Cart cart, final String catalogVirtualCode, final String catalogMasterCode) {
if(cart != null){
Set<CartItem> cartItems = cart.getCartItems();
for (Iterator<CartItem> iterator = cartItems.iterator(); iterator.hasNext();) {
CartItem cartItem = (CartItem) iterator.next();
if(cartItem.getProductSku() == null){
final ProductSku productSku = productService.getProductSkuByCode(cartItem.getProductSkuCode());
cartItem.setProductSku(productSku);
}
if(cartItem.getProductMarketing() == null){
final ProductMarketing productMarketing = productService.getProductMarketingByCode(cartItem.getProductMarketingCode());
cartItem.setProductMarketing(productMarketing);
}
if(cartItem.getCatalogCategory() == null){
final CatalogCategoryVirtual catalogCategory = catalogCategoryService.getVirtualCatalogCategoryByCode(cartItem.getCatalogCategoryCode(), catalogVirtualCode, catalogMasterCode);
cartItem.setCatalogCategory(catalogCategory);
}
}
}
return cart == null ? null : dozerBeanMapper.map(cart, CartPojo.class);
}