this.productOptions.add(optionWrapper);
}
}
if (model.getMedia() != null && !model.getMedia().isEmpty()) {
Media media = model.getMedia().get("primary");
if (media != null) {
StaticAssetPathService staticAssetPathService = (StaticAssetPathService) this.context.getBean("blStaticAssetPathService");
primaryMedia = (MediaWrapper) context.getBean(MediaWrapper.class.getName());
primaryMedia.wrapDetails(media, request);
if (primaryMedia.isAllowOverrideUrl()) {
primaryMedia.setUrl(staticAssetPathService.convertAssetPath(media.getUrl(), request.getContextPath(), request.isSecure()));
}
}
}
if (model.getDefaultCategory() != null) {
this.defaultCategoryId = model.getDefaultCategory().getId();
}
if (model.getUpSaleProducts() != null && !model.getUpSaleProducts().isEmpty()) {
upsaleProducts = new ArrayList<RelatedProductWrapper>();
for (RelatedProduct p : model.getUpSaleProducts()) {
RelatedProductWrapper upsaleProductWrapper =
(RelatedProductWrapper) context.getBean(RelatedProductWrapper.class.getName());
upsaleProductWrapper.wrapSummary(p, request);
upsaleProducts.add(upsaleProductWrapper);
}
}
if (model.getCrossSaleProducts() != null && !model.getCrossSaleProducts().isEmpty()) {
crossSaleProducts = new ArrayList<RelatedProductWrapper>();
for (RelatedProduct p : model.getCrossSaleProducts()) {
RelatedProductWrapper crossSaleProductWrapper =
(RelatedProductWrapper) context.getBean(RelatedProductWrapper.class.getName());
crossSaleProductWrapper.wrapSummary(p, request);
crossSaleProducts.add(crossSaleProductWrapper);
}
}
if (model.getProductAttributes() != null && !model.getProductAttributes().isEmpty()) {
productAttributes = new ArrayList<ProductAttributeWrapper>();
if (model.getProductAttributes() != null) {
for (Map.Entry<String, ProductAttribute> entry : model.getProductAttributes().entrySet()) {
ProductAttributeWrapper wrapper = (ProductAttributeWrapper) context.getBean(ProductAttributeWrapper.class.getName());
wrapper.wrapSummary(entry.getValue(), request);
productAttributes.add(wrapper);
}
}
}
if (model.getMedia() != null && !model.getMedia().isEmpty()) {
Map<String, Media> mediaMap = model.getMedia();
media = new ArrayList<MediaWrapper>();
StaticAssetPathService staticAssetPathService = (StaticAssetPathService) this.context.getBean("blStaticAssetPathService");
for (Media med : mediaMap.values()) {
MediaWrapper wrapper = (MediaWrapper) context.getBean(MediaWrapper.class.getName());
wrapper.wrapSummary(med, request);
if (wrapper.isAllowOverrideUrl()) {
wrapper.setUrl(staticAssetPathService.convertAssetPath(med.getUrl(), request.getContextPath(), request.isSecure()));
}
media.add(wrapper);
}
}
}