1 package org.itracker.model;
2
3 import java.io.Serializable;
4 import java.util.Date;
5
6 /**
7 * All database entities must implement this interface, which represents
8 * the minimum requirements to meet.
9 * <p/>
10 * <p>A database entity always has an <code>Integer</code> surrogate key
11 * (system ID). It must also be Serializable and Cloneable. </p>
12 * <p/>
13 * <p>A database entity class must also fulfill the following requirements,
14 * that cannot be expressed by a Java interface : </p>
15 * <ul>
16 * <li>be a Java bean ; </li>
17 * <li>be non-final. </li>
18 * </ul>
19 *
20 * @author johnny
21 * @see AbstractEntity
22 */
23 public interface Entity extends Serializable, Cloneable, Comparable<Entity> {
24
25 /* PENDING : should createDate and lastModifiedDate properties
26 * be part of this interface ?
27 * Should we add createdBy and lastModifiedBy ? */
28
29 /**
30 * Returns the system ID.
31 *
32 * @return ID > 0 for persistent entities,
33 * <tt>null</tt> for transient ones
34 */
35 Integer getId();
36
37 /**
38 * Sets this entity's system ID.
39 *
40 * @param id ID > 0 for persistent entities,
41 * <tt>null</tt> for transient ones
42 */
43 void setId(Integer id);
44
45 void setLastModifiedDate(Date date);
46
47 Date getLastModifiedDate();
48
49 void setCreateDate(Date date);
50
51 Date getCreateDate();
52
53 boolean isNew();
54 }