1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.sun.syndication.feed.rss;
18
19 import com.sun.syndication.common.ObjectBean;
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 items of RSS feeds.
29 * <p>
30 * It handles all RSS versions without loosing information.
31 * <p>
32 * For RSS1.0 it supports Dublin Core and Syndication modules. Note that
33 * those modules currently support simple syntax format only.
34 * <p>
35 * @author Alejandro Abdelnur
36 *
37 */
38 public class Item extends ObjectBean {
39 private String _title;
40 private String _link;
41 private Description _description;
42 private Source _source;
43 private List _enclosures;
44 private List _categories;
45 private Guid _guid;
46 private String _comments;
47 private String _author;
48 private Date _pubDate;
49 private Date _expirationDate;
50 private List _modules;
51
52 /***
53 * Default constructor. All properties are set to <b>null</b>.
54 * <p>
55 *
56 */
57 public Item() {
58 super(Item.class);
59 }
60
61 /***
62 * Returns the item title.
63 * <p>
64 * @return the item title, <b>null</b> if none.
65 *
66 */
67 public String getTitle() {
68 return _title;
69 }
70
71 /***
72 * Sets the item title.
73 * <p>
74 * @param title the item title to set, <b>null</b> if none.
75 *
76 */
77 public void setTitle(String title) {
78 _title = title;
79 }
80
81 /***
82 * Returns the item link.
83 * <p>
84 * @return the item link, <b>null</b> if none.
85 *
86 */
87 public String getLink() {
88 return _link;
89 }
90
91 /***
92 * Sets the item link.
93 * <p>
94 * @param link the item link to set, <b>null</b> if none.
95 *
96 */
97 public void setLink(String link) {
98 _link = link;
99 }
100
101 /***
102 * Returns the item description.
103 * <p>
104 * @return the item description, <b>null</b> if none.
105 *
106 */
107 public Description getDescription() {
108 return _description;
109 }
110
111 /***
112 * Sets the item description.
113 * <p>
114 * @param description the item description to set, <b>null</b> if none.
115 *
116 */
117 public void setDescription(Description description) {
118 _description = description;
119 }
120
121 /***
122 * Returns the item source.
123 * <p>
124 * @return the item source, <b>null</b> if none.
125 *
126 */
127 public Source getSource() {
128 return _source;
129 }
130
131 /***
132 * Sets the item source.
133 * <p>
134 * @param source the item source to set, <b>null</b> if none.
135 *
136 */
137 public void setSource(Source source) {
138 _source = source;
139 }
140
141 /***
142 * Returns the item enclosures.
143 * <p>
144 * @return a list of Enclosure elements with the item enclosures,
145 * an empty list if none.
146 *
147 */
148 public List getEnclosures() {
149 return (_enclosures==null) ? (_enclosures=new ArrayList()) : _enclosures;
150 }
151
152 /***
153 * Sets the item enclosures.
154 * <p>
155 * @param enclosures the list of Enclosure elements with the item enclosures to set,
156 * an empty list or <b>null</b> if none.
157 *
158 */
159 public void setEnclosures(List enclosures) {
160 _enclosures = enclosures;
161 }
162
163 /***
164 * Returns the item categories.
165 * <p>
166 * @return a list of Category elements with the item categories,
167 * an empty list if none.
168 *
169 */
170 public List getCategories() {
171 return (_categories==null) ? (_categories=new ArrayList()) : _categories;
172 }
173
174 /***
175 * Sets the item categories.
176 * <p>
177 * @param categories the list of Categories elements with the item categories to set,
178 * an empty list or <b>null</b> if none.
179 *
180 */
181 public void setCategories(List categories) {
182 _categories = categories;
183 }
184
185 /***
186 * Returns the item GUID.
187 * <p>
188 * @return the item GUID, <b>null</b> if none.
189 *
190 */
191 public Guid getGuid() {
192 return _guid;
193 }
194
195 /***
196 * Sets the item GUID.
197 * <p>
198 * @param guid the item GUID to set, <b>null</b> if none.
199 *
200 */
201 public void setGuid(Guid guid) {
202 _guid = guid;
203 }
204
205 /***
206 * Returns the item comments.
207 * <p>
208 * @return the item comments, <b>null</b> if none.
209 *
210 */
211 public String getComments() {
212 return _comments;
213 }
214
215 /***
216 * Sets the item comments.
217 * <p>
218 * @param comments the item comments to set, <b>null</b> if none.
219 *
220 */
221 public void setComments(String comments) {
222 _comments = comments;
223 }
224
225 /***
226 * Returns the item author.
227 * <p>
228 * @return the item author, <b>null</b> if none.
229 *
230 */
231 public String getAuthor() {
232 return _author;
233 }
234
235 /***
236 * Sets the item author.
237 * <p>
238 * @param author the item author to set, <b>null</b> if none.
239 *
240 */
241 public void setAuthor(String author) {
242 _author = author;
243 }
244
245 /***
246 * Returns the item modules.
247 * <p>
248 * @return a list of ModuleImpl elements with the item modules,
249 * an empty list if none.
250 *
251 */
252 public List getModules() {
253 return (_modules==null) ? (_modules=new ArrayList()) : _modules;
254 }
255
256 /***
257 * Sets the item modules.
258 * <p>
259 * @param modules the list of ModuleImpl elements with the item modules to set,
260 * an empty list or <b>null</b> if none.
261 *
262 */
263 public void setModules(List modules) {
264 _modules = modules;
265 }
266
267 /***
268 * Returns the module identified by a given URI.
269 * <p>
270 * @param uri the URI of the ModuleImpl.
271 * @return The module with the given URI, <b>null</b> if none.
272 */
273 public Module getModule(String uri) {
274 return ModuleUtils.getModule(_modules,uri);
275 }
276
277
278 /***
279 * Returns the item publishing date.
280 * <p>
281 * @return the item publishing date, <b>null</b> if none.
282 *
283 */
284 public Date getPubDate() {
285 return _pubDate;
286 }
287
288 /***
289 * Sets the item publishing date.
290 * <p>
291 * @param pubDate the item publishing date to set, <b>null</b> if none.
292 *
293 */
294 public void setPubDate(Date pubDate) {
295 _pubDate = pubDate;
296 }
297
298 /***
299 * Returns the item expiration date.
300 * <p>
301 * @return the item expiration date, <b>null</b> if none.
302 *
303 */
304 public Date getExpirationDate() {
305 return _expirationDate;
306 }
307
308 /***
309 * Sets the item expiration date.
310 * <p>
311 * @param expirationDate the item expiration date to set, <b>null</b> if none.
312 *
313 */
314 public void setExpirationDate(Date expirationDate) {
315 _expirationDate = expirationDate;
316 }
317
318 }