001: /**
002: * RSS framework and reader
003: * Copyright (C) 2004 Christian Robert
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */package org.jperdian.rss2.dom;
019:
020: import java.io.Serializable;
021: import java.net.URL;
022: import java.util.ArrayList;
023: import java.util.Date;
024: import java.util.List;
025:
026: /**
027: * Implementation of an RSS <tt>item</tt> that contains the actual message
028: * text
029: *
030: * @author Christian Robert
031: */
032:
033: public class RssItem implements Serializable {
034:
035: private String myTitle = "";
036: private URL myLink = null;
037: private String myDescription = "";
038: private String myStrippedDescription = "";
039: private String myAuthor = "";
040: private List myCategoryList = new ArrayList();
041: private String myComments = null;
042: private RssEnclosure myEnclosure = null;
043: private RssGuid myGuid = null;
044: private Date myPubDate = null;
045: private RssChannel mySource = null;
046:
047: // --------------------------------------------------------------------------
048: // -- Property access methods ---------------------------------------------
049: // --------------------------------------------------------------------------
050:
051: public String getAuthor() {
052: return this .myAuthor;
053: }
054:
055: public void setAuthor(String author) {
056: this .myAuthor = author;
057: }
058:
059: public void addCategory(String category) {
060: this .getCategoryList().add(category);
061: }
062:
063: public List getCategoryList() {
064: return this .myCategoryList;
065: }
066:
067: public void setCategoryList(List list) {
068: this .myCategoryList = list;
069: }
070:
071: public String getComments() {
072: return this .myComments;
073: }
074:
075: public void setComments(String comments) {
076: this .myComments = comments;
077: }
078:
079: public String getDescription() {
080: return this .myDescription;
081: }
082:
083: public String getStrippedDescription() {
084: return this .myStrippedDescription;
085: }
086:
087: public void setDescription(String description) {
088: this .myDescription = description;
089: this .myStrippedDescription = description.trim();
090:
091: int start = myStrippedDescription.indexOf('<');
092: while (start >= 0) {
093: int end = myStrippedDescription.indexOf('>', start);
094: if (end < 0)
095: break;
096:
097: myStrippedDescription = myStrippedDescription.substring(0,
098: start)
099: + myStrippedDescription.substring(end + 1);
100: start = myStrippedDescription.indexOf('<');
101: }
102: }
103:
104: public RssEnclosure getEnclosure() {
105: return this .myEnclosure;
106: }
107:
108: public void setEnclosure(RssEnclosure enclosure) {
109: this .myEnclosure = enclosure;
110: }
111:
112: public RssGuid getGuid() {
113: return this .myGuid;
114: }
115:
116: public void setGuid(RssGuid guid) {
117: this .myGuid = guid;
118: }
119:
120: public URL getLink() {
121: return myLink;
122: }
123:
124: public void setLink(URL link) {
125: this .myLink = link;
126: }
127:
128: public Date getPubDate() {
129: return this .myPubDate;
130: }
131:
132: public void setPubDate(Date pubDate) {
133: this .myPubDate = pubDate;
134: }
135:
136: public RssChannel getSource() {
137: return this .mySource;
138: }
139:
140: public void setSource(RssChannel source) {
141: this .mySource = source;
142: }
143:
144: public String getTitle() {
145: return this .myTitle;
146: }
147:
148: public void setTitle(String title) {
149: this.myTitle = title;
150: }
151: }
|