@Test (priority=1) public void countProductsInCart() { Assert.assertEquals(pcs.countProductsInCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0"), 2); Assert.assertEquals(pcs.countProductsInCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"), 0); Assert.assertEquals(pcs.countProductsInCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2"), 0); Assert.assertEquals(pcs.countProductsInCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3"), 1); }
@PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public int countProductsInCart (String uuid) throws UserNotExistingException { ProductCart cart = getCartOfUser (uuid); if (cart == null) return 0; return cart.getProducts () == null ? 0 : cart.getProducts ().size (); }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public int countProductsInCart (String uuid) throws UserNotExistingException { ProductCart cart = getCartOfUser (uuid); if (cart == null) return 0; return cart.getProducts () == null ? 0 : cart.getProducts ().size (); } }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public int countProductsInCart (String uuid) throws UserNotExistingException { ProductCart cart = getCartOfUser (uuid); if (cart == null) return 0; return cart.getProducts () == null ? 0 : cart.getProducts ().size (); }  }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public int countProductsInCart (String uuid) throws UserNotExistingException { ProductCart cart = getCartOfUser (uuid); if (cart == null) return 0; return cart.getProducts () == null ? 0 : cart.getProducts ().size (); }  @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) ProductCart createCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) void deleteCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) ProductCart getCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void addProductToCart(String uuid, Long p_id); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void removeProductFromCart(String uuid, Long p_id); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) List<Long> getProductsIdOfCart(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) List<Product> getProductsOfCart(String uuid, int skip, int top); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) int countProductsInCart(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) boolean hasProducts(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void clearCart(String uuid); }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public int countProductsInCart (String uuid) throws UserNotExistingException { ProductCart cart = getCartOfUser (uuid); if (cart == null) return 0; return cart.getProducts () == null ? 0 : cart.getProducts ().size (); }  @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) ProductCart createCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) void deleteCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) ProductCart getCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void addProductToCart(String uuid, Long p_id); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void removeProductFromCart(String uuid, Long p_id); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) List<Long> getProductsIdOfCart(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) List<Product> getProductsOfCart(String uuid, int skip, int top); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) int countProductsInCart(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) boolean hasProducts(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void clearCart(String uuid);  }