return new Result<>(productDTOs, count);
}
@Override
public Result<ProductDTO> findByEshop(UriInfo uriInfo, Long eshopId, String order, Integer base, Integer offset) throws NotExistingEntityException {
Eshop eshop = eshopDAO.findById(Eshop.class, eshopId);
if (eshop == null) {
throw new NotExistingEntityException("E-shop with ID " + eshopId + " does not exist.");
}
order = order != null ? order : "name";
List<Product> products = productDAO.findByProperty(Product.class, "eshop", Key.class, eshop.getKey(), order, true, base, offset);
long count = productDAO.findByPropertyCount(Product.class, "eshop", Key.class, eshop.getKey());
List<ProductDTO> productDTOs = new ArrayList<>();
for (Product product : products) {
productDTOs.add(new ProductDTO(product, uriInfo));
}