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