01: /*
02: * Created on 16 juin 2005
03: *
04: */
05: package abook.data;
06:
07: import java.util.ArrayList;
08: import java.util.Collection;
09:
10: /**
11: * Provides object of type Narrator mapping the data stored in the sql database
12: */
13: public class Narrator {
14:
15: private String lastName;
16: private String firstName;
17: private long narratorId;
18: private Collection books;
19:
20: /**
21: * Constructs a new Narrator object
22: * @param firstName The narrator's first name.
23: * @param lastName The narrator's last name.
24: * @param narratorId The narrator identifier
25: */
26: public Narrator(String firstName, String lastName, long narratorId) {
27: this .lastName = lastName;
28: this .firstName = firstName;
29: this .narratorId = narratorId;
30: books = new ArrayList();
31: }
32:
33: /**
34: * @return Returns the books.
35: */
36: public Collection getBooks() {
37: return books;
38: }
39:
40: /**
41: * @param books The books to set.
42: */
43: public void setBooks(Collection books) {
44: this .books = books;
45: }
46:
47: /**
48: * @return Returns the firstName.
49: */
50: public String getFirstName() {
51: return firstName;
52: }
53:
54: /**
55: * @param firstName The firstName to set.
56: */
57: public void setFirstName(String firstName) {
58: this .firstName = firstName;
59: }
60:
61: /**
62: * @return Returns the lastName.
63: */
64: public String getLastName() {
65: return lastName;
66: }
67:
68: /**
69: * @param lastName The lastName to set.
70: */
71: public void setLastName(String lastName) {
72: this .lastName = lastName;
73: }
74:
75: /**
76: * @return Returns the narratorId.
77: */
78: public long getNarratorId() {
79: return narratorId;
80: }
81:
82: /**
83: * @param narratorId The narratorId to set.
84: */
85: public void setNarratorId(long narratorId) {
86: this .narratorId = narratorId;
87: }
88:
89: /**
90: * @param book The book to add.
91: * @return true the books collection changed as a result of the call
92: */
93: public boolean addBook(Book book) {
94: return books.add(book);
95: }
96: }
|