KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jperdian > rss2 > dom > RssItem


1 /**
2  * RSS framework and reader
3  * Copyright (C) 2004 Christian Robert
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package org.jperdian.rss2.dom;
21
22 import java.io.Serializable JavaDoc;
23 import java.net.URL JavaDoc;
24 import java.util.ArrayList JavaDoc;
25 import java.util.Date JavaDoc;
26 import java.util.List JavaDoc;
27
28 /**
29  * Implementation of an RSS <tt>item</tt> that contains the actual message
30  * text
31  *
32  * @author Christian Robert
33  */

34
35 public class RssItem implements Serializable JavaDoc {
36
37   private String JavaDoc myTitle = "";
38   private URL JavaDoc myLink = null;
39   private String JavaDoc myDescription = "";
40   private String JavaDoc myStrippedDescription = "";
41   private String JavaDoc myAuthor = "";
42   private List JavaDoc myCategoryList = new ArrayList JavaDoc();
43   private String JavaDoc myComments = null;
44   private RssEnclosure myEnclosure = null;
45   private RssGuid myGuid = null;
46   private Date JavaDoc myPubDate = null;
47   private RssChannel mySource = null;
48   
49   
50   // --------------------------------------------------------------------------
51
// -- Property access methods ---------------------------------------------
52
// --------------------------------------------------------------------------
53

54   public String JavaDoc getAuthor() {
55     return this.myAuthor;
56   }
57
58   public void setAuthor(String JavaDoc author) {
59     this.myAuthor = author;
60   }
61
62   public void addCategory(String JavaDoc category) {
63     this.getCategoryList().add(category);
64   }
65   
66   public List JavaDoc getCategoryList() {
67     return this.myCategoryList;
68   }
69
70   public void setCategoryList(List JavaDoc list) {
71     this.myCategoryList = list;
72   }
73
74   public String JavaDoc getComments() {
75     return this.myComments;
76   }
77
78   public void setComments(String JavaDoc comments) {
79     this.myComments = comments;
80   }
81
82   public String JavaDoc getDescription() {
83     return this.myDescription;
84   }
85
86   public String JavaDoc getStrippedDescription() {
87     return this.myStrippedDescription;
88   }
89   
90   public void setDescription(String JavaDoc description) {
91     this.myDescription = description;
92     this.myStrippedDescription = description.trim();
93     
94     int start = myStrippedDescription.indexOf('<');
95     while(start >= 0)
96     {
97         int end = myStrippedDescription.indexOf('>', start);
98         if(end < 0)
99             break;
100         
101         myStrippedDescription = myStrippedDescription.substring(0, start)
102             + myStrippedDescription.substring(end+1);
103         start = myStrippedDescription.indexOf('<');
104     }
105   }
106
107   public RssEnclosure getEnclosure() {
108     return this.myEnclosure;
109   }
110
111   public void setEnclosure(RssEnclosure enclosure) {
112     this.myEnclosure = enclosure;
113   }
114
115   public RssGuid getGuid() {
116     return this.myGuid;
117   }
118
119   public void setGuid(RssGuid guid) {
120     this.myGuid = guid;
121   }
122
123   public URL JavaDoc getLink() {
124     return myLink;
125   }
126
127   public void setLink(URL JavaDoc link) {
128     this.myLink = link;
129   }
130
131   public Date JavaDoc getPubDate() {
132     return this.myPubDate;
133   }
134
135   public void setPubDate(Date JavaDoc pubDate) {
136     this.myPubDate = pubDate;
137   }
138
139   public RssChannel getSource() {
140     return this.mySource;
141   }
142
143   public void setSource(RssChannel source) {
144     this.mySource = source;
145   }
146
147   public String JavaDoc getTitle() {
148     return this.myTitle;
149   }
150
151   public void setTitle(String JavaDoc title) {
152     this.myTitle = title;
153   }
154 }
Popular Tags