//use case 2.7 public void changeQuantity(int user, int product, int newAmount) { if (product < 0) { throw new ILLArgumentException("invalid product id"); } if (newAmount <= 0) { throw new AlreadyExistException("ERROR: quantity should be a positive number"); } db.changeQuantity(user, product, newAmount); }
//use case 2.7 public void changeQuantity(Session user, int product, int store, int newAmount) { if (product < 0) { throw new ArgumentException("invalid product id"); } if (store < 0) { throw new ArgumentException("invalid store id"); } if (newAmount <= 0) { throw new IllegalAmountException("ERROR: quantity should be a positive number"); } db.changeQuantity(user, product, store, newAmount); }