KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > entitytest03 > Class


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: Class.java 975 2006-07-28 11:14:14Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest03;
26
27 import java.util.Collection JavaDoc;
28 import java.util.Date JavaDoc;
29
30 import javax.persistence.Entity;
31 import javax.persistence.Id;
32 import javax.persistence.IdClass;
33 import javax.persistence.ManyToMany;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.PrimaryKeyJoinColumn;
36 import javax.persistence.Temporal;
37 import javax.persistence.TemporalType;
38
39 /**
40  * Contains the information about the class. Each course can have more than one class.
41  * @author Gisele Pinheiro Souza
42  * @author Eduardo Studzinski Estima de Castro
43  *
44  */

45 /**
46  * @author Gisele Pinheiro Souza
47  * @author Eduardo Studzinski Estima de Castro
48  *
49  */

50 @IdClass(ClassPK.class)
51 @Entity
52 @PrimaryKeyJoinColumn(name = "course", referencedColumnName = "courseId")
53 public class Class {
54
55     /**
56      * The course identifier.
57      */

58     private Course course;
59
60     /**
61      * The class year.
62      */

63     private String JavaDoc classYear;
64
65     /**
66      * The class name.
67      */

68     private String JavaDoc className;
69
70     /**
71      * The class room.
72      */

73     private ClassRoom classRoom;
74
75     /**
76      * The professor identifier.
77      */

78     private Professor professor;
79
80     /**
81      * The class students.
82      */

83     private Collection JavaDoc<Student> students;
84
85     /**
86      * The begin date for the class.
87      */

88     private Date JavaDoc startDate;
89
90     /**
91      * The end date for the class.
92      */

93     private Date JavaDoc endDate;
94
95     /**
96      * Returns the end date for the classes.
97      * @return the date.
98      */

99     @Temporal(TemporalType.DATE)
100     public Date JavaDoc getEndDate() {
101         return endDate;
102     }
103
104     /**
105      * Sets the end date for the classes.
106      * @param endDate the date.
107      */

108     public void setEndDate(final Date JavaDoc endDate) {
109         this.endDate = endDate;
110     }
111
112     /**
113      * Returns the start date for the classes.
114      * @return the date.
115      */

116     @Temporal(TemporalType.DATE)
117     public Date JavaDoc getStartDate() {
118         return startDate;
119     }
120
121     /**
122      * Sets the start date for the classes.
123      * @param startDate the date.
124      */

125     public void setStartDate(final Date JavaDoc startDate) {
126         this.startDate = startDate;
127     }
128
129     /**
130      * Returns the class room.
131      * @return the room.
132      */

133     @ManyToOne
134     public ClassRoom getClassRoom() {
135         return classRoom;
136     }
137
138     /**
139      * Sets the class room.
140      * @param classRoom the room.
141      */

142     public void setClassRoom(final ClassRoom classRoom) {
143         this.classRoom = classRoom;
144     }
145
146     /**
147      * Sets the students that are in this class.
148      * @param students the students.
149      */

150     public void setStudents(final Collection JavaDoc<Student> students) {
151         this.students = students;
152     }
153
154     /**
155      * Returns the class name.
156      * @return the name.
157      */

158     @Id
159     public String JavaDoc getClassName() {
160         return className;
161     }
162
163     /**
164      * Sets the class name.
165      * @param className the name.
166      */

167     public void setClassName(final String JavaDoc className) {
168         this.className = className;
169     }
170
171     /**
172      * Returns the class year.
173      * @return the year.
174      */

175     @Id
176     public String JavaDoc getClassYear() {
177         return classYear;
178     }
179
180     /**
181      * Sets the class year.
182      * @param classYear the year.
183      */

184     public void setClassYear(final String JavaDoc classYear) {
185         this.classYear = classYear;
186     }
187
188     /**
189      * Returns the class course.
190      * @return the course.
191      */

192     @ManyToOne
193     public Course getCourse() {
194         return course;
195     }
196
197     /**
198      * Sets the course.
199      * @param course the course.
200      */

201     public void setCourse(final Course course) {
202         this.course = course;
203     }
204
205 /**
206      * Returns the class professor.
207      * @return the professor.
208      */

209     @ManyToOne
210     public Professor getProfessor() {
211         return professor;
212     }
213
214     /**
215      * Sets the class professor.
216      * @param professor the professor.
217      */

218     public void setProfessor(final Professor professor) {
219         this.professor = professor;
220     }
221
222     /**
223      * Returns the class students.
224      * @return the students.
225      */

226     @ManyToMany(mappedBy = "currentCours")
227     public Collection JavaDoc<Student> getStudents() {
228         return students;
229     }
230
231 }
232
Popular Tags