KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > business > PubTimeData


1 package org.roller.business;
2
3 /**
4  * Pub date bean.
5  * @author David M Johnson
6  *
7  * @castor:class name="PubTime" table="weblogentry" id="id" key-generator="UUID"
8  */

9 public class PubTimeData
10    extends org.roller.pojos.PersistentObject
11    implements java.io.Serializable JavaDoc
12 {
13    static final long serialVersionUID = -5669288520200229343L;
14
15    protected java.lang.String JavaDoc id;
16    protected java.sql.Timestamp JavaDoc pubTime;
17
18    public PubTimeData()
19    {
20    }
21
22    public PubTimeData( java.lang.String JavaDoc id,java.sql.Timestamp JavaDoc pubTime )
23    {
24       this.id = id;
25       this.pubTime = pubTime;
26    }
27
28    public PubTimeData( PubTimeData otherData )
29    {
30       this.id = otherData.id;
31       this.pubTime = otherData.pubTime;
32
33    }
34
35    /** @castor:field set-method="setId"
36      * @castor:field-sql name="id" sql-dirty="check" dirty="check"
37      * @castor:field-xml node="attribute"
38      */

39    public java.lang.String JavaDoc getId()
40    {
41       return this.id;
42    }
43    public void setId( java.lang.String JavaDoc id )
44    {
45       this.id = id;
46    }
47
48    /** Pub date.
49      * @castor:field set-method="setPubTime"
50      * @castor:field-sql name="pubtime" sql-dirty="check" dirty="check"
51      */

52    public java.sql.Timestamp JavaDoc getPubTime()
53    {
54       return this.pubTime;
55    }
56    public void setPubTime( java.sql.Timestamp JavaDoc pubTime )
57    {
58       this.pubTime = pubTime;
59    }
60
61    public String JavaDoc toString()
62    {
63       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
64
65       str.append("id=" + id + " " + "pubTime=" + pubTime);
66       str.append('}');
67
68       return(str.toString());
69    }
70
71    public boolean equals( Object JavaDoc pOther )
72    {
73       if( pOther instanceof PubTimeData )
74       {
75          PubTimeData lTest = (PubTimeData) pOther;
76          boolean lEquals = true;
77
78          if( this.id == null )
79          {
80             lEquals = lEquals && ( lTest.id == null );
81          }
82          else
83          {
84             lEquals = lEquals && this.id.equals( lTest.id );
85          }
86          if( this.pubTime == null )
87          {
88             lEquals = lEquals && ( lTest.pubTime == null );
89          }
90          else
91          {
92             lEquals = lEquals && this.pubTime.equals( lTest.pubTime );
93          }
94
95          return lEquals;
96       }
97       else
98       {
99          return false;
100       }
101    }
102
103    public int hashCode()
104    {
105       int result = 17;
106       result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
107       result = 37*result + ((this.pubTime != null) ? this.pubTime.hashCode() : 0);
108       return result;
109       }
110
111    /**
112     * Setter is needed in RollerImpl.storePersistentObject()
113     */

114    public void setData( org.roller.pojos.PersistentObject otherData )
115    {
116
117       this.id = ((PubTimeData)otherData).id;
118
119       this.pubTime = ((PubTimeData)otherData).pubTime;
120    }
121
122 }
123
Popular Tags