@Test (priority=1000) public void createCartOfUser () { User u = new User(); u.setUsername ("TMPUSER##2"); u.setPassword ("TMPPASS##2"); u = userDao.create(u); ProductCart cart = pcs.createCartOfUser(u.getUUID()); Assert.assertNotNull(cart); ProductCart cart_new = pcs.createCartOfUser(u.getUUID()); Assert.assertEquals(cart, cart_new); }
@PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) public ProductCart createCartOfUser (String uuid) { ProductCart cart = getCartOfUser(uuid); if (cart == null) { User user = getUser (uuid); cart = new ProductCart(); cart.setUser (user); } return productCartDao.create (cart); }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) public ProductCart createCartOfUser (String uuid) { ProductCart cart = getCartOfUser(uuid); if (cart == null) { User user = getUser (uuid); cart = new ProductCart(); cart.setUser (user); } return productCartDao.create (cart); } }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) public ProductCart createCartOfUser (String uuid) { ProductCart cart = getCartOfUser(uuid); if (cart == null) { User user = getUser (uuid); cart = new ProductCart(); cart.setUser (user); } return productCartDao.create (cart); }  }
ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) public ProductCart createCartOfUser (String uuid) { ProductCart cart = getCartOfUser(uuid); if (cart == null) { User user = getUser (uuid); cart = new ProductCart(); cart.setUser (user); } return productCartDao.create (cart); }  @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=false, propagation=Propagation.REQUIRED) public ProductCart createCartOfUser (String uuid) { ProductCart cart = getCartOfUser(uuid); if (cart == null) { User user = getUser (uuid); cart = new ProductCart(); cart.setUser (user); } return productCartDao.create (cart); }  @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);  }