KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ivata > groupware > container > persistence > TimestampDO


1 /*
2  * Copyright (c) 2001 - 2005 ivata limited.
3  * All rights reserved.
4  * -----------------------------------------------------------------------------
5  * ivata groupware may be redistributed under the GNU General Public
6  * License as published by the Free Software Foundation;
7  * version 2 of the License.
8  *
9  * These programs are free software; you can redistribute them and/or
10  * modify them under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; version 2 of the License.
12  *
13  * These programs are distributed in the hope that they will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  * See the GNU General Public License in the file LICENSE.txt for more
18  * details.
19  *
20  * If you would like a copy of the GNU General Public License write to
21  *
22  * Free Software Foundation, Inc.
23  * 59 Temple Place - Suite 330
24  * Boston, MA 02111-1307, USA.
25  *
26  *
27  * To arrange commercial support and licensing, contact ivata at
28  * http://www.ivata.com/contact.jsp
29  * -----------------------------------------------------------------------------
30  * $Log: TimestampDO.java,v $
31  * Revision 1.3.2.1 2005/10/08 17:31:37 colinmacleod
32  * Used @hibernate.version tag for modified field.
33  *
34  * Revision 1.3 2005/04/10 20:10:04 colinmacleod
35  * Added new themes.
36  * Changed id type to String.
37  * Changed i tag to em and b tag to strong.
38  * Improved PicoContainerFactory with NanoContainer scripts.
39  *
40  * Revision 1.2 2005/04/09 17:19:58 colinmacleod
41  * Changed copyright text to GPL v2 explicitly.
42  *
43  * Revision 1.1.1.1 2005/03/10 17:51:32 colinmacleod
44  * Restructured ivata op around Hibernate/PicoContainer.
45  * Renamed ivata groupware.
46  *
47  * Revision 1.1 2004/09/30 15:16:00 colinmacleod
48  * Split off addressbook elements into security subproject.
49  *
50  * Revision 1.1 2004/07/13 19:41:15 colinmacleod
51  * Moved project to POJOs from EJBs.
52  * Applied PicoContainer to services layer (replacing session EJBs).
53  * Applied Hibernate to persistence layer (replacing entity EJBs).
54  * -----------------------------------------------------------------------------
55  */

56 package com.ivata.groupware.container.persistence;
57
58 import java.sql.Timestamp JavaDoc;
59
60 import org.apache.log4j.Logger;
61
62 import com.ivata.groupware.admin.security.user.UserDO;
63
64 /**
65  * @author Colin MacLeod
66  * <a HREF='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
67  * @since Mar 28, 2004
68  * @version $Revision: 1.3.2.1 $
69  */

70 public abstract class TimestampDO extends BaseDO {
71     private static Logger log = Logger.getLogger(TimestampDO.class);
72     /**
73      * <p>The date and time when the DO was created.</p>
74      */

75     Timestamp JavaDoc created;
76
77     /**
78      * <p>User who created this DO.</p>
79      */

80     private UserDO createdBy;
81
82     /**
83      * <p>The date and time when the DO was last modified.</p>
84      */

85     Timestamp JavaDoc modified;
86
87     /**
88      * <p>User who last modified this DO.</p>
89      */

90     private UserDO modifiedBy;
91     /**
92      * <p>Get the date and time when the DO was created.</p>
93      *
94      * @return the date and time when the DO was created.
95      * @hibernate.property
96      */

97     public Timestamp JavaDoc getCreated() {
98         return created;
99     }
100
101     /**
102      * <p>Get the user who created this DO.</p>
103      *
104      * @return the user who created this DO.
105      * @hibernate.many-to-one
106      * column="created_by"
107      */

108     public UserDO getCreatedBy() {
109         return createdBy;
110     }
111     /**
112      * <p>Get the date and time when the DO was last modified.</p>
113      *
114      * @return the date and time when the DO was last modified.
115      * @hibernate.version
116      */

117     public Timestamp JavaDoc getModified() {
118         return modified;
119     }
120
121     /**
122      * <p>Get the username of the user who last modified this DO.</p>
123      *
124      * @return the user name for the user who last modified this DO.
125      * @hibernate.many-to-one
126      * column="modified_by"
127      */

128     public UserDO getModifiedBy() {
129         return modifiedBy;
130     }
131
132     /**
133      * Refer to {@link #getCreated}.
134      * @param createdParam The created to set.
135      */

136     public void setCreated(Timestamp JavaDoc createdParam) {
137         if (log.isDebugEnabled()) {
138             log.debug("setCreated before: '" + created
139                     + "', after: '" + createdParam + "': "
140                     + toString());
141         }
142         assert (createdParam != null);
143         created = createdParam;
144     }
145     /**
146      * Refer to {@link #getCreatedBy}.
147      * @param createdByParam The createdBy to set.
148      */

149     public void setCreatedBy(UserDO createdByParam) {
150         if (log.isDebugEnabled()) {
151             log.debug("setCreatedBy before: '" + createdBy
152                     + "', after: '" + createdByParam + "': "
153                     + toString());
154         }
155         assert (createdByParam != null);
156         createdBy = createdByParam;
157     }
158     /**
159      * Refer to {@link #getModified}.
160      * @param modifiedParam The modified to set.
161      */

162     public void setModified(Timestamp JavaDoc modifiedParam) {
163         if (log.isDebugEnabled()) {
164             log.debug("setModified before: '" + modified
165                     + "', after: '" + modifiedParam + "': "
166                     + toString());
167         }
168         assert (modifiedParam != null);
169         modified = modifiedParam;
170     }
171     /**
172      * Refer to {@link #getModifiedBy}.
173      * @param modifiedByParam The modifiedBy to set.
174      */

175     public void setModifiedBy(UserDO modifiedByParam) {
176         if (log.isDebugEnabled()) {
177             log.debug("setModifiedBy before: '" + modifiedBy
178                     + "', after: '" + modifiedByParam + "': "
179                     + toString());
180         }
181         assert (modifiedByParam != null);
182         modifiedBy = modifiedByParam;
183    }
184     /**
185      * Refer to {@link }.
186      * Overridden to output current time and user info - useful for debugging.
187      *
188      * @return string with current class, id and user/time information.
189      * @see java.lang.Object#toString()
190      */

191     public String JavaDoc toString() {
192         return super.toString()
193                 + "[ Created "
194                 + created
195                 + " by "
196                 + ((createdBy == null)
197                         ? "[nobody]"
198                         : createdBy.getDisplayName())
199                 + ", Modified "
200                 + modified
201                 + " by "
202                 + ((modifiedBy == null)
203                         ? "[nobody]"
204                                 : modifiedBy.getDisplayName())
205                 + " ]";
206     }
207 }
208
Popular Tags