use of com.salesmanager.shop.model.catalog.product.attribute.api.ReadableProductOptionFull in project shopizer by shopizer-ecommerce.
the class ReadableProductOptionMapper method merge.
@Override
public ReadableProductOptionEntity merge(ProductOption source, ReadableProductOptionEntity destination, MerchantStore store, Language language) {
ReadableProductOptionEntity readableProductOption = new ReadableProductOptionEntity();
if (language == null) {
readableProductOption = new ReadableProductOptionFull();
List<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionDescription> descriptions = new ArrayList<com.salesmanager.shop.model.catalog.product.attribute.ProductOptionDescription>();
for (ProductOptionDescription desc : source.getDescriptions()) {
com.salesmanager.shop.model.catalog.product.attribute.ProductOptionDescription d = this.description(desc);
descriptions.add(d);
}
((ReadableProductOptionFull) readableProductOption).setDescriptions(descriptions);
} else {
readableProductOption = new ReadableProductOptionEntity();
if (!CollectionUtils.isEmpty(source.getDescriptions())) {
for (ProductOptionDescription desc : source.getDescriptions()) {
if (desc != null && desc.getLanguage() != null && desc.getLanguage().getId() == language.getId()) {
com.salesmanager.shop.model.catalog.product.attribute.ProductOptionDescription d = this.description(desc);
readableProductOption.setDescription(d);
}
}
}
}
readableProductOption.setCode(source.getCode());
readableProductOption.setId(source.getId());
readableProductOption.setType(source.getProductOptionType());
return readableProductOption;
}
Aggregations