net.sourceforge.rssowl.model
Class NewsItem

java.lang.Object
  extended bynet.sourceforge.rssowl.model.NewsItem

public class NewsItem
extends Object

Model for a NewsItem. A Channel may contain more than one item.

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
private  String author
           
private  String category
           
private  Vector comments
           
private  String description
           
private  Vector enclosures
           
private  String guid
           
private  Vector highlightWords
          Vector holding all words that should be highlighted
private  boolean isPartOfAggregation
           
private  boolean isRead
          TRUE if the user has read this news
private  String link
           
private  Vector linkList
          Vector holding all links from the text
private static int MAX_TITLE_LENGTH
          Max. number of characters for the title if description is used as title
private  String newsfeedTitle
          Title of the feed this news is from
private  String newsfeedXmlUrl
          URL of the RSS from where this news is
private  String origurl
          Set by AmphetaRate for feed XML included in news
private  boolean permaLink
           
private  String pubDate
           
private  Date pubDateParsed
           
private  String publisher
           
private  String source
           
private  String title
          Attributes describing the news item
private  boolean updateNewsView
          Flag to force an update when viewing
 
Constructor Summary
NewsItem()
          Instantiate a new NewsItem
NewsItem(boolean isPartOfAggregation)
          Instantiate a new NewsItem
 
Method Summary
 void addComment(String comment)
          Add a comment to the NewsItem.
 void clearHighlightWords()
          Clear the Vector that contains the highlight words for a search.
 void clone(NewsItem newsItem)
          Clone settings from this newsitem into the given one
 String getAuthor()
          Get the author
 String getCategory()
          Get the category
 Vector getComments()
          Get Vector holding all comments
 String getDescription()
          Get the description
 Vector getEnclosures()
          Get a Vector holding all enclosures
 String getGuid()
          Get the GUID
 Vector getHighlightWords()
          Get highlighted words
 String getLink()
          Get the link
 Vector getLinkList()
          Get the Link List
 String getNewsfeedTitle()
          Get the news feed title
 String getNewsfeedXmlUrl()
          Get the newsfeed XML URL
 String getOrigurl()
          Get the feed XML url from the newstext
 String getPubDate()
          Get the publish date
 Date getPubDateParsed()
          Get the parsed publish Date
 String getPublisher()
          Get the publisher
 boolean getRequiresViewUpdate()
          Check if this newsitem was marked to require an update in the view.
 String getSafeXMLFeedUrl()
          Get the URL of the XML feed this news item is in.
 String getSource()
          Get the source
 String getTitle()
          Get the title
 void insertEnclosure(Enclosure rssEnclosure)
          Add an enclosure to the news item and parse for links
 void insertHighlightWord(String word)
          Insert a word to highlight
 boolean isPartOfAggregation()
          Check wether this NewsItem is part of an Category Aggregation.
 boolean isPermaLink()
          This field is TRUE if the link set in the guid tag is a permanent link
 boolean isRead()
          Get state of isRead
private  void parseForLinks(String text)
          Parse the text for links
 boolean sameAs(NewsItem newsItem)
          Lazy check if the given NewsItem is equal to the called one
 void setAuthor(String author)
          Set the author
 void setCategory(String category)
          Set the category
 void setDescription(String description)
          Set the description and parse for links
 void setGuid(String guid)
          Set the GUID
 void setLink(String link)
          Set the link
 void setNewsfeedTitle(String newsfeedTitle)
          Set the Title of the newsfeed where this item is in
 void setNewsfeedXmlUrl(String newsfeedXML)
          Set the newsfeed XML URL
 void setOrigurl(String origurl)
          Set the feed XML url of the newstext
 void setPermaLink(boolean permaLink)
          Set to TRUE if the guid is a permanent link
 void setPubDate(String pubDate, boolean parsePubDate)
          Set the publish date
 void setPubDateParsed(Date pubDateParsed)
          Set the parsed Publish Date
 void setPublisher(String publisher)
          Set the publisher
 void setRead(boolean isRead)
          Set state of isRead
 void setRequiresViewUpdate(boolean updateNewsView)
          Set wether this newsitem requires an update in the view.
 void setSource(String source)
          Set the source and parse for links
 void setTitle(String title)
          Set the title to this Newsitem.
 void setTitle(String desiredTitle, boolean trim)
          Set the title to this Newsitem.
 String toAmphetaRateURL()
          Create the AmphetaRate URL for this newsitem.
 String toHTML()
          Create HTML from some of the informations of the news item.
 String toNewsTip()
          Create a new "mailto:" URL from the newsitem
 String toPrintable()
          Create a String of the informations in the newsitem with simple formatting to send to a printer.
 String toString()
          Create a String from the newsitem (not complete, only used by the search).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_TITLE_LENGTH

