KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibatis > jpetstore > service > AccountService


1 package com.ibatis.jpetstore.service;
2
3 import com.ibatis.dao.client.DaoManager;
4 import com.ibatis.jpetstore.domain.Account;
5 import com.ibatis.jpetstore.persistence.DaoConfig;
6 import com.ibatis.jpetstore.persistence.iface.AccountDao;
7
8 import java.util.List JavaDoc;
9
10 /**
11  * <p/>
12  * Date: Mar 6, 2004 11:22:43 PM
13  *
14  * @author Clinton Begin
15  */

16 public class AccountService {
17
18   /* Constants */
19
20   private static final AccountService instance = new AccountService();
21
22   /* Private Fields */
23
24   private DaoManager daoManager = DaoConfig.getDaomanager();
25
26   private AccountDao accountDao;
27
28   /* Constructors */
29
30   public AccountService() {
31     accountDao = (AccountDao) daoManager.getDao(AccountDao.class);
32   }
33
34   /* Public Methods */
35
36   public static AccountService getInstance() {
37     return instance;
38   }
39
40   /* ACCOUNT */
41
42   public Account getAccount(String JavaDoc username) {
43     return accountDao.getAccount(username);
44   }
45
46   public Account getAccount(String JavaDoc username, String JavaDoc password) {
47     return accountDao.getAccount(username, password);
48   }
49
50   public void insertAccount(Account account) {
51     accountDao.insertAccount(account);
52   }
53
54   public void updateAccount(Account account) {
55     accountDao.updateAccount(account);
56   }
57
58   public List JavaDoc getUsernameList() {
59     return accountDao.getUsernameList();
60   }
61
62 }
63
Popular Tags