001: //$Id: RSSItem.java,v 1.6 2004/03/25 10:09:10 taganaka Exp $
002: package org.gnu.stealthp.rsslib;
003:
004: import java.net.URL;
005: import java.util.Date;
006:
007: /**
008: * RSSItems's definitions class.
009: *
010: * <blockquote>
011: * <em>This module, both source code and documentation, is in the
012: * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
013: * </blockquote>
014: *
015: * @since RSSLIB4J 0.1
016: * @author Francesco aka 'Stealthp' stealthp[@]stealthp.org
017: * @version 0.2
018: */
019:
020: public class RSSItem extends RSSObject {
021:
022: private String date;
023: private String auth;
024: private String comm;
025:
026: /**
027: * Get the date
028: * @return the date as string
029: */
030: public String getDate() {
031: if (super .getDoublinCoreElements() == null) {
032: if (super .getPubDate() == null) {
033: date = null;
034: return null;
035: } else {
036: date = super .getPubDate();
037: return date;
038: }
039: } else {
040: date = (String) super .getDoublinCoreElements().get(
041: RSSHandler.DC_DATE_TAG);
042: return date;
043: }
044: }
045:
046: /**
047: * Set the date of the item
048: * @param d the date
049: */
050: public void setDate(String d) {
051: date = d;
052: if (super .getDoublinCoreElements() != null) {
053: if (super .getDoublinCoreElements().containsKey(
054: RSSHandler.DC_DATE_TAG)) {
055: super .addDoublinCoreElement(RSSHandler.DC_DATE_TAG, d);
056: } else {
057: if (super .getPubDate() != null)
058: super .setPubDate(d);
059: date = d;
060: }
061: }
062: date = d;
063: }
064:
065: /**
066: * Set the item's author
067: * @param author Email address of the author of the item.
068: */
069: public void setAuthor(String author) {
070: auth = author;
071: }
072:
073: /**
074: * Set the item's comment
075: * @param comment URL of a page for comments relating to the item
076: */
077: public void setComments(String comment) {
078: comm = comment;
079: }
080:
081: /**
082: * Get the comments url
083: * @return comments url (optional)
084: */
085: public String getComments() {
086: return comm;
087: }
088:
089: /**
090: * Get the item's author
091: * @return author (optional)
092: */
093: public String getAuthor() {
094: return auth;
095: }
096:
097: /**
098: * Useful for debug
099: * @return the info string
100: */
101: public String toString() {
102: String info = "ABOUT ATTRIBUTE: " + about + "\n" + "TITLE: "
103: + title + "\n" + "LINK: " + link + "\n"
104: + "DESCRIPTION: " + description + "\n" + "DATE: "
105: + getDate();
106: return info;
107: }
108:
109: }
|