-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathManagementController.java
More file actions
73 lines (58 loc) · 2.4 KB
/
ManagementController.java
File metadata and controls
73 lines (58 loc) · 2.4 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import DAO.MemberDAO;
import DAO.BookDAO;
import DAO.RentalDAO;
public class ManagementController {
private MemberDAO MemberDAO;
private BookDAO BookDAO;
private RentalDAO RentalDAO;
public ManagementController() {
this.memberDAO = new MemberDAO();
this.bookDAO = new BookDAO();
this.rentalDAO = new RentalDAO();
}
// 회원
public void registerMember(String name, String phoneNumber, String id) throws ValidationException, DuplicationException {
Member member = new Member(id, name, phoneNumber);
memberDAO.register(member);
}
public Member findMember(String name, String phoneNumber) throws DatabaseException {
return memberDAO.findMember(name, phoneNumber);
}
public void updateMember(String id, String name, String phoneNumber) throws ValidationException, DatabaseException {
Member member = new Member(id, name, phoneNumber);
memberDAO.updateMember(member);
}
public void deleteMember(String id) throws DatabaseException {
memberDAO.deleteMember(id);
}
// 도서
public void registerBook(String title, String publisher, String author, String id) throws ValidationException, DuplicationException {
Book book = new Book(id, title, publisher, author);
bookDAO.register(book);
}
public Book findBook(String title, String publisher, String author) throws DatabaseException {
return bookDAO.findBook(title, publisher, author);
}
public void deleteBook(String id) throws DatabaseException {
bookDAO.deleteBook(id);
}
// 대여
public List<Rental> viewAllRentals() throws DatabaseException {
return rentalDAO.viewAllRentals();
}
public List<Rental> viewRentalsByMember(String memberId) throws DatabaseException {
return rentalDAO.viewRentalsByMember(memberId);
}
public List<Rental> viewRentalsByBook(String bookId) throws DatabaseException {
return rentalDAO.viewRentalsByBook(bookId);
}
public void rentBook(String memberId, String bookId) throws ValidationException, RentalException, DatabaseException {
rentalDAO.rentBook(memberId, bookId);
}
public void returnBook(String rentalId) throws DatabaseException {
rentalDAO.returnBook(rentalId);
}
public void checkOverdue(String rentalId) throws DatabaseException {
rentalDAO.checkOverdue(rentalId);
}
}