1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.feed.atom;
18
19 import com.sun.syndication.feed.WireFeed;
20 import com.sun.syndication.feed.module.Module;
21 import com.sun.syndication.feed.module.impl.ModuleUtils;
22
23 import java.util.ArrayList;
24 import java.util.Date;
25 import java.util.List;
26
27 /***
28 * Bean for Atom feeds.
29 * <p>
30 * It handles Atom feeds version 0.3 without loosing any feed information.
31 * <p>
32 * @author Alejandro Abdelnur
33 *
34 */
35 public class Feed extends WireFeed {
36 private String _language;
37 private String _title;
38 private List _alternateLinks;
39 private List _otherLinks;
40 private Person _author;
41 private List _contributors;
42 private Content _tagline;
43 private String _id;
44 private Generator _generator;
45 private String _copyright;
46 private Content _info;
47 private Date _modified;
48 private List _entries;
49 private List _modules;
50
51 /***
52 * Default constructor, for bean cloning purposes only.
53 *
54 */
55 public Feed() {
56 }
57
58 /***
59 * Feed Constructor. All properties, except the type, are set to <b>null</b>.
60 * <p>
61 * @param type the type of the Atom feed.
62 *
63 */
64 public Feed(String type) {
65 super(type);
66 }
67
68 /***
69 * Returns the feed language.
70 * <p>
71 * @return the feed language, <b>null</b> if none.
72 *
73 */
74 public String getLanguage() {
75 return _language;
76 }
77
78 /***
79 * Sets the feed language.
80 * <p>
81 * @param language the feed language to set, <b>null</b> if none.
82 *
83 */
84 public void setLanguage(String language) {
85 _language = language;
86 }
87
88 /***
89 * Returns the feed title.
90 * <p>
91 * @return the feed title, <b>null</b> if none.
92 *
93 */
94 public String getTitle() {
95 return _title;
96 }
97
98 /***
99 * Sets the feed title.
100 * <p>
101 * @param title the feed title to set, <b>null</b> if none.
102 *
103 */
104 public void setTitle(String title) {
105 _title = title;
106 }
107
108 /***
109 * Returns the feed alternate links.
110 * <p>
111 * @return a list of Link elements with the feed alternate links,
112 * an empty list if none.
113 *
114 */
115 public List getAlternateLinks() {
116 return (_alternateLinks==null) ? (_alternateLinks=new ArrayList()) : _alternateLinks;
117 }
118
119 /***
120 * Sets the feed alternate links.
121 * <p>
122 * @param alternateLinks the list of Link elements with the feed alternate links to set,
123 * an empty list or <b>null</b> if none.
124 *
125 */
126 public void setAlternateLinks(List alternateLinks) {
127 _alternateLinks = alternateLinks;
128 }
129
130 /***
131 * Returns the feed other links (non-alternate ones).
132 * <p>
133 * @return a list of Link elements with the feed other links (non-alternate ones),
134 * an empty list if none.
135 *
136 */
137 public List getOtherLinks() {
138 return (_otherLinks==null) ? (_otherLinks=new ArrayList()) : _otherLinks;
139 }
140
141 /***
142 * Sets the feed other links (non-alternate ones).
143 * <p>
144 * @param otherLinks the list of Link elements with the feed other links (non-alternate ones) to set,
145 * an empty list or <b>null</b> if none.
146 *
147 */
148 public void setOtherLinks(List otherLinks) {
149 _otherLinks = otherLinks;
150 }
151
152 /***
153 * Returns the feed author.
154 * <p>
155 * @return the feed author, <b>null</b> if none.
156 *
157 */
158 public Person getAuthor() {
159 return _author;
160 }
161
162 /***
163 * Sets the feed author.
164 * <p>
165 * @param author the feed author to set, <b>null</b> if none.
166 *
167 */
168 public void setAuthor(Person author) {
169 _author = author;
170 }
171
172 /***
173 * Returns the feed contributors.
174 * <p>
175 * @return a list of Person elements with the feed contributors,
176 * an empty list if none.
177 *
178 */
179 public List getContributors() {
180 return (_contributors==null) ? (_contributors=new ArrayList()) : _contributors;
181 }
182
183 /***
184 * Sets the feed contributors.
185 * <p>
186 * @param contributors the list of Person elements with the feed contributors to set,
187 * an empty list or <b>null</b> if none.
188 *
189 */
190 public void setContributors(List contributors) {
191 _contributors = contributors;
192 }
193
194 /***
195 * Returns the feed tag line.
196 * <p>
197 * @return the feed tag line, <b>null</b> if none.
198 *
199 */
200 public Content getTagline() {
201 return _tagline;
202 }
203
204 /***
205 * Sets the feed tagline.
206 * <p>
207 * @param tagline the feed tagline to set, <b>null</b> if none.
208 *
209 */
210 public void setTagline(Content tagline) {
211 _tagline = tagline;
212 }
213
214 /***
215 * Returns the feed ID.
216 * <p>
217 * @return the feed ID, <b>null</b> if none.
218 *
219 */
220 public String getId() {
221 return _id;
222 }
223
224 /***
225 * Sets the feed ID.
226 * <p>
227 * @param id the feed ID to set, <b>null</b> if none.
228 *
229 */
230 public void setId(String id) {
231 _id = id;
232 }
233
234 /***
235 * Returns the feed generator.
236 * <p>
237 * @return the feed generator, <b>null</b> if none.
238 *
239 */
240 public Generator getGenerator() {
241 return _generator;
242 }
243
244 /***
245 * Sets the feed generator.
246 * <p>
247 * @param generator the feed generator to set, <b>null</b> if none.
248 *
249 */
250 public void setGenerator(Generator generator) {
251 _generator = generator;
252 }
253
254 /***
255 * Returns the feed copyright.
256 * <p>
257 * @return the feed copyright, <b>null</b> if none.
258 *
259 */
260 public String getCopyright() {
261 return _copyright;
262 }
263
264 /***
265 * Sets the feed copyright.
266 * <p>
267 * @param copyright the feed copyright to set, <b>null</b> if none.
268 *
269 */
270 public void setCopyright(String copyright) {
271 _copyright = copyright;
272 }
273
274 /***
275 * Returns the feed info.
276 * <p>
277 * @return the feed info, <b>null</b> if none.
278 *
279 */
280 public Content getInfo() {
281 return _info;
282 }
283
284 /***
285 * Sets the feed info.
286 * <p>
287 * @param info the feed info to set, <b>null</b> if none.
288 *
289 */
290 public void setInfo(Content info) {
291 _info = info;
292 }
293
294 /***
295 * Returns the feed modified date.
296 * <p>
297 * @return the feed modified date, <b>null</b> if none.
298 *
299 */
300 public Date getModified() {
301 return _modified;
302 }
303
304 /***
305 * Sets the feed modified date.
306 * <p>
307 * @param modified the feed modified date to set, <b>null</b> if none.
308 *
309 */
310 public void setModified(Date modified) {
311 _modified = modified;
312 }
313
314 /***
315 * Returns the feed entries.
316 * <p>
317 * @return a list of Entry elements with the feed entries,
318 * an empty list if none.
319 *
320 */
321 public List getEntries() {
322 return (_entries==null) ? (_entries=new ArrayList()) : _entries;
323 }
324
325 /***
326 * Sets the feed entries.
327 * <p>
328 * @param entries the list of Entry elements with the feed entries to set,
329 * an empty list or <b>null</b> if none.
330 *
331 */
332 public void setEntries(List entries) {
333 _entries = entries;
334 }
335
336 /***
337 * Returns the feed modules.
338 * <p>
339 * @return a list of ModuleImpl elements with the feed modules,
340 * an empty list if none.
341 *
342 */
343 public List getModules() {
344 return (_modules==null) ? (_modules=new ArrayList()) : _modules;
345 }
346
347 /***
348 * Sets the feed moduless.
349 * <p>
350 * @param modules the list of ModuleImpl elements with the feed moduless to set,
351 * an empty list or <b>null</b> if none.
352 *
353 */
354 public void setModules(List modules) {
355 _modules = modules;
356 }
357
358 /***
359 * Returns the module identified by a given URI.
360 * <p>
361 * @param uri the URI of the ModuleImpl.
362 * @return The module with the given URI, <b>null</b> if none.
363 */
364 public Module getModule(String uri) {
365 return ModuleUtils.getModule(_modules,uri);
366 }
367
368
369 }
370