01: package com.tctest.domain;
02:
03: import java.util.Date;
04: import java.util.HashSet;
05: import java.util.Set;
06:
07: public class Event {
08: private Long id;
09:
10: private String title;
11: private Date date;
12: private Set participants = new HashSet();
13:
14: public Long getId() {
15: return id;
16: }
17:
18: private void setId(Long id) {
19: this .id = id;
20: }
21:
22: public Date getDate() {
23: return date;
24: }
25:
26: public void setDate(Date date) {
27: this .date = date;
28: }
29:
30: public String getTitle() {
31: return title;
32: }
33:
34: public void setTitle(String title) {
35: this .title = title;
36: }
37:
38: public Set getParticipants() {
39: return participants;
40: }
41:
42: public void setParticipants(Set participants) {
43: this .participants = participants;
44: }
45:
46: public void addParticipant(Person person) {
47: participants.add(person);
48: person.getEvents().add(this );
49: }
50:
51: public void removeParticipant(Person person) {
52: participants.remove(person);
53: person.getEvents().remove(this );
54: }
55:
56: public String toString() {
57: return getTitle() + ": " + getDate();
58: }
59: }
|