@Test (priority=1) public void getCartOfUser() { ProductCart cart = pcs.getCartOfUser("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0"); Assert.assertEquals (cart.getUUID(), "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0"); cart = pcs.getCartOfUser("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3"); Assert.assertEquals (cart.getUUID(), "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"); cart = pcs.getCartOfUser("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"); Assert.assertNull(cart); cart = pcs.getCartOfUser("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2"); Assert.assertEquals (cart.getUUID(), "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2"); }
@PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public ProductCart getCartOfUser(String uuid) throws UserNotExistingException { User user = getUser (uuid); ProductCart pc = productCartDao.getCartOfUser(user); if (pc != null) { Hibernate.initialize(pc.getProducts()); } return pc; }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public ProductCart getCartOfUser(String uuid) throws UserNotExistingException { User user = getUser (uuid); ProductCart pc = productCartDao.getCartOfUser(user); if (pc != null) { Hibernate.initialize(pc.getProducts()); } return pc; } }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public ProductCart getCartOfUser(String uuid) throws UserNotExistingException { User user = getUser (uuid); ProductCart pc = productCartDao.getCartOfUser(user); if (pc != null) { Hibernate.initialize(pc.getProducts()); } return pc; }  }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public ProductCart getCartOfUser(String uuid) throws UserNotExistingException { User user = getUser (uuid); ProductCart pc = productCartDao.getCartOfUser(user); if (pc != null) { Hibernate.initialize(pc.getProducts()); } return pc; }  @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 ProductCart getCartOfUser(String uuid) throws UserNotExistingException { User user = getUser (uuid); ProductCart pc = productCartDao.getCartOfUser(user); if (pc != null) { Hibernate.initialize(pc.getProducts()); } return pc; }  @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);  }