KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Ping Category Restriction. An instance of this class relates an auto ping configuration {@link AutoPingData} to a
25  * specific weblog category {@link WeblogCategoryData}. When one or more instances of this class are present for a
26  * given auto ping configuration, it means that pings should only go out for changes to the categories specified by those
27  * instances. If no instances of this class are present for a given auto ping configuration, it means that the ping
28  * configuration is not restricted by category, so pings should go out for changes in any category.
29  *
30  * @author <a HREF="mailto:anil@busybuddha.org">Anil Gangolli</a>
31  * @ejb:bean name="AutoPingData"
32  * @hibernate.class lazy="false" table="pingcategory"
33  * @hibernate.cache usage="read-write"
34  */

35 public class PingCategoryRestrictionData extends PersistentObject implements Serializable JavaDoc {
36     private String JavaDoc id;
37     private AutoPingData autoPing;
38     private WeblogCategoryData weblogCategory;
39
40     static final long serialVersionUID = 2261280579491859418L;
41
42     /**
43      * Default constructor. Leaves all fields null. Required for bean compliance.
44      */

45     public PingCategoryRestrictionData() {
46     }
47
48     /**
49      * Constructor
50      *
51      * @param id unique id of this object
52      * @param autoPing auto ping configuration being restricted
53      * @param weblogCategory weblog category to which this auto ping configuration is restricted
54      */

55     public PingCategoryRestrictionData(String JavaDoc id, AutoPingData autoPing, WeblogCategoryData weblogCategory) {
56         this.id = id;
57         this.autoPing = autoPing;
58         this.weblogCategory = weblogCategory;
59     }
60
61     /**
62      * Setter needed by RollerImpl.storePersistentObject()
63      */

64     public void setData(PersistentObject vo) {
65         PingCategoryRestrictionData other = (PingCategoryRestrictionData) vo;
66         id = other.getId();
67         autoPing = other.getAutoping();
68         weblogCategory = other.getWeblogCategory();
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 auto ping configuration to which this category restriction applies.
94      *
95      * @return the auto ping configuration to which this category restriction applies.
96      * @ejb:persistent-field
97      * @hibernate.many-to-one column="autopingid" cascade="none" not-null="true"
98      */

99     public AutoPingData getAutoping() {
100         return autoPing;
101     }
102
103     /**
104      * Set the auto ping configuration to which this category restriction applies.
105      *
106      * @param autoPing the auto ping configuration to which this category restriction applies.
107      * @ejb:persistent-field
108      */

109     public void setAutoping(AutoPingData autoPing) {
110         this.autoPing = autoPing;
111     }
112
113     /**
114      * Get the weblog category. Get the weblog category to which pings should be restricted.
115      *
116      * @return the weblog category to which pings should be restricted.
117      * @ejb:persistent-field
118      * @hibernate.many-to-one column="weblogcategoryid" cascade="none" not-null="true"
119      */

120     public WeblogCategoryData getWeblogCategory() {
121         return weblogCategory;
122     }
123
124     /**
125      * Set the ping target. Set the target to be pinged when the corresponding website changes.
126      *
127      * @param weblogCategory the weblog category to which pings should be restricted.
128      * @ejb:persistent-field
129      */

130     public void setWeblogCategory(WeblogCategoryData weblogCategory) {
131         this.weblogCategory = weblogCategory;
132     }
133
134     /**
135      * @see Object#equals(Object)
136      */

137     public boolean equals(Object JavaDoc o) {
138         if (this == o) return true;
139         if (!(o instanceof PingCategoryRestrictionData)) return false;
140
141         final PingCategoryRestrictionData pingCategoryRestrictionData = (PingCategoryRestrictionData) o;
142
143         if (id != null ? !id.equals(pingCategoryRestrictionData.getId()) : pingCategoryRestrictionData.getId() != null)
144         {
145             return false;
146         }
147         if (autoPing != null ? !autoPing.equals(pingCategoryRestrictionData.getAutoping()) : pingCategoryRestrictionData.getAutoping() != null)
148         {
149             return false;
150         }
151         if (weblogCategory != null ? !weblogCategory.equals(pingCategoryRestrictionData.getWeblogCategory()) : pingCategoryRestrictionData.getWeblogCategory() != null)
152         {
153             return false;
154         }
155
156         return true;
157     }
158
159     /**
160      * @see Object#hashCode()
161      */

162     public int hashCode() {
163         return (id != null ? id.hashCode() : 0);
164     }
165 }
Popular Tags