KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. The ASF licenses this file to You
4  * under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License. For additional information regarding
15  * copyright in this work, please see the NOTICE file in the top level
16  * directory of this distribution.
17  */

18
19 package org.apache.roller.pojos;
20
21 import java.io.Serializable JavaDoc;
22
23 /**
24  * Automatic ping configuration. An instance of this class relates a website and ping target; it indicates that the specified
25  * ping target should be pinged when the corresponding website is changed. Pinging can be restricted to changes to
26  * specific categories on the website by instances of the {@link PingCategoryRestrictionData} object. In the absence of
27  * any category restrictions, the ping target is pinged whenever the corresponding website changes.
28  *
29  * @author <a HREF="mailto:anil@busybuddha.org">Anil Gangolli</a>
30  * @ejb:bean name="AutoPingData"
31  * @hibernate.class lazy="false" table="autoping"
32  * @hibernate.cache usage="read-write"
33  */

34 public class AutoPingData extends PersistentObject implements Serializable JavaDoc {
35     private String JavaDoc id = null;
36     private PingTargetData pingTarget = null;
37     private WebsiteData website = null;
38
39     public static final long serialVersionUID = -9105985454111986435L;
40
41     /**
42      * Default constructor. Leaves all fields null. Required for bean compliance.
43      */

44     public AutoPingData() {
45     }
46
47     /**
48      * Constructor.
49      *
50      * @param id unique id (primary key) for this instance
51      * @param pingtarget ping target that should be pinged
52      * @param website website to which this configuration applies
53      */

54     public AutoPingData(String JavaDoc id, PingTargetData pingtarget, WebsiteData website) {
55         this.id = id;
56         this.website = website;
57         this.pingTarget = pingtarget;
58     }
59
60     /**
61      * Setter needed by RollerImpl.storePersistentObject()
62      */

63     public void setData(PersistentObject vo) {
64         AutoPingData other = (AutoPingData) vo;
65
66         id = other.getId();
67         website = other.getWebsite();
68         pingTarget = other.getPingTarget();
69     }
70
71     /**
72      * Get the unique id (primary key) of this object.
73      *
74      * @return the unique id of this object. -- struts.validator type="required" msgkey="errors.required"
75      * @ejb:persistent-field
76      * @hibernate.id column="id" generator-class="uuid.hex" unsaved-value="null"
77      */

78     public String JavaDoc getId() {
79         return id;
80     }
81
82     /**
83      * Set the unique id (primary key) of this object
84      *
85      * @param id
86      * @ejb:persistent-field
87      */

88     public void setId(String JavaDoc id) {
89         this.id = id;
90     }
91
92     /**
93      * Get the website. Get the website whose changes should result in a ping to the ping target specified by this
94      * object.
95      *
96      * @return the website.
97      * @ejb:persistent-field
98      * @hibernate.many-to-one column="websiteid" cascade="none" not-null="false"
99      */

100     public WebsiteData getWebsite() {
101         return website;
102     }
103
104     /**
105      * Set the website. Set the website whose changes should result in a ping to the ping target specified by this
106      * object.
107      *
108      * @param website the website.
109      * @ejb:persistent-field
110      */

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

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

132     public void setPingTarget(PingTargetData pingtarget) {
133         this.pingTarget = pingtarget;
134     }
135
136     /**
137      * @see Object#equals(Object)
138      */

139     public boolean equals(Object JavaDoc o) {
140         if (this == o) return true;
141         if (!(o instanceof AutoPingData)) return false;
142
143         final AutoPingData autoPingData = (AutoPingData) o;
144
145         if (id != null ? !id.equals(autoPingData.getId()) : autoPingData.getId() != null) return false;
146         if (pingTarget != null ? !pingTarget.equals(autoPingData.getPingTarget()) : autoPingData.getPingTarget() != null)
147         {
148             return false;
149         }
150         if (website != null ? !website.equals(autoPingData.getWebsite()) : autoPingData.getWebsite() != null) {
151             return false;
152         }
153
154         return true;
155     }
156
157     /**
158      * @see Object#hashCode()
159      */

160     public int hashCode() {
161         return (id != null ? id.hashCode() : 0);
162     }
163
164     /**
165      * Generate a string form of the object appropriate for logging or debugging.
166      *
167      * @return a string form of the object appropriate for logging or debugging.
168      * @see Object#toString()
169      */

170     public String JavaDoc toString() {
171         return "AutoPingData{" + "id='" + id + "'" + ", pingTarget=" + pingTarget + ", website= " + (website == null ? "null" : "{id='" + website.getId() + "'} ") + "}";
172     }
173 }
174
Popular Tags