1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.ibatis.jpetstore.service;
18
19 import com.ibatis.dao.client.DaoManager;
20 import com.ibatis.jpetstore.domain.Account;
21 import com.ibatis.jpetstore.persistence.DaoConfig;
22 import com.ibatis.jpetstore.persistence.iface.AccountDao;
23
24 import java.util.List;
25
26 /***
27 * <p/>
28 * Date: Mar 6, 2004 11:22:43 PM
29 *
30 * @author Clinton Begin
31 */
32 public class AccountService {
33
34
35
36 private static final AccountService instance = new AccountService();
37
38
39
40 private DaoManager daoManager = DaoConfig.getDaomanager();
41
42 private AccountDao accountDao;
43
44
45
46 public AccountService() {
47 accountDao = (AccountDao) daoManager.getDao(AccountDao.class);
48 }
49
50
51
52 public static AccountService getInstance() {
53 return instance;
54 }
55
56
57
58 public Account getAccount(String username) {
59 return accountDao.getAccount(username);
60 }
61
62 public Account getAccount(String username, String password) {
63 return accountDao.getAccount(username, password);
64 }
65
66 public void insertAccount(Account account) {
67 accountDao.insertAccount(account);
68 }
69
70 public void updateAccount(Account account) {
71 accountDao.updateAccount(account);
72 }
73
74 public List getUsernameList() {
75 return accountDao.getUsernameList();
76 }
77
78 }