01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04:
05: package com.tctest.domain;
06:
07: import java.util.HashSet;
08: import java.util.Set;
09:
10: public class Person {
11:
12: private Long id;
13: private int age;
14: private String firstname;
15: private String lastname;
16: private Set events = new HashSet();
17: private Set emailAddresses = new HashSet();
18: private Set phoneNumbers = new HashSet();
19:
20: public Person() {
21: //
22: }
23:
24: protected Set getEvents() {
25: return events;
26: }
27:
28: protected void setEvents(Set events) {
29: this .events = events;
30: }
31:
32: public void addToEvent(Event event) {
33: this .getEvents().add(event);
34: event.getParticipants().add(this );
35: }
36:
37: public void removeFromEvent(Event event) {
38: this .getEvents().remove(event);
39: event.getParticipants().remove(this );
40: }
41:
42: public int getAge() {
43: return age;
44: }
45:
46: public void setAge(int age) {
47: this .age = age;
48: }
49:
50: public String getFirstname() {
51: return firstname;
52: }
53:
54: public void setFirstname(String firstname) {
55: this .firstname = firstname;
56: }
57:
58: public Long getId() {
59: return id;
60: }
61:
62: private void setId(Long id) {
63: this .id = id;
64: }
65:
66: public String getLastname() {
67: return lastname;
68: }
69:
70: public void setLastname(String lastname) {
71: this .lastname = lastname;
72: }
73:
74: public Set getEmailAddresses() {
75: return emailAddresses;
76: }
77:
78: public void setEmailAddresses(Set emailAddresses) {
79: this .emailAddresses = emailAddresses;
80: }
81:
82: public Set getPhoneNumbers() {
83: return phoneNumbers;
84: }
85:
86: public void setPhoneNumbers(Set phoneNumbers) {
87: this .phoneNumbers = phoneNumbers;
88: }
89:
90: public String toString() {
91: return getFirstname() + " " + getLastname();
92: }
93: }
|