1 /******************************************************************************
2 * Database - This interface defines 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 interface Database {
18 BSAccount getAccount(String username, String password);
19 BSAccount getAccount(String username);
20
21 /** Get an account via the numeric userid
22 * @param userid The user's unique numeric id
23 * @return The account found or <code>null</code> if no account
24 */
25 BSAccount getAccount(int userid);
26 BSAccount getAccountByEmail(String email);
27
28 /** Get an account by the recovery token.
29 * @param token The token that was emailed to the user.
30 * @return The account found or null if no account.
31 */
32 BSAccount getAccountByToken(int token);
33
34 void insertAccount(BSAccount account);
35 void updateAccount(BSAccount account);
36
37 /** Change the user's password
38 * @param account His BSAccount
39 * @param newPassword His new password
40 */
41 void updateAccountPassword(BSAccount account, String newPassword);
42
43 /** Get the number of users in the database.
44 * @return The number of users.
45 */
46 int getUserCount();
47 }