private static final int MAX_TITLE_LENGTH
Max. number of characters for the title if description is used as title

See Also:
Constant Field Values

author

private String author

category

private String category

comments

private Vector comments

description

private String description

enclosures

private Vector enclosures

guid

private String guid

highlightWords

private Vector highlightWords
Vector holding all words that should be highlighted


isPartOfAggregation

private boolean isPartOfAggregation

isRead

private boolean isRead
TRUE if the user has read this news


link

private String link

linkList

private Vector linkList
Vector holding all links from the text


newsfeedTitle

private String newsfeedTitle
Title of the feed this news is from


newsfeedXmlUrl

private String newsfeedXmlUrl
URL of the RSS from where this news is


origurl

private String origurl
Set by AmphetaRate for feed XML included in news


permaLink

private boolean permaLink

pubDate

private String pubDate

pubDateParsed

private Date pubDateParsed

publisher

private String publisher

source

private String source

title

private String title
Attributes describing the news item


updateNewsView

private boolean updateNewsView
Flag to force an update when viewing

Constructor Detail

NewsItem

public NewsItem()
Instantiate a new NewsItem


NewsItem

public NewsItem(boolean isPartOfAggregation)
Instantiate a new NewsItem

Parameters:
isPartOfAggregation - If TRUE, this NewsItem is showing inside an Category Aggregation.
Method Detail

addComment

public void addComment(String comment)
Add a comment to the NewsItem.

Parameters:
comment - The comment as String.

clearHighlightWords

public void clearHighlightWords()
Clear the Vector that contains the highlight words for a search.


clone

public void clone(NewsItem newsItem)
Clone settings from this newsitem into the given one

Parameters:
newsItem - The newsitem to clone the settings into

getAuthor

public String getAuthor()
Get the author

Returns:
String Author

getCategory

public String getCategory()
Get the category

Returns:
String Category

getComments

public Vector getComments()
Get Vector holding all comments

Returns:
Vector comments

getDescription

public String getDescription()
Get the description

Returns:
String description

getEnclosures

public Vector getEnclosures()
Get a Vector holding all enclosures

Returns:
Vector Enclosures

getGuid

public String getGuid()
Get the GUID

Returns:
String guid

getHighlightWords

public Vector getHighlightWords()
Get highlighted words

Returns:
Vector Highlighted Words

getLink

public String getLink()
Get the link

Returns:
String link

getLinkList

public Vector getLinkList()
Get the Link List

Returns:
Vector containing Links

getNewsfeedTitle

public String getNewsfeedTitle()
Get the news feed title

Returns:
String The Title of the newsfeed where this item is in

getNewsfeedXmlUrl

public String getNewsfeedXmlUrl()
Get the newsfeed XML URL

Returns:
String newsfeed XML URL

getOrigurl

public String getOrigurl()
Get the feed XML url from the newstext

Returns:
Returns the origurl.

getPubDate

public String getPubDate()
Get the publish date

Returns:
String PubDate

getPubDateParsed

public Date getPubDateParsed()
Get the parsed publish Date

Returns:
Date The publish Date object

getPublisher

public String getPublisher()
Get the publisher

Returns:
String Publisher

getRequiresViewUpdate

public boolean getRequiresViewUpdate()
Check if this newsitem was marked to require an update in the view.

Returns:
boolean TRUE if this news requires an update in the view

getSafeXMLFeedUrl

public String getSafeXMLFeedUrl()
Get the URL of the XML feed this news item is in. If the newsitem was aggregated from a category, the URL is not correct. In this method, the correct URL is returned, in any way.

Returns:
String The URL of the XML feed this news item is in

getSource

public String getSource()
Get the source

Returns:
String Source

getTitle

public String getTitle()
Get the title

