use of com.salesmanager.shop.model.catalog.product.attribute.optionset.ReadableProductOptionSet in project shopizer by shopizer-ecommerce.
the class ProductOptionSetFacadeImpl method list.
@Override
public List<ReadableProductOptionSet> list(MerchantStore store, Language language) {
Validate.notNull(store, "MerchantStore cannot be null");
Validate.notNull(language, "Language cannot be null");
try {
List<ProductOptionSet> optionSets = productOptionSetService.listByStore(store, language);
return optionSets.stream().map(opt -> this.convert(opt, store, language)).collect(Collectors.toList());
} catch (ServiceException e) {
throw new ServiceRuntimeException("Exception while listing ProductOptionSet", e);
}
}
use of com.salesmanager.shop.model.catalog.product.attribute.optionset.ReadableProductOptionSet in project shopizer by shopizer-ecommerce.
the class ProductOptionSetFacadeImpl method get.
@Override
public ReadableProductOptionSet get(Long id, MerchantStore store, Language language) {
Validate.notNull(store, "MerchantStore cannot be null");
Validate.notNull(language, "Language cannot be null");
ProductOptionSet optionSet = productOptionSetService.getById(store, id, language);
if (optionSet == null) {
throw new ResourceNotFoundException("ProductOptionSet not found for id [" + id + "] and store [" + store.getCode() + "]");
}
return readableProductOptionSetMapper.convert(optionSet, store, language);
}
use of com.salesmanager.shop.model.catalog.product.attribute.optionset.ReadableProductOptionSet in project shopizer by shopizer-ecommerce.
the class ProductOptionSetFacadeImpl method list.
@Override
public List<ReadableProductOptionSet> list(MerchantStore store, Language language, String type) {
Validate.notNull(store, "MerchantStore cannot be null");
Validate.notNull(language, "Language cannot be null");
Validate.notNull(type, "Product type cannot be null");
// find product type by id
ReadableProductType readable = productTypeFacade.get(store, type, language);
if (readable == null) {
throw new ResourceNotFoundException("Can't fing product type [" + type + "] fpr merchand [" + store.getCode() + "]");
}
List<ProductOptionSet> optionSets = productOptionSetService.getByProductType(readable.getId(), store, language);
return optionSets.stream().map(opt -> this.convert(opt, store, language)).collect(Collectors.toList());
}
Aggregations