@Test public void testFindProductSkusOnWarehouse() { List<SkuWarehouse> skusWarehouseList = skuWarehouseService.getProductSkusOnWarehouse(10000L, 1L); assertEquals(4, skusWarehouseList.size()); for (SkuWarehouse skuWarehouse : skusWarehouseList) { if ("SOBOT-BEER".equals(skuWarehouse.getSkuCode())) { assertEquals(1, skuWarehouse.getQuantity().intValue()); } if ("SOBOT-PINK".equals(skuWarehouse.getSkuCode())) { assertEquals(2, skuWarehouse.getQuantity().intValue()); } if ("SOBOT-LIGHT".equals(skuWarehouse.getSkuCode())) { assertEquals(3, skuWarehouse.getQuantity().intValue()); } if ("SOBOT-ORIG".equals(skuWarehouse.getSkuCode())) { assertEquals(4, skuWarehouse.getQuantity().intValue()); } } }
@Override public List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId) { final Product product = productService.getProductById(productId, true); final Set<String> skus = new HashSet<>(); for (final ProductSku productSku : product.getSku()) { skus.add(productSku.getCode()); } return getGenericDao().findByNamedQuery( "SKUS.ON.WAREHOUSE.IN.SKUCODE.WAREHOUSEID", skus, warehouseId); }
SkuWarehouseServiceImpl extends BaseGenericServiceImpl<SkuWarehouse> implements SkuWarehouseService { @Override public List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId) { final Product product = productService.getProductById(productId, true); final Set<String> skus = new HashSet<>(); for (final ProductSku productSku : product.getSku()) { skus.add(productSku.getCode()); } return getGenericDao().findByNamedQuery( "SKUS.ON.WAREHOUSE.IN.SKUCODE.WAREHOUSEID", skus, warehouseId); } }
SkuWarehouseServiceImpl extends BaseGenericServiceImpl<SkuWarehouse> implements SkuWarehouseService { @Override public List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId) { final Product product = productService.getProductById(productId, true); final Set<String> skus = new HashSet<>(); for (final ProductSku productSku : product.getSku()) { skus.add(productSku.getCode()); } return getGenericDao().findByNamedQuery( "SKUS.ON.WAREHOUSE.IN.SKUCODE.WAREHOUSEID", skus, warehouseId); } SkuWarehouseServiceImpl(
            final GenericDAO<SkuWarehouse, Long> genericDao); }
SkuWarehouseServiceImpl extends BaseGenericServiceImpl<SkuWarehouse> implements SkuWarehouseService { @Override public List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId) { final Product product = productService.getProductById(productId, true); final Set<String> skus = new HashSet<>(); for (final ProductSku productSku : product.getSku()) { skus.add(productSku.getCode()); } return getGenericDao().findByNamedQuery( "SKUS.ON.WAREHOUSE.IN.SKUCODE.WAREHOUSEID", skus, warehouseId); } SkuWarehouseServiceImpl(
            final GenericDAO<SkuWarehouse, Long> genericDao); @Override List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId); @Override BigDecimal reservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal reserveQty); @Override BigDecimal reservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal reserveQty, final boolean allowBackorder); @Override BigDecimal voidReservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal voidQty); @Override BigDecimal credit(final Warehouse warehouse, final String productSkuCode, final BigDecimal addQty); @Override BigDecimal debit(final Warehouse warehouse, final String productSkuCode, final BigDecimal debitQty); @Override SkuWarehouse create(SkuWarehouse instance); @Override SkuWarehouse update(SkuWarehouse instance); @Override SkuWarehouse findByWarehouseSku(final Warehouse warehouse, final String productSkuCode); @Override List<String> findProductSkuForWhichInventoryChangedAfter(final Instant lastUpdate); @Override List<String> findProductSkuByUnavailableBefore(final LocalDateTime before); @Override List<SkuWarehouse> findSkuWarehouses(final int start, final int offset, final String sort, final boolean sortDescending, final Map<String, List> filter); @Override int findSkuWarehouseCount(final Map<String, List> filter); void setProductService(ProductService productService); }
SkuWarehouseServiceImpl extends BaseGenericServiceImpl<SkuWarehouse> implements SkuWarehouseService { @Override public List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId) { final Product product = productService.getProductById(productId, true); final Set<String> skus = new HashSet<>(); for (final ProductSku productSku : product.getSku()) { skus.add(productSku.getCode()); } return getGenericDao().findByNamedQuery( "SKUS.ON.WAREHOUSE.IN.SKUCODE.WAREHOUSEID", skus, warehouseId); } SkuWarehouseServiceImpl(
            final GenericDAO<SkuWarehouse, Long> genericDao); @Override List<SkuWarehouse> getProductSkusOnWarehouse(final long productId, final long warehouseId); @Override BigDecimal reservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal reserveQty); @Override BigDecimal reservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal reserveQty, final boolean allowBackorder); @Override BigDecimal voidReservation(final Warehouse warehouse, final String productSkuCode, final BigDecimal voidQty); @Override BigDecimal credit(final Warehouse warehouse, final String productSkuCode, final BigDecimal addQty); @Override BigDecimal debit(final Warehouse warehouse, final String productSkuCode, final BigDecimal debitQty); @Override SkuWarehouse create(SkuWarehouse instance); @Override SkuWarehouse update(SkuWarehouse instance); @Override SkuWarehouse findByWarehouseSku(final Warehouse warehouse, final String productSkuCode); @Override List<String> findProductSkuForWhichInventoryChangedAfter(final Instant lastUpdate); @Override List<String> findProductSkuByUnavailableBefore(final LocalDateTime before); @Override List<SkuWarehouse> findSkuWarehouses(final int start, final int offset, final String sort, final boolean sortDescending, final Map<String, List> filter); @Override int findSkuWarehouseCount(final Map<String, List> filter); void setProductService(ProductService productService);  }