KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > petstore > bo > ItemBOImpl


1 /*
2  * JFox - The most lightweight Java EE Application Server!
3  * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
4  *
5  * JFox is licenced and re-distributable under GNU LGPL.
6  */

7 package org.jfox.petstore.bo;
8
9 import java.util.List JavaDoc;
10 import java.sql.SQLException JavaDoc;
11
12 import javax.ejb.Stateless JavaDoc;
13 import javax.ejb.Local JavaDoc;
14 import javax.ejb.EJB JavaDoc;
15 import javax.ejb.EJBException JavaDoc;
16
17 import org.jfox.petstore.entity.Item;
18 import org.jfox.petstore.entity.Order;
19 import org.jfox.petstore.dao.ItemDAO;
20
21 /**
22  * @author <a HREF="mailto:jfox.young@gmail.com">Young Yang</a>
23  */

24 @Stateless JavaDoc
25 @Local JavaDoc
26 public class ItemBOImpl implements ItemBO {
27
28     @EJB JavaDoc
29     ItemDAO itemDAO;
30
31     public List JavaDoc<Item> getItemListByProduct(String JavaDoc productId) {
32         try {
33             return itemDAO.getItemListByProduct(productId);
34         }
35         catch(SQLException JavaDoc e){
36             throw new EJBException JavaDoc(e);
37         }
38     }
39
40     public Item getItem(String JavaDoc itemId) {
41         try {
42             return itemDAO.getItem(itemId);
43         }
44         catch(Exception JavaDoc e) {
45             return null;
46         }
47     }
48
49     public boolean isItemInStock(String JavaDoc itemId) {
50         try {
51             return itemDAO.getInventoryQuantity(itemId) > 0;
52         }
53         catch(Exception JavaDoc e){
54             e.printStackTrace();
55             return false;
56         }
57     }
58
59     public void updateQuantity(Order order) {
60     }
61
62     public static void main(String JavaDoc[] args) {
63
64     }
65 }
66
Popular Tags