/**
*
*/
public CustomerProductCommentsViewBean buildViewBeanCustomerProductComments(final RequestData requestData, final Customer customer) throws Exception {
final MarketArea marketArea = requestData.getMarketArea();
final CustomerProductCommentsViewBean customerProductCommentsViewBean = new CustomerProductCommentsViewBean();
final CustomerMarketArea customerMarketArea = customer.getCurrentCustomerMarketArea(marketArea.getId());
if (customerMarketArea != null) {
final Set<CustomerProductComment> customerProductComments = customerMarketArea.getProductComments();
if (Hibernate.isInitialized(customerProductComments) && customerProductComments != null) {
for (Iterator<CustomerProductComment> iterator = customerProductComments.iterator(); iterator.hasNext();) {
final CustomerProductComment customerProductComment = (CustomerProductComment) iterator.next();
final ProductSku reloadedProductSku = productService.getProductSkuByCode(customerProductComment.getProductSkuCode());
final ProductMarketing productMarketing = reloadedProductSku.getProductMarketing();
final CatalogCategoryVirtual catalogCategory = catalogCategoryService.getDefaultVirtualCatalogCategoryByProductSkuId(reloadedProductSku.getId());
customerProductCommentsViewBean.getCustomerProductCommentViewBeans().add(
buildViewBeanCustomerProductComment(requestData, catalogCategory, productMarketing, reloadedProductSku, customerProductComment));
}
}
}
return customerProductCommentsViewBean;