KickJava   Java API By Example, From Geeks To Geeks.

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


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

8
9 package org.roller.pojos;
10
11 import java.io.Serializable JavaDoc;
12
13 /**
14  * Ping Category Restriction. An instance of this class relates an auto ping configuration {@link AutoPingData} to a
15  * specific weblog category {@link WeblogCategoryData}. When one or more instances of this class are present for a
16  * given auto ping configuration, it means that pings should only go out for changes to the categories specified by those
17  * instances. If no instances of this class are present for a given auto ping configuration, it means that the ping
18  * configuration is not restricted by category, so pings should go out for changes in any category.
19  *
20  * @author Anil Gangolli anil@busybuddha.org
21  * @ejb:bean name="AutoPingData"
22  * @hibernate.class table="pingcategory"
23  */

24 public class PingCategoryRestrictionData extends PersistentObject implements Serializable JavaDoc
25 {
26     protected String JavaDoc id;
27     protected AutoPingData autoPing;
28     protected WeblogCategoryData weblogCategory;
29
30     static final long serialVersionUID = 2261280579491859418L;
31
32     /**
33      * Default constructor. Leaves all fields null. Required for bean compliance.
34      */

35     public PingCategoryRestrictionData()
36     {
37     }
38
39     /**
40      * Constructor
41      *
42      * @param id unique id of this object
43      * @param autoPing auto ping configuration being restricted
44      * @param weblogCategory weblog category to which this auto ping configuration is restricted
45      */

46     public PingCategoryRestrictionData(String JavaDoc id, AutoPingData autoPing, WeblogCategoryData weblogCategory)
47     {
48         this.id = id;
49         this.autoPing = autoPing;
50         this.weblogCategory = weblogCategory;
51     }
52
53     /**
54      * Setter needed by RollerImpl.storePersistentObject()
55      */

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

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

82     public void setId(String JavaDoc id)
83     {
84         this.id = id;
85     }
86
87     /**
88      * Get the auto ping configuration to which this category restriction applies.
89      *
90      * @return the auto ping configuration to which this category restriction applies.
91      * @ejb:persistent-field
92      * @hibernate.many-to-one column="autopingid" cascade="none" not-null="true"
93      */

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

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

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

128     public void setWeblogCategory(WeblogCategoryData weblogCategory)
129     {
130         this.weblogCategory = weblogCategory;
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 PingCategoryRestrictionData)) return false;
140
141         final PingCategoryRestrictionData pingCategoryRestrictionData = (PingCategoryRestrictionData)o;
142
143         if (id != null ? !id.equals(pingCategoryRestrictionData.id) : pingCategoryRestrictionData.id != null) return false;
144         if (autoPing != null ? !autoPing.equals(pingCategoryRestrictionData.autoPing) : pingCategoryRestrictionData.autoPing != null) return false;
145         if (weblogCategory != null ? !weblogCategory.equals(pingCategoryRestrictionData.weblogCategory) : pingCategoryRestrictionData.weblogCategory != 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 }
Popular Tags