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