KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 2005 Sun Microsystems, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not 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.
15  */

16 package org.apache.roller.pojos;
17
18 import java.io.Serializable JavaDoc;
19 import java.util.ArrayList JavaDoc;
20 import java.util.Collection JavaDoc;
21 import java.util.Date JavaDoc;
22 import java.util.List JavaDoc;
23
24 /**
25  * @struts.form include-all="true"
26  * @ejb:bean name="PlanetSubscriptionData"
27  * @hibernate.class lazy="false" table="rag_subscription"
28  */

29 public class PlanetSubscriptionData extends PersistentObject
30     implements Serializable JavaDoc, Comparable JavaDoc
31 {
32     /** Database ID */
33     protected String JavaDoc id;
34     
35     /** Title of the blog or website */
36     protected String JavaDoc title;
37     
38     /** Name of blog or website author */
39     protected String JavaDoc author;
40     
41     /** URL of the newsfeed */
42     protected String JavaDoc feedUrl;
43     
44     /** URL of the blog or website */
45     protected String JavaDoc siteUrl;
46     
47     /** Last update time of site */
48     protected Date JavaDoc lastUpdated;
49     
50     /** Most recent entries from site (a set of EntityData objects) */
51     protected List JavaDoc entries = new ArrayList JavaDoc();
52     
53     /** Inbound links according to Technorati */
54     protected int inboundlinks = 0;
55
56     /** Inbound blogs according to Technorati */
57     protected int inboundblogs = 0;
58     
59     protected List JavaDoc groupAssocs = new ArrayList JavaDoc();
60     
61     //----------------------------------------------------------- persistent fields
62

63     /**
64      * @hibernate.bag lazy="true" inverse="true" cascade="delete"
65      * @hibernate.collection-key column="subscription_id"
66      * @hibernate.collection-one-to-many
67      * class="org.apache.roller.pojos.PlanetGroupSubscriptionAssoc"
68      */

69     public List JavaDoc getGroupSubscriptionAssocs()
70     {
71         return groupAssocs;
72     }
73     public void setGroupSubscriptionAssocs(List JavaDoc groupAssocs)
74     {
75         this.groupAssocs = groupAssocs;
76     }
77
78     /**
79      * @hibernate.id column="id"
80      * generator-class="uuid.hex" unsaved-value="null"
81      * @roller.wrapPojoMethod type="simple"
82      */

83     public String JavaDoc getId()
84     {
85         return id;
86     }
87     public void setId(String JavaDoc id)
88     {
89         this.id = id;
90     }
91     /**
92      * @hibernate.bag lazy="true" inverse="true" cascade="all-delete-orphan"
93      * @hibernate.collection-key column="subscription_id"
94      * @hibernate.collection-one-to-many class="org.apache.roller.pojos.PlanetEntryData"
95      */

96     public List JavaDoc getEntries()
97     {
98         return entries;
99     }
100     private void setEntries(List JavaDoc entries)
101     {
102         this.entries = entries;
103     }
104     /**
105      * @hibernate.property column="feed_url" non-null="true" unique="false"
106      * @roller.wrapPojoMethod type="simple"
107      */

108     public String JavaDoc getFeedURL()
109     {
110         return feedUrl;
111     }
112     public void setFeedURL(String JavaDoc feedUrl)
113     {
114         this.feedUrl = feedUrl;
115     }
116     /**
117      * @hibernate.property column="last_updated" non-null="false" unique="false"
118      * @roller.wrapPojoMethod type="simple"
119      */

120     public Date JavaDoc getLastUpdated()
121     {
122         return lastUpdated;
123     }
124     public void setLastUpdated(Date JavaDoc lastUpdated)
125     {
126         this.lastUpdated = lastUpdated;
127     }
128     /**
129      * @hibernate.property column="site_url" non-null="false" unique="false"
130      * @roller.wrapPojoMethod type="simple"
131      */

132     public String JavaDoc getSiteURL()
133     {
134         return siteUrl;
135     }
136     public void setSiteURL(String JavaDoc siteUrl)
137     {
138         this.siteUrl = siteUrl;
139     }
140     /**
141      * @hibernate.property column="title" non-null="false" unique="false"
142      * @roller.wrapPojoMethod type="simple"
143      */

144     public String JavaDoc getTitle()
145     {
146         return title;
147     }
148     public void setTitle(String JavaDoc title)
149     {
150         this.title = title;
151     }
152     /**
153      * @hibernate.property column="author" non-null="false" unique="false"
154      * @roller.wrapPojoMethod type="simple"
155      */

156     public String JavaDoc getAuthor()
157     {
158         return author;
159     }
160     public void setAuthor(String JavaDoc author)
161     {
162         this.author = author;
163     }
164     /**
165      * @hibernate.property column="inbound_links" non-null="false" unique="false"
166      * @roller.wrapPojoMethod type="simple"
167      */

168     public int getInboundlinks()
169     {
170         return inboundlinks;
171     }
172     public void setInboundlinks(int inboundlinks)
173     {
174         this.inboundlinks = inboundlinks;
175     }
176     /**
177      * @hibernate.property column="inbound_blogs" non-null="false" unique="false"
178      * @roller.wrapPojoMethod type="simple"
179      */

180     public int getInboundblogs()
181     {
182         return inboundblogs;
183     }
184     public void setInboundblogs(int inboundblogs)
185     {
186         this.inboundblogs = inboundblogs;
187     }
188
189     /**
190      * @roller.wrapPojoMethod type="simple"
191      */

192     public String JavaDoc getName() {
193         return title;
194     }
195     public void setName(String JavaDoc name) {
196         // no op to please XDoclet
197
}
198     /**
199      * @roller.wrapPojoMethod type="simple"
200      */

201     public String JavaDoc getURL() {
202         return siteUrl;
203     }
204     public void setURL(String JavaDoc url) {
205         // no op to please XDoclet
206
}
207     
208     //-------------------------------------------------------------- implementation
209

210     /**
211      */

212     public void setData(PersistentObject vo)
213     {
214         // TODO Auto-generated method stub
215
}
216     /**
217      */

218     public int compareTo(Object JavaDoc o)
219     {
220         PlanetSubscriptionData other = (PlanetSubscriptionData)o;
221         return getFeedURL().compareTo(other.getFeedURL());
222     }
223
224     public boolean equals(Object JavaDoc other) {
225         
226         if(this == other) return true;
227         if(!(other instanceof PlanetSubscriptionData)) return false;
228         
229         final PlanetSubscriptionData that = (PlanetSubscriptionData) other;
230         return this.feedUrl.equals(that.getFeedURL());
231     }
232     
233     public int hashCode() {
234         return this.feedUrl.hashCode();
235     }
236     
237     public void addEntry(PlanetEntryData entry)
238     {
239         this.getEntries().add(entry);
240     }
241     
242     public void addEntries(Collection JavaDoc newEntries)
243     {
244         this.getEntries().addAll(newEntries);
245     }
246     
247     public void purgeEntries()
248     {
249         this.getEntries().clear();
250     }
251 }
252
Popular Tags