KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > cowsultants > itracker > ejb > client > models > GenericModel


1 /*
2  * This software was designed and created by Jason Carroll.
3  * Copyright (c) 2002, 2003, 2004 Jason Carroll.
4  * The author can be reached at jcarroll@cowsultants.com
5  * ITracker website: http://www.cowsultants.com
6  * ITracker forums: http://www.cowsultants.com/phpBB/index.php
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it only under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  */

18
19 package cowsultants.itracker.ejb.client.models;
20
21 import java.util.Date JavaDoc;
22 import java.io.Serializable JavaDoc;
23
24 public class GenericModel implements Serializable JavaDoc, Cloneable JavaDoc {
25     protected Integer JavaDoc id = null;
26     protected Date JavaDoc lastModifiedDate;
27     protected Date JavaDoc createDate;
28
29     public GenericModel() {
30     }
31
32     public GenericModel(Integer JavaDoc id) {
33         this.id = id;
34     }
35
36     public Integer JavaDoc getId() {
37         return id;
38     }
39
40     public void setId(Integer JavaDoc value) {
41          id = value;
42     }
43
44     public Date JavaDoc getCreateDate() {
45         return createDate;
46     }
47
48     public void setCreateDate(Date JavaDoc value) {
49          createDate = value;
50     }
51
52     public Date JavaDoc getLastModifiedDate() {
53         return lastModifiedDate;
54     }
55
56     public void setLastModifiedDate(Date JavaDoc value) {
57          lastModifiedDate = value;
58     }
59
60     public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
61         return super.clone();
62     }
63
64     public boolean equals(Object JavaDoc value) {
65         if(value != null && value instanceof GenericModel) {
66             GenericModel mo = (GenericModel) value;
67             if(mo.getId() != null && mo.getId().equals(this.getId())) {
68                 return true;
69             }
70         }
71         return false;
72     }
73
74     public int hashCode() {
75         return (this.getId() == null ? super.hashCode() : this.getId().intValue());
76     }
77 }
78   
Popular Tags