View Javadoc
1   /******************************************************************************
2    * DatabaseImpl - This object implements the database API for BSAccount
3    * 
4    * BSAccountMan - BuckoSoft Web Account Manager 
5    * Copyright(c) 2007 - Dick Balaska and BuckoSoft, Corp.
6    * 
7    */
8   
9   package com.buckosoft.BSAccountMan.db;
10  
11  import com.buckosoft.BSAccount.domain.BSAccount;
12  
13  /**
14   * @author dick
15   *
16   */
17  public class DatabaseImpl implements Database {
18  
19  	private	AccountDao	accountDao;
20  
21  	public DatabaseImpl() {
22  		
23  	}
24  
25  	/**
26  	 * @param accountDao the accountDao to set
27  	 */
28  	public void setAccountDao(AccountDao accountDao) {
29  		this.accountDao = accountDao;
30  	}
31  
32  	/* (non-Javadoc)
33  	 * @see com.buckosoft.BSAccount.db.Database#getAccount(java.lang.String, java.lang.String)
34  	 */
35  	public BSAccount getAccount(String username, String password) {
36  		return(accountDao.getAccount(username, password));
37  	}
38  
39  	/* (non-Javadoc)
40  	 * @see com.buckosoft.BSAccount.db.Database#getAccount(java.lang.String)
41  	 */
42  	public BSAccount getAccount(String username) {
43  		return(accountDao.getAccount(username));
44  	}
45  
46  	
47  	/* (non-Javadoc)
48  	 * @see com.buckosoft.BSAccount.db.Database#getAccount(int)
49  	 */
50  	public BSAccount getAccount(int userid) {
51  		return(accountDao.getAccount(userid));
52  	}
53  
54  	/* (non-Javadoc)
55  	 * @see com.buckosoft.BSAccountMan.db.Database#getAccountByToken(int)
56  	 */
57  	@Override
58  	public BSAccount getAccountByToken(int token) {
59  		return(accountDao.getAccountByToken(token));
60  	}
61  
62  	/* (non-Javadoc)
63  	 * @see com.buckosoft.BSAccount.db.Database#getAccountByEmail(java.lang.String)
64  	 */
65  	public BSAccount getAccountByEmail(String email) {
66  		return(accountDao.getAccountByEmail(email));
67  	}
68  
69  	/* (non-Javadoc)
70  	 * @see com.buckosoft.BSAccount.db.Database#insertAccount(com.buckosoft.BSAccount.domain.Account)
71  	 */
72  	public void insertAccount(BSAccount account) {
73  		accountDao.insertAccount(account);
74  	}
75  
76  	/* (non-Javadoc)
77  	 * @see com.buckosoft.BSAccount.db.Database#updateAccount(com.buckosoft.BSAccount.domain.Account)
78  	 */
79  	public void updateAccount(BSAccount account) {
80  		accountDao.updateAccount(account);
81  	}
82  
83  	/* (non-Javadoc)
84  	 * @see com.buckosoft.BSAccount.db.Database#updateAccountPassword(com.buckosoft.BSAccount.domain.BSAccount, java.lang.String)
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  }