KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.roller.business;
2
3 /**
4  * Hit count bean.
5  * @author David M Johnson
6  *
7  * @castor:class name="HitCount" table="referer" id="id" key-generator="UUID"
8  * @hibernate.class table="referer"
9  */

10 public class HitCountData
11    extends org.roller.pojos.PersistentObject
12    implements java.io.Serializable JavaDoc
13 {
14    static final long serialVersionUID = -7998453141931097201L;
15
16    protected java.lang.String JavaDoc id;
17    protected java.lang.Integer JavaDoc dayHitCount;
18    protected java.lang.Integer JavaDoc totalHitCount;
19    protected org.roller.pojos.WebsiteData website;
20
21    public HitCountData()
22    {
23    }
24
25    public HitCountData( java.lang.String JavaDoc id,
26         java.lang.Integer JavaDoc dayHitCount, java.lang.Integer JavaDoc totalHitCount )
27    {
28       this.id = id;
29       this.totalHitCount = totalHitCount;
30       this.dayHitCount = dayHitCount;
31    }
32
33    public HitCountData( HitCountData otherData )
34    {
35       this.id = otherData.id;
36       this.totalHitCount = otherData.totalHitCount;
37       this.dayHitCount = otherData.dayHitCount;
38    }
39
40    /** @castor:field set-method="setId"
41      * @castor:field-sql name="id" sql-dirty="check" dirty="check"
42      * @castor:field-xml node="attribute"
43      * @hibernate.id column="id" type="string"
44      * generator-class="uuid.hex" unsaved-value="null"
45      */

46    public java.lang.String JavaDoc getId()
47    {
48       return this.id;
49    }
50    public void setId( java.lang.String JavaDoc id )
51    {
52       this.id = id;
53    }
54
55    /** Day hit count.
56      * @castor:field set-method="setDayHitCount"
57      * @castor:field-sql name="dayhits" sql-dirty="check" dirty="check"
58      * @hibernate.property column="dayhits" non-null="true" unique="false"
59      */

60    public java.lang.Integer JavaDoc getDayHitCount()
61    {
62       return this.dayHitCount;
63    }
64    public void setDayHitCount( java.lang.Integer JavaDoc dayHitCount )
65    {
66       this.dayHitCount = dayHitCount;
67    }
68
69    /** Total hit count.
70      * @castor:field set-method="setTotalHitCount"
71      * @castor:field-sql name="totalhits" sql-dirty="check" dirty="check"
72      * @hibernate.property column="totalhits" non-null="true" unique="false"
73      */

74    public java.lang.Integer JavaDoc getTotalHitCount()
75    {
76       return this.totalHitCount;
77    }
78    public void setTotalHitCount( java.lang.Integer JavaDoc hitCount )
79    {
80       this.totalHitCount = hitCount;
81    }
82
83    /**
84     * ID of website that this referer refers to.
85     * @hibernate.many-to-one column="websiteid" cascade="none" not-null="true"
86     */

87    public org.roller.pojos.WebsiteData getWebsite()
88    {
89       return this.website;
90    }
91    public void setWebsite( org.roller.pojos.WebsiteData website )
92    {
93       this.website = website;
94    }
95
96    public String JavaDoc toString()
97    {
98       StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
99
100       str.append("id=" + id + " " + "dayHitCount=" + dayHitCount);
101       str.append('}');
102
103       return(str.toString());
104    }
105
106    public boolean equals( Object JavaDoc pOther )
107    {
108       if( pOther instanceof HitCountData )
109       {
110          HitCountData lTest = (HitCountData) pOther;
111          boolean lEquals = true;
112
113          if( this.id == null )
114          {
115             lEquals = lEquals && ( lTest.id == null );
116          }
117          else
118          {
119             lEquals = lEquals && this.id.equals( lTest.id );
120          }
121          if( this.dayHitCount == null )
122          {
123             lEquals = lEquals && ( lTest.dayHitCount == null );
124          }
125          else
126          {
127             lEquals = lEquals && this.dayHitCount.equals( lTest.dayHitCount );
128          }
129          if( this.totalHitCount == null )
130          {
131             lEquals = lEquals && ( lTest.totalHitCount == null );
132          }
133          else
134          {
135             lEquals= lEquals && this.totalHitCount.equals(lTest.totalHitCount);
136          }
137
138          return lEquals;
139       }
140       else
141       {
142          return false;
143       }
144    }
145
146    public int hashCode()
147    {
148       int result = 17;
149       result = 37*result + ((this.id != null) ? this.id.hashCode() : 0);
150       result = 37*result + ((this.dayHitCount != null) ? this.dayHitCount.hashCode() : 0);
151       result = 37*result + ((this.totalHitCount != null) ? this.totalHitCount.hashCode() : 0);
152       return result;
153       }
154
155    /**
156     * Setter is needed in RollerImpl.storePersistentObject()
157     */

158    public void setData( org.roller.pojos.PersistentObject otherData )
159    {
160
161       this.id = ((HitCountData)otherData).id;
162
163       this.dayHitCount = ((HitCountData)otherData).dayHitCount;
164       this.totalHitCount = ((HitCountData)otherData).totalHitCount;
165    }
166
167 }
168
Popular Tags