KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > pojos > AutoPingData


1 /*
2  * Copyright (c) 2005
3  * Anil R. Gangolli. All rights reserved.
4  *
5  * Distributed with the Roller Weblogger under the terms of the Roller Software License
6  */

7
8 package org.roller.pojos;
9
10 import java.io.Serializable JavaDoc;
11
12 /**
13  * Automatic ping configuration. An instance of this class relates a website and ping target; it indicates that the specified
14  * ping target should be pinged when the corresponding website is changed. Pinging can be restricted to changes to
15  * specific categories on the website by instances of the {@link PingCategoryRestrictionData} object. In the absence of
16  * any category restrictions, the ping target is pinged whenever the corresponding website changes.
17  *
18  * @author Anil Gangolli anil@busybuddha.org
19  * @ejb:bean name="AutoPingData"
20  * @hibernate.class table="autoping"
21  */

22 public class AutoPingData extends PersistentObject implements Serializable JavaDoc
23 {
24     protected String JavaDoc id;
25     protected PingTargetData pingTarget;
26     protected WebsiteData website;
27
28     static final long serialVersionUID = -9105985454111986435L;
29     
30     /**
31      * Default constructor. Leaves all fields null. Required for bean compliance.
32      */

33     public AutoPingData()
34     {
35     }
36
37     /**
38      * Constructor.
39      *
40      * @param id unique id (primary key) for this instance
41      * @param pingtarget ping target that should be pinged
42      * @param website website to which this configuration applies
43      */

44     public AutoPingData(String JavaDoc id, PingTargetData pingtarget, WebsiteData website)
45     {
46         this.id = id;
47         this.website = website;
48         this.pingTarget = pingtarget;
49     }
50
51     /**
52      * Setter needed by RollerImpl.storePersistentObject()
53      */

54     public void setData(PersistentObject vo)
55     {
56         AutoPingData other = (AutoPingData)vo;
57         id = other.id;
58         website = other.website;
59         pingTarget = other.pingTarget;
60     }
61
62     /**
63      * Get the unique id (primary key) of this object.
64      *
65      * @return the unique id of this object. -- struts.validator type="required" msgkey="errors.required"
66      * @ejb:persistent-field
67      * @hibernate.id column="id" type="string" generator-class="uuid.hex" unsaved-value="null"
68      */

69     public String JavaDoc getId()
70     {
71         return id;
72     }
73
74     /**
75      * Set the unique id (primary key) of this object
76      *
77      * @param id
78      * @ejb:persistent-field
79      */

80     public void setId(String JavaDoc id)
81     {
82         this.id = id;
83     }
84
85     /**
86      * Get the website. Get the website whose changes should result in a ping to the ping target specified by this
87      * object.
88      *
89      * @return the website.
90      * @ejb:persistent-field
91      * @hibernate.many-to-one column="websiteid" cascade="none" not-null="false"
92      */

93     public WebsiteData getWebsite()
94     {
95         return website;
96     }
97
98     /**
99      * Set the website. Set the website whose changes should result in a ping to the ping target specified by this
100      * object.
101      *
102      * @param website the website.
103      * @ejb:persistent-field
104      */

105     public void setWebsite(WebsiteData website)
106     {
107         this.website = website;
108     }
109
110     /**
111      * Get the ping target. Get the target to be pinged when the corresponding website changes.
112      *
113      * @return the target to be pinged.
114      * @ejb:persistent-field
115      * @hibernate.many-to-one column="pingtargetid" cascade="none" not-null="false"
116      */

117     public PingTargetData getPingTarget()
118     {
119         return pingTarget;
120     }
121
122     /**
123      * Set the ping target. Set the target to be pinged when the corresponding website changes.
124      *
125      * @param pingtarget the target to be pinged.
126      * @ejb:persistent-field
127      */

128     public void setPingTarget(PingTargetData pingtarget)
129     {
130         this.pingTarget = pingtarget;
131     }
132
133     /**
134      * @see Object#equals(Object)
135      */

136     public boolean equals(Object JavaDoc o)
137     {
138         if (this == o) return true;
139         if (!(o instanceof AutoPingData)) return false;
140
141         final AutoPingData autoPingData = (AutoPingData)o;
142
143         if (id != null ? !id.equals(autoPingData.id) : autoPingData.id != null) return false;
144         if (pingTarget != null ? !pingTarget.equals(autoPingData.pingTarget) : autoPingData.pingTarget != null) return false;
145         if (website != null ? !website.equals(autoPingData.website) : autoPingData.website != null) return false;
146
147         return true;
148     }
149
150     /**
151      * @see Object#hashCode()
152      */

153     public int hashCode()
154     {
155         return (id != null ? id.hashCode() : 0);
156     }
157
158     /**
159      * Generate a string form of the object appropriate for logging or debugging.
160      * @return a string form of the object appropriate for logging or debugging.
161      * @see java.lang.Object#toString()
162      */

163     public String JavaDoc toString()
164     {
165         return "AutoPingData{" +
166             "id='" + id + "'" +
167             ", pingTarget=" + pingTarget +
168             ", website= " + (website == null ? "null" : "{id='" + website.getId() + "', user='" + website.getUser().getUserName() + "'} ") +
169             "}";
170     }
171 }
172
Popular Tags