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