1
2
3
4
5
6
7
8
9 package com.buckosoft.BSAccountMan.db;
10
11 import com.buckosoft.BSAccount.domain.BSAccount;
12
13
14
15
16
17 public class DatabaseImpl implements Database {
18
19 private AccountDao accountDao;
20
21 public DatabaseImpl() {
22
23 }
24
25
26
27
28 public void setAccountDao(AccountDao accountDao) {
29 this.accountDao = accountDao;
30 }
31
32
33
34
35 public BSAccount getAccount(String username, String password) {
36 return(accountDao.getAccount(username, password));
37 }
38
39
40
41
42 public BSAccount getAccount(String username) {
43 return(accountDao.getAccount(username));
44 }
45
46
47
48
49
50 public BSAccount getAccount(int userid) {
51 return(accountDao.getAccount(userid));
52 }
53
54
55
56
57 @Override
58 public BSAccount getAccountByToken(int token) {
59 return(accountDao.getAccountByToken(token));
60 }
61
62
63
64
65 public BSAccount getAccountByEmail(String email) {
66 return(accountDao.getAccountByEmail(email));
67 }
68
69
70
71
72 public void insertAccount(BSAccount account) {
73 accountDao.insertAccount(account);
74 }
75
76
77
78
79 public void updateAccount(BSAccount account) {
80 accountDao.updateAccount(account);
81 }
82
83
84
85
86 public void updateAccountPassword(BSAccount account, String newPassword) {
87 accountDao.updateAccountPassword(account, newPassword);
88 }
89
90 @Override
91 public int getUserCount() {
92 return(accountDao.getUserCount());
93 }
94
95
96 }