-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAccountRepository.java
More file actions
44 lines (42 loc) · 2.01 KB
/
AccountRepository.java
File metadata and controls
44 lines (42 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package com.example;
import java.sql.SQLException;
public interface AccountRepository {
/**
* Checks whether an account exists that matches the given username and password.
*
* @param username the account's username to look up
* @param password the account's password to validate
* @return `true` if an account with the provided username and password exists, `false` otherwise
* @throws SQLException if a database access error occurs
*/
boolean findByNameAndPassword(String username, String password) throws SQLException;
/**
* Creates a new account record using the provided personal and credential details.
*
* @param firstName the account holder's given name
* @param lastName the account holder's family name
* @param ssn the account holder's social security number
* @param password the account password
* @param username the desired account username
* @return the generated primary key for the new account when available; otherwise an implementation-specific integer status or affected-row count
* @throws SQLException if a database access error occurs
*/
int create(String firstName, String lastName, String ssn, String password, String username) throws SQLException;
/**
* Update the password for the account identified by the given user ID.
*
* @param userId identifier of the user whose password will be changed
* @param newPassword the new password to set for the account
* @return an integer result representing the outcome of the update (for example, number of rows affected or a status code)
* @throws SQLException if a database access error occurs while performing the update
*/
int updatePassword(long userId, String newPassword) throws SQLException;
/**
* Delete the account associated with the given user identifier.
*
* @param userId the identifier of the user to delete
* @return an integer result code (for example, the number of rows deleted or a status code)
* @throws SQLException if a database access error occurs
*/
int delete(long userId) throws SQLException;
}