KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.Collections JavaDoc;
11 import javax.ejb.Stateless JavaDoc;
12 import javax.ejb.Local JavaDoc;
13 import javax.ejb.EJB JavaDoc;
14 import javax.ejb.EJBException JavaDoc;
15
16 import org.jfox.petstore.entity.Account;
17 import org.jfox.petstore.dao.AccountDAO;
18
19 /**
20  * @author <a HREF="mailto:jfox.young@gmail.com">Young Yang</a>
21  */

22 @Stateless JavaDoc
23 @Local JavaDoc
24 public class AccountBOImpl implements AccountBO {
25
26     @EJB JavaDoc
27     AccountDAO accountDAO;
28
29     public Account getAccount(String JavaDoc username) {
30         try {
31             return accountDAO.getAccount(username);
32         }
33         catch (Exception JavaDoc e) {
34             e.printStackTrace();
35             return null;
36         }
37     }
38
39     public Account getAccount(String JavaDoc username, String JavaDoc password) {
40         try {
41             return accountDAO.getAccount(username, password);
42         }
43         catch (Exception JavaDoc e) {
44             e.printStackTrace();
45             return null;
46         }
47     }
48
49
50     public void updateAccount(Account account) {
51         try {
52             accountDAO.updateAccount(account);
53         }
54         catch (Exception JavaDoc e) {
55             throw new EJBException JavaDoc(e);
56         }
57     }
58
59
60     public List JavaDoc<String JavaDoc> getUsernameList() {
61         try {
62             return accountDAO.getUsernameList();
63         }
64         catch (Exception JavaDoc e) {
65             e.printStackTrace();
66             return Collections.emptyList();
67         }
68     }
69
70     public void insertAccount(Account account) {
71         try {
72             accountDAO.insertAccount(account);
73         }
74         catch (Exception JavaDoc e) {
75             throw new EJBException JavaDoc(e);
76         }
77     }
78
79     public static void main(String JavaDoc[] args) {
80
81     }
82 }
83
Popular Tags