KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > j2biz > blogunity > pojo > CalendarEntry


1 /*
2  * $Id: CalendarEntry.java,v 1.3 2004/12/30 19:11:19 keyboardsamurai Exp $
3  *
4  * Copyright (c) 2004 j2biz Group, http://www.j2biz.com
5  * Koeln / Duesseldorf , Germany
6  *
7  * @author Max Kalina
8  *
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23  *
24  */

25
26 package com.j2biz.blogunity.pojo;
27
28 import java.io.Serializable JavaDoc;
29 import java.util.Calendar JavaDoc;
30 import java.util.Date JavaDoc;
31
32 /**
33  * @hibernate.class table="ENTRY_CALENDAR" dynamic-insert = "true"
34  * dynamic-update = "true"
35  *
36  *
37  * @author michelson
38  * @version $$
39  * @since 0.1
40  *
41  *
42  */

43 public class CalendarEntry implements Serializable JavaDoc{
44
45     /**
46      * Comment for <code>serialVersionUID</code>
47      */

48     private static final long serialVersionUID = 3256443624865804855L;
49
50     private Long JavaDoc id;
51
52     private int year;
53
54     private int month;
55
56     private int day;
57
58     private int numberOfMessages = 0;
59
60     private Blog blog;
61
62     /**
63      * @hibernate.many-to-one column="BLOG_ID"
64      * class="com.j2biz.blogunity.pojo.Blog"
65      *
66      * @return Returns the blog.
67      */

68     public Blog getBlog() {
69         return blog;
70     }
71
72     /**
73      * @param blog
74      * The blog to set.
75      */

76     public void setBlog(Blog blog) {
77         this.blog = blog;
78     }
79
80     /**
81      * @hibernate.property name="day" column="DAY" type="integer"
82      * not-null="true" unique="false"
83      *
84      * @return Returns the day.
85      */

86     public int getDay() {
87         return day;
88     }
89
90     /**
91      * @param day
92      * The day to set.
93      */

94     public void setDay(int day) {
95         this.day = day;
96     }
97
98     /**
99      * @hibernate.id generator-class="increment" type="long" column="ID"
100      * unsaved-value="null"
101      *
102      * @return Returns the id.
103      */

104     public Long JavaDoc getId() {
105         return id;
106     }
107
108     /**
109      * @param id
110      * The id to set.
111      */

112     public void setId(Long JavaDoc id) {
113         this.id = id;
114     }
115
116     /**
117      * @hibernate.property name="month" column="MONTH" type="integer"
118      * not-null="true" unique="false"
119      * @return Returns the month.
120      */

121     public int getMonth() {
122         return month;
123     }
124
125     /**
126      * @param month
127      * The month to set.
128      */

129     public void setMonth(int month) {
130         this.month = month;
131     }
132
133     /**
134      * @hibernate.property name="numberOfMessages" column="NUMBER_OF_MESSAGES"
135      * type="integer" not-null="true" unique="false"
136      * @return Returns the numberOfMessages.
137      */

138     public int getNumberOfMessages() {
139         return numberOfMessages;
140     }
141
142     /**
143      * @param numberOfMessages
144      * The numberOfMessages to set.
145      */

146     public void setNumberOfMessages(int numberOfMessages) {
147         this.numberOfMessages = numberOfMessages;
148     }
149
150     /**
151      * @hibernate.property name="year" column="YEAR" type="integer"
152      * not-null="true" unique="false"
153      * @return Returns the year.
154      */

155     public int getYear() {
156         return year;
157     }
158
159     /**
160      * @param year
161      * The year to set.
162      */

163     public void setYear(int year) {
164         this.year = year;
165     }
166
167     public void setDate(Date JavaDoc date) {
168         Calendar JavaDoc c = Calendar.getInstance();
169         c.setTime(date);
170         setDate(c);
171     }
172
173     public void setDate(Calendar JavaDoc c) {
174         setDay(c.get(Calendar.DAY_OF_MONTH));
175         setMonth(c.get(Calendar.MONTH) + 1);
176         setYear(c.get(Calendar.YEAR));
177     }
178 }
Popular Tags