예제 #1
0
 public OrderStatus buy(int aItemId, int quantity) throws UnknownArticleException {
   Item orderedItem = stockDao.getItem(aItemId);
   if (orderedItem == null) {
     throw new UnknownArticleException();
   }
   if (stockDao.addOrder(orderedItem, quantity)) {
     return new OrderStatus(orderedItem, ++orderId);
   } else {
     return new OrderStatus(orderedItem);
   }
 }
예제 #2
0
 public List listStock() {
   return stockDao.getCurrentStock();
 }