001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. The ASF licenses this file to You
004: * under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License. For additional information regarding
015: * copyright in this work, please see the NOTICE file in the top level
016: * directory of this distribution.
017: */
018:
019: package org.apache.roller.pojos;
020:
021: import java.io.Serializable;
022:
023: /**
024: * Represents hit count data for a weblog.
025: *
026: * @ejb:bean name="HitCountData"
027: * @hibernate.class lazy="true" table="roller_hitcounts"
028: * @hibernate.cache usage="read-write"
029: */
030: public class HitCountData extends PersistentObject implements
031: Serializable {
032:
033: private String id = null;
034: private WebsiteData weblog = null;
035: private int dailyHits = 0;
036:
037: public HitCountData() {
038: }
039:
040: public void setData(PersistentObject otherData) {
041: HitCountData other = (HitCountData) otherData;
042: this .id = other.getId();
043: this .weblog = other.getWeblog();
044: this .dailyHits = other.getDailyHits();
045: }
046:
047: public boolean equals(Object other) {
048:
049: if (this == other)
050: return true;
051: if (!(other instanceof HitCountData))
052: return false;
053:
054: // our natural key, or business key, is our weblog
055: final HitCountData that = (HitCountData) other;
056: return this .getWeblog().equals(that.getWeblog());
057: }
058:
059: public int hashCode() {
060: // our natrual key, or business key, is our weblog
061: return this .getWeblog().hashCode();
062: }
063:
064: /**
065: * @ejb:persistent-field
066: * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
067: */
068: public String getId() {
069: return id;
070: }
071:
072: public void setId(String id) {
073: this .id = id;
074: }
075:
076: /**
077: * @ejb:persistent-field
078: * @hibernate.many-to-one column="websiteid" cascade="none" non-null="true"
079: */
080: public WebsiteData getWeblog() {
081: return weblog;
082: }
083:
084: public void setWeblog(WebsiteData weblog) {
085: this .weblog = weblog;
086: }
087:
088: /**
089: * @ejb:persistent-field
090: * @hibernate.property column="dailyhits" non-null="true" unique="false"
091: */
092: public int getDailyHits() {
093: return dailyHits;
094: }
095:
096: public void setDailyHits(int dailyHits) {
097: this.dailyHits = dailyHits;
098: }
099:
100: }
|