use of com.salesmanager.shop.model.entity.ReadableEntityList in project shopizer by shopizer-ecommerce.
the class ProductInventoryFacadeImpl method getInventory.
@Override
public ReadableEntityList<ReadableInventory> getInventory(Long productId, MerchantStore store, String child, Language language, int page, int count) {
Product product = getProductById(productId);
validateProductHasSameStore(store, product);
Page<ProductAvailability> availabilities = productAvailabilityService.listByProduct(product, store, child, page, count);
List<ReadableInventory> inventories = availabilities.stream().map(pa -> readableInventoryMapper.convert(pa, store, language)).collect(Collectors.toList());
return createReadableList(availabilities, inventories);
}
use of com.salesmanager.shop.model.entity.ReadableEntityList in project shopizer by shopizer-ecommerce.
the class ContentFacadeImpl method getContentBoxes.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public ReadableEntityList<ReadableContentBox> getContentBoxes(ContentType type, MerchantStore store, Language language, int page, int count) {
Validate.notNull(store, "MerchantStore cannot be null");
ReadableEntityList items = new ReadableEntityList();
Page<Content> contentBoxes;
try {
contentBoxes = contentService.listByType(type, store, page, count);
items.setTotalPages(contentBoxes.getTotalPages());
items.setNumber(contentBoxes.getContent().size());
items.setRecordsTotal(contentBoxes.getNumberOfElements());
List<ReadableContentBox> boxes = contentBoxes.getContent().stream().map(content -> convertContentToReadableContentBox(store, language, content)).collect(Collectors.toList());
items.setItems(boxes);
return items;
} catch (ServiceException e) {
throw new ServiceRuntimeException("Exception while getting content ", e);
}
}
Aggregations