Returns:
String title

insertEnclosure

public void insertEnclosure(Enclosure rssEnclosure)
Add an enclosure to the news item and parse for links

Parameters:
rssEnclosure -

insertHighlightWord

public void insertHighlightWord(String word)
Insert a word to highlight

Parameters:
word - The word to highlight

isPartOfAggregation

public boolean isPartOfAggregation()
Check wether this NewsItem is part of an Category Aggregation.

Returns:
TRUE if this NewsItem is part of an Category Aggregation.

isPermaLink

public boolean isPermaLink()
This field is TRUE if the link set in the guid tag is a permanent link

Returns:
boolean TRUE if guid is a permanent link

isRead

public boolean isRead()
Get state of isRead

Returns:
boolean TRUE if read

sameAs

public boolean sameAs(NewsItem newsItem)
Lazy check if the given NewsItem is equal to the called one

Parameters:
newsItem - The newsitem to check for equalness
Returns:
boolean TRUE in case both should be equal

setAuthor

public void setAuthor(String author)
Set the author

Parameters:
author -

setCategory

public void setCategory(String category)
Set the category

Parameters:
category -

setDescription

public void setDescription(String description)
Set the description and parse for links

Parameters:
description -

setGuid

public void setGuid(String guid)
Set the GUID

Parameters:
guid -

setLink

public void setLink(String link)
Set the link

Parameters:
link -

setNewsfeedTitle

public void setNewsfeedTitle(String newsfeedTitle)
Set the Title of the newsfeed where this item is in

Parameters:
newsfeedTitle -

setNewsfeedXmlUrl

public void setNewsfeedXmlUrl(String newsfeedXML)
Set the newsfeed XML URL

Parameters:
newsfeedXML -

setOrigurl

public void setOrigurl(String origurl)
Set the feed XML url of the newstext

Parameters:
origurl - The origurl to set.

setPermaLink

public void setPermaLink(boolean permaLink)
Set to TRUE if the guid is a permanent link

Parameters:
permaLink - TRUE if guid is permalink

setPubDate

public void setPubDate(String pubDate,
                       boolean parsePubDate)
Set the publish date

Parameters:
pubDate -
parsePubDate -

setPubDateParsed

public void setPubDateParsed(Date pubDateParsed)
Set the parsed Publish Date

Parameters:
pubDateParsed - The parsed publish Date

setPublisher

public void setPublisher(String publisher)
Set the publisher

Parameters:
publisher -

setRead

public void setRead(boolean isRead)
Set state of isRead

Parameters:
isRead -

setRequiresViewUpdate

public void setRequiresViewUpdate(boolean updateNewsView)
Set wether this newsitem requires an update in the view.

Parameters:
updateNewsView - TRUE marks this news as required of an update

setSource

public void setSource(String source)
Set the source and parse for links

Parameters:
source - The source information

setTitle

public void setTitle(String title)
Set the title to this Newsitem. RSSOwl will try to decode ISO Entites from the Title, and replace all HTML. Do not trim the title to a certain length.

Parameters:
title - The title of this newsitem

setTitle

public void setTitle(String desiredTitle,
                     boolean trim)
Set the title to this Newsitem. If set so, trim the title to a certain length. HTML is removed and the String normalized to single whitespaces.

Parameters:
desiredTitle - The title of this newsitem
trim - If TRUE, trim the title to MAX_TITLE_LENGTH

toAmphetaRateURL

public String toAmphetaRateURL()
Create the AmphetaRate URL for this newsitem. The URL contains informations about the news.

Returns:
String The URL to rate this news

toHTML

public String toHTML()
Create HTML from some of the informations of the news item. The HTML is HTML 4.01 transitional.

Returns:
String The HTML as String

toNewsTip

public String toNewsTip()
Create a new "mailto:" URL from the newsitem

Returns:
String URL-encoded "mailto:..." link

toPrintable

public String toPrintable()
Create a String of the informations in the newsitem with simple formatting to send to a printer.

Returns:
String Printable newsitem text

toString

public String toString()
Create a String from the newsitem (not complete, only used by the search).

Returns:
String Representation of the newsitem.

parseForLinks

private void parseForLinks(String text)
Parse the text for links

Parameters:
text - Current Text


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo