View Javadoc

1   /***
2    *  Copyright 2003-2010 Terracotta, Inc.
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   */
16  package net.sf.ehcache.hibernate.domain;
17  
18  import java.util.Date;
19  import java.util.HashSet;
20  import java.util.Set;
21  
22  public class Event {
23      private Long id;
24  
25      private String title;
26      private Date date;
27      private Set participants = new HashSet();
28      private Person organizer;
29  
30      public Long getId() {
31          return id;
32      }
33  
34      public void setId(Long id) {
35          this.id = id;
36      }
37  
38      public Date getDate() {
39          return date;
40      }
41  
42      public void setDate(Date date) {
43          this.date = date;
44      }
45  
46      public String getTitle() {
47          return title;
48      }
49  
50      public void setTitle(String title) {
51          this.title = title;
52      }
53  
54      public void setOrganizer(Person organizer) {
55          this.organizer = organizer;
56      }
57  
58      public Person getOrganizer() {
59          return organizer;
60      }
61  
62      public Set getParticipants() {
63          return participants;
64      }
65  
66      public void setParticipants(Set participants) {
67          this.participants = participants;
68      }
69  
70      public void addParticipant(Person person) {
71          participants.add(person);
72          person.getEvents().add(this);
73      }
74  
75      public void removeParticipant(Person person) {
76          participants.remove(person);
77          person.getEvents().remove(this);
78      }
79  
80      public String toString() {
81          return getTitle() + ": " + getDate();
82      }
83  }