net.sourceforge.rssowl.model
Class NewsItem

java.lang.Object
  extended by net.sourceforge.rssowl.model.NewsItem

public class NewsItem
extends java.lang.Object

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

Version:
1.2.4
Author:
Benjamin Pasero

Field Summary
private  java.lang.String author
           
private  java.lang.String baseUri
           
private  java.lang.String category
           
private  java.util.Vector comments
           
private  java.lang.String description
           
private  java.util.Vector enclosures
           
private  java.lang.String guid
           
private  java.util.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  boolean isSearchCaseSensitive
           
private  java.lang.String link
           
private  java.util.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  java.lang.String newsFeedHomepage
          Homepage of the Newsfeed this Item is From
private  java.lang.String newsfeedTitle
          Title of the feed this news is from
private  java.lang.String newsfeedXmlUrl
          URL of the RSS from where this news is
private  java.lang.String origurl
          Set by AmphetaRate for feed XML included in news
private  java.lang.String pubDate
           
private  java.util.Date pubDateParsed
           
private  java.lang.String publisher
           
private  java.lang.String source
           
private  java.lang.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(java.lang.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
 java.lang.String getAuthor()
          Get the author
 java.lang.String getCategory()
          Get the category
 java.util.Vector getComments()
          Get Vector holding all comments
 java.lang.String getDescription()
          Get the description
 java.util.Vector getEnclosures()
          Get a Vector holding all enclosures
 java.lang.String getGuid()
          Get the GUID
 java.util.Vector getHighlightWords()
          Get highlighted words
 java.lang.String getLink()
          Get the link
 java.util.Vector getLinkList()
          Get the Link List
 java.lang.String getNewsfeedHomepage()
           
 java.lang.String getNewsfeedTitle()
          Get the news feed title
 java.lang.String getNewsfeedXmlUrl()
          Get the newsfeed XML URL
 java.lang.String getOrigurl()
          Get the feed XML url from the newstext
 java.lang.String getPubDate()
          Get the publish date
 java.util.Date getPubDateParsed()
          Get the parsed publish Date
 java.lang.String getPublisher()
          Get the publisher
 boolean getRequiresViewUpdate()
          Check if this newsitem was marked to require an update in the view.
 java.lang.String getSafeXMLFeedUrl()
          Get the URL of the XML feed this news item is in.
 java.lang.String getSource()
          Get the source
 java.lang.String getTitle()
          Get the title
 void insertEnclosure(Enclosure rssEnclosure)
          Add an enclosure to the news item and parse for links
 void insertHighlightWord(java.lang.String word)
          Insert a word to highlight
 boolean isPartOfAggregation()
          Check wether this NewsItem is part of an Category Aggregation.
 boolean isRead()
          Get state of isRead
 boolean isSearchCaseSensitive()
          Note: Field only used when a search was run on this item's Channel.
private  void parseForLinks(java.lang.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(java.lang.String author)
          Set the author
 void setBaseUri(java.lang.String baseUri)
          A Base URI may be set if required.
 void setCategory(java.lang.String category)
          Set the category
 void setDescription(java.lang.String description)
          Set the description and parse for links
 void setGuid(java.lang.String guid)
          Set the GUID
 void setLink(java.lang.String link)
          Set the link
 void setNewsfeedHomepage(java.lang.String newsFeedHomepage)
           
 void setNewsfeedTitle(java.lang.String newsfeedTitle)
          Set the Title of the newsfeed where this item is in
 void setNewsfeedXmlUrl(java.lang.String newsfeedXML)
          Set the newsfeed XML URL
 void setOrigurl(java.lang.String origurl)
          Set the feed XML url of the newstext
 void setPubDate(java.lang.String pubDate, boolean parsePubDate)
          Set the publish date
 void setPubDateParsed(java.util.Date pubDateParsed)
          Set the parsed Publish Date
 void setPublisher(java.lang.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 setSearchCaseSensitive(boolean isSearchCaseSensitive)
          Note: Field only used when a search was run on this item's Channel.
 void setSource(java.lang.String source)
          Set the source and parse for links
 void setTitle(java.lang.String title)
          Set the title to this Newsitem.
 void setTitle(java.lang.String desiredTitle, boolean trim)
          Set the title to this Newsitem.
 void setTitle(java.lang.String desiredTitle, boolean trim, boolean stripTags)
          Set the title to this Newsitem.
 java.lang.String toAmphetaRateURL()
          Create the AmphetaRate URL for this newsitem.
 java.lang.String toHTML()
          Create HTML from some of the informations of the news item.
 java.lang.String toNewsTip()
          Create a new "mailto:" URL from the newsitem
 java.lang.String toPrintable()
          Create a String of the informations in the newsitem with simple formatting to send to a printer.
 java.lang.String toString(SearchDefinition searchDefinition)
          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, toString, 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 java.lang.String author

baseUri

private java.lang.String baseUri

category

private java.lang.String category

comments

private java.util.Vector comments

description

private java.lang.String description

enclosures

private java.util.Vector enclosures

guid

private java.lang.String guid

highlightWords

private java.util.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


isSearchCaseSensitive

private boolean isSearchCaseSensitive

link

private java.lang.String link

linkList

private java.util.Vector linkList
Vector holding all links from the text


newsFeedHomepage

private java.lang.String newsFeedHomepage
Homepage of the Newsfeed this Item is From


newsfeedTitle

private java.lang.String newsfeedTitle
Title of the feed this news is from


newsfeedXmlUrl

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


origurl

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


pubDate

private java.lang.String pubDate

pubDateParsed

private java.util.Date pubDateParsed

publisher

private java.lang.String publisher

source

private java.lang.String source

title

private java.lang.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(java.lang.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 java.lang.String getAuthor()
Get the author

Returns:
String Author

getCategory

public java.lang.String getCategory()
Get the category

Returns:
String Category

getComments

public java.util.Vector getComments()
Get Vector holding all comments

Returns:
Vector comments

getDescription

public java.lang.String getDescription()
Get the description

Returns:
String description

getEnclosures

public java.util.Vector getEnclosures()
Get a Vector holding all enclosures

Returns:
Vector Enclosures

getGuid

public java.lang.String getGuid()
Get the GUID

Returns:
String guid

getHighlightWords

public java.util.Vector getHighlightWords()
Get highlighted words

Returns:
Vector Highlighted Words

getLink

public java.lang.String getLink()
Get the link

Returns:
String link

getLinkList

public java.util.Vector getLinkList()
Get the Link List

Returns:
Vector containing Links

getNewsfeedHomepage

public java.lang.String getNewsfeedHomepage()
Returns:
String The Homepage URL of the Newsfeed this item is in or NULL.

getNewsfeedTitle

public java.lang.String getNewsfeedTitle()
Get the news feed title

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

getNewsfeedXmlUrl

public java.lang.String getNewsfeedXmlUrl()
Get the newsfeed XML URL

Returns:
String newsfeed XML URL

getOrigurl

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

Returns:
Returns the origurl.

getPubDate

public java.lang.String getPubDate()
Get the publish date

Returns:
String PubDate

getPubDateParsed

public java.util.Date getPubDateParsed()
Get the parsed publish Date

Returns:
Date The publish Date object

getPublisher

public java.lang.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 java.lang.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 java.lang.String getSource()
Get the source

Returns:
String Source

getTitle

public java.lang.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(java.lang.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.

isRead

public boolean isRead()
Get state of isRead

Returns:
boolean TRUE if read

isSearchCaseSensitive

public boolean isSearchCaseSensitive()
Note: Field only used when a search was run on this item's Channel.

Returns:
boolean TRUE if the search was Case Sensitive.

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(java.lang.String author)
Set the author

Parameters:
author -

setBaseUri

public void setBaseUri(java.lang.String baseUri)
A Base URI may be set if required. It is used from the toHTML-Method.

Parameters:
baseUri - The baseUri to set.

setCategory

public void setCategory(java.lang.String category)
Set the category

Parameters:
category -

setDescription

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

Parameters:
description -

setGuid

public void setGuid(java.lang.String guid)
Set the GUID

Parameters:
guid -

setLink

public void setLink(java.lang.String link)
Set the link

Parameters:
link -

setNewsfeedHomepage

public void setNewsfeedHomepage(java.lang.String newsFeedHomepage)
Parameters:
newsFeedHomepage - The Homepage URL of the Newsfeed this item is in or NULL.

setNewsfeedTitle

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

Parameters:
newsfeedTitle -

setNewsfeedXmlUrl

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

Parameters:
newsfeedXML -

setOrigurl

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

Parameters:
origurl - The origurl to set.

setPubDate

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

Parameters:
pubDate -
parsePubDate -

setPubDateParsed

public void setPubDateParsed(java.util.Date pubDateParsed)
Set the parsed Publish Date

Parameters:
pubDateParsed - The parsed publish Date

setPublisher

public void setPublisher(java.lang.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

setSearchCaseSensitive

public void setSearchCaseSensitive(boolean isSearchCaseSensitive)
Note: Field only used when a search was run on this item's Channel.

Parameters:
isSearchCaseSensitive - TRUE if the search was Case Sensitive.

setSource

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

Parameters:
source - The source information

setTitle

public void setTitle(java.lang.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(java.lang.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

setTitle

public void setTitle(java.lang.String desiredTitle,
                     boolean trim,
                     boolean stripTags)
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 in dependance of the stripTags flag.

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

toAmphetaRateURL

public java.lang.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 java.lang.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 java.lang.String toNewsTip()
Create a new "mailto:" URL from the newsitem

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

toPrintable

public java.lang.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 java.lang.String toString(SearchDefinition searchDefinition)
Create a String from the newsitem (not complete, only used by the search).

Parameters:
searchDefinition - The SearchDefinition including the Scope.
Returns:
String Representation of the newsitem.

parseForLinks

private void parseForLinks(java.lang.String text)
Parse the text for links

Parameters:
text - Current Text


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo