net.sourceforge.rssowl.model
Class Channel

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

public class Channel
extends java.lang.Object

Model for a Channel

Version:
1.2.4
Author:
Benjamin Pasero

Field Summary
private  Category aggregatedCategory
          If this is an aggregation, the aggregated category
private  java.util.TreeSet aggregatedFavorites
          If the Channel was built from an aggregated category, this field will remember which favorites where aggregated.
private  java.lang.String category
           
private  java.lang.String copyright
           
private  java.lang.String creator
           
private  java.lang.String description
           
private  java.lang.String docs
          This tag should contain a URL that references a description of the channel
private  org.jdom.Document document
          Save the Document (rss xml)
private  java.lang.String format
          Format of this Newsfeed
private  java.lang.String generator
          A string indicating the program used to generate the channel.
private  java.lang.String homepage
          URL of this feed's homepage
private  ChannelImage image
          May Attributes
private  int itemCount
          Number of items (= news) in this RSS
private  java.util.Hashtable items
          Newsitems
private  java.lang.String language
           
private  java.lang.String lastBuildDate
          The last time the channel was modified
private  java.util.Date lastBuildDateParsed
          The parsed lastBuildDate
private  java.lang.String link
           
private  java.lang.String managingEditor
          The email address of the managing editor of the site
private  java.util.Vector newsChannelInfos
          Save what channel infos are available
private  java.util.Vector newsItemInfos
          Save what newsitem infos are available
private  java.util.Vector newsItemOrder
          Save order of the news from the XML
private  java.lang.String pubDate
          Date when channel was published.
private  java.util.Date pubDateParsed
          The parsed publish date
private  java.lang.String publisher
           
private  java.util.Vector searchResultsItemOrder
          Sorted items that match the search
private  java.util.Hashtable searchResultsItems
          Items that match the search
private  java.lang.String title
           
private  java.lang.String ttl
          ttl stands for time to live.
private  java.lang.String updateFrequency
           
private  java.lang.String updatePeriod
           
private  java.lang.String webmaster
          The email address of the webmaster for the site, the person to contact if there are technical problems with the channel
 
Constructor Summary
Channel()
          Default constructor
Channel(java.lang.String title, Category aggregatedCategory, java.util.Vector rssChannels, java.util.TreeSet aggregatedFavorites, boolean generateUniqueTitles)
          This constructor is used to aggregate a Vector of RSSChannels into one channel.
Channel(java.lang.String title, java.lang.String description, java.lang.String link, java.lang.String language)
          Instantiates a news Channel
 
Method Summary
 void addAvailableNewsChannelInfo(java.lang.String i18nName)
          Add an available news channel info
 void addAvailableNewsItemInfo(java.lang.String i18nName)
          Add an available news item info
private  void aggregateChannels(java.util.Vector rssChannels, boolean generateUniqueTitles)
          Aggregate a Vector of RSS channels into this channel
 boolean containsUnreadNews()
          Get wether this Channel contains unread news
static Channel createErrorChannel(java.lang.String url, NewsfeedFactoryException e)
          Create a fake Channel that displays an warning message given from the Exception.
 Category getAggregatedCategory()
           
 java.util.TreeSet getAggregatedFavorites()
           
 java.util.Vector getAvailableNewsChannelInfos()
          Get available news channel infos
 java.util.Vector getAvailableNewsItemInfos()
          Get available news item infos
 java.lang.String getCategory()
          Get the category
 java.lang.String getCopyright()
          Get the copyright
 java.lang.String getCreator()
          Get the creator
 java.lang.String getDescription()
          Get the description
 java.lang.String getDocs()
          Get the docs
 org.jdom.Document getDocument()
          Get the document
 java.lang.String getFormat()
          Get the Format
 java.lang.String getGenerator()
          Get the generator
 java.lang.String getHomepage()
          Get the Feeds Homepage
 ChannelImage getImage()
          Get the ChannelImage
 int getItemCount()
          Get count of items
 java.util.Hashtable getItems()
          Get all items
 java.lang.String getLanguage()
          Get the language
 java.lang.String getLastBuildDate()
          Get the last build date
 java.util.Date getLastBuildDateParsed()
          Get the parsed last build Date
 java.lang.String getLink()
          Get the link
 java.lang.String getManagingEditor()
          Get the managing editor
 java.util.Vector getNewsItemOrder()
          Get news item order
 java.lang.String getPubDate()
          Get the publish date
 java.util.Date getPubDateParsed()
          Get the parsed publish Date
 java.lang.String getPublisher()
          Get the publisher
 java.util.Vector getSearchResultsItemOrder()
          Get the search results item order
 java.util.Hashtable getSearchResultsItems()
          Get the search result items
 java.lang.String getTitle()
          Get the title
 java.lang.String getTtl()
          Get the time to live
 int getUnreadNewsCount()
          Get the number of unread news for this channel
 int getUnreadNewsCount(java.lang.String feedXMLUrl)
          Get the number of unread news for the given feed.
 java.lang.String getUpdateFrequency()
          Get update frequency
 java.lang.String getUpdatePeriod()
          Get the update period
 java.lang.String getWebmaster()
          Get the webmaster
 void insertItem(NewsItem item)
          Insert a newsitem into the Channel and generate a unique title
 void insertItem(NewsItem item, boolean generateUniqueTitle)
          Insert a newsitem into the Channel.
 boolean isAggregatedCat()
           
 void peformSearch(ParsedSearch parsedSearch)
          Run a Search on the Items of this Channel.
private  void search(ParsedSearch parsedSearch)
           Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable This search is using two ArrayLists containing the must- and the must-not words.
private  void search(SearchDefinition searchDefinition)
           Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable.
 void setCategory(java.lang.String category)
          Set the category
 void setCopyright(java.lang.String copyright)
          Set the copyright
 void setCreator(java.lang.String creator)
          Set the creator
 void setDescription(java.lang.String description)
          Set the description
 void setDocs(java.lang.String docs)
          Set the docs
 void setDocument(org.jdom.Document document)
          Set the document
 void setFormat(java.lang.String format)
          Set the Format
 void setGenerator(java.lang.String generator)
          Set the generator
 void setHomepage(java.lang.String homepage)
          Set the Feeds Homepage
 void setImage(ChannelImage image)
          Set the RSS channel image
 void setItemCount(int itemCount)
          Set the item count
 void setLanguage(java.lang.String language)
          Set the language
 void setLastBuildDate(java.lang.String lastBuildDate)
          Set the last build date
 void setLink(java.lang.String link)
          Set the link
 void setManagingEditor(java.lang.String managingEditor)
          Set the managing editor
 void setPubDate(java.lang.String pubDate)
          Set the publish date
 void setPublisher(java.lang.String publisher)
          Set the publisher
 void setTitle(java.lang.String title)
          Set the title
 void setTtl(java.lang.String ttl)
          Set the time to live
 void setUpdateFrequency(java.lang.String updateFrequency)
          Set the update frequency
 void setUpdatePeriod(java.lang.String updatePeriod)
          Set the update period
 void setWebmaster(java.lang.String webmaster)
          Set the webmaster
 org.jdom.Document toDocument()
          Create a RSS 2.0 XML document from the Channel.
 void updateReadStatusOnNews()
          Check for each NewsItem of the given Channel if the news was read before or is unread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aggregatedCategory

private Category aggregatedCategory
If this is an aggregation, the aggregated category


aggregatedFavorites

private java.util.TreeSet aggregatedFavorites
If the Channel was built from an aggregated category, this field will remember which favorites where aggregated.


category

private java.lang.String category

copyright

private java.lang.String copyright

creator

private java.lang.String creator

description

private java.lang.String description

docs

private java.lang.String docs
This tag should contain a URL that references a description of the channel


document

private org.jdom.Document document
Save the Document (rss xml)


format

private java.lang.String format
Format of this Newsfeed


generator

private java.lang.String generator
A string indicating the program used to generate the channel.


homepage

private java.lang.String homepage
URL of this feed's homepage


image

private ChannelImage image
May Attributes


itemCount

private int itemCount
Number of items (= news) in this RSS


items

private java.util.Hashtable items
Newsitems


language

private java.lang.String language

lastBuildDate

private java.lang.String lastBuildDate
The last time the channel was modified


lastBuildDateParsed

private java.util.Date lastBuildDateParsed
The parsed lastBuildDate


link

private java.lang.String link

managingEditor

private java.lang.String managingEditor
The email address of the managing editor of the site


newsChannelInfos

private java.util.Vector newsChannelInfos
Save what channel infos are available


newsItemInfos

private java.util.Vector newsItemInfos
Save what newsitem infos are available


newsItemOrder

private java.util.Vector newsItemOrder
Save order of the news from the XML


pubDate

private java.lang.String pubDate
Date when channel was published.


pubDateParsed

private java.util.Date pubDateParsed
The parsed publish date


publisher

private java.lang.String publisher

searchResultsItemOrder

private java.util.Vector searchResultsItemOrder
Sorted items that match the search


searchResultsItems

private java.util.Hashtable searchResultsItems
Items that match the search


title

private java.lang.String title

ttl

private java.lang.String ttl
ttl stands for time to live. It's a number of minutes that indicates how long a channel can be cached before refreshing from the source.


updateFrequency

private java.lang.String updateFrequency

updatePeriod

private java.lang.String updatePeriod

webmaster

private java.lang.String webmaster
The email address of the webmaster for the site, the person to contact if there are technical problems with the channel

Constructor Detail

Channel

public Channel()
Default constructor


Channel

public Channel(java.lang.String title,
               Category aggregatedCategory,
               java.util.Vector rssChannels,
               java.util.TreeSet aggregatedFavorites,
               boolean generateUniqueTitles)
This constructor is used to aggregate a Vector of RSSChannels into one channel.

Parameters:
title - Title of the channel
aggregatedCategory - The category that is aggregated
rssChannels - Vector holding some rss channels
aggregatedFavorites - The favorites that have been aggregated
generateUniqueTitles - Set to TRUE if the news-titles have to be unique

Channel

public Channel(java.lang.String title,
               java.lang.String description,
               java.lang.String link,
               java.lang.String language)
Instantiates a news Channel

Parameters:
title - Title of the channel
description - Description of the channel
link - Link of the channel
language - Language of the channel
Method Detail

createErrorChannel

public static Channel createErrorChannel(java.lang.String url,
                                         NewsfeedFactoryException e)
Create a fake Channel that displays an warning message given from the Exception.

Parameters:
url - The URL where the warning occured
e - The exception
Returns:
Channel The warning channel

addAvailableNewsChannelInfo

public void addAvailableNewsChannelInfo(java.lang.String i18nName)
Add an available news channel info

Parameters:
i18nName - The i18n key for the info

addAvailableNewsItemInfo

public void addAvailableNewsItemInfo(java.lang.String i18nName)
Add an available news item info

Parameters:
i18nName - The i18n key for the info

containsUnreadNews

public boolean containsUnreadNews()
Get wether this Channel contains unread news

Returns:
boolean TRUE in case it contains unread news

getAggregatedCategory

public Category getAggregatedCategory()
Returns:
Category If this channel is from an aggregation, will return the aggregated category, or NULL in the other case.

getAggregatedFavorites

public java.util.TreeSet getAggregatedFavorites()
Returns:
TreeSet Get the list of aggregated favorites if this channel was created from an aggregation

getAvailableNewsChannelInfos

public java.util.Vector getAvailableNewsChannelInfos()
Get available news channel infos

Returns:
Vector available news channel infos

getAvailableNewsItemInfos

public java.util.Vector getAvailableNewsItemInfos()
Get available news item infos

Returns:
Vector available news item infos

getCategory

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

Returns:
String category

getCopyright

public java.lang.String getCopyright()
Get the copyright

Returns:
String copyright

getCreator

public java.lang.String getCreator()
Get the creator

Returns:
String creator

getDescription

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

Returns:
String description

getDocs

public java.lang.String getDocs()
Get the docs

Returns:
String docs

getDocument

public org.jdom.Document getDocument()
Get the document

Returns:
Document document

getFormat

public java.lang.String getFormat()
Get the Format

Returns:
String Feed Format

getGenerator

public java.lang.String getGenerator()
Get the generator

Returns:
String generator

getHomepage

public java.lang.String getHomepage()
Get the Feeds Homepage

Returns:
String Feeds Homepage

getImage

public ChannelImage getImage()
Get the ChannelImage

Returns:
ChannelImage the RSS channel image

getItemCount

public int getItemCount()
Get count of items

Returns:
int item count

getItems

public java.util.Hashtable getItems()
Get all items

Returns:
Hashtable items

getLanguage

public java.lang.String getLanguage()
Get the language

Returns:
String language

getLastBuildDate

public java.lang.String getLastBuildDate()
Get the last build date

Returns:
String last build date

getLastBuildDateParsed

public java.util.Date getLastBuildDateParsed()
Get the parsed last build Date

Returns:
Date The last build Date object

getLink

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

Returns:
String link

getManagingEditor

public java.lang.String getManagingEditor()
Get the managing editor

Returns:
String managing editor

getNewsItemOrder

public java.util.Vector getNewsItemOrder()
Get news item order

Returns:
Vector news item order

getPubDate

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

Returns:
String publish date

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

getSearchResultsItemOrder

public java.util.Vector getSearchResultsItemOrder()
Get the search results item order

Returns:
Vector search results item order

getSearchResultsItems

public java.util.Hashtable getSearchResultsItems()
Get the search result items

Returns:
Hashtable search result items

getTitle

public java.lang.String getTitle()
Get the title

Returns:
String title

getTtl

public java.lang.String getTtl()
Get the time to live

Returns:
String time to live

getUnreadNewsCount

public int getUnreadNewsCount()
Get the number of unread news for this channel

Returns:
int The number of unread news

getUnreadNewsCount

public int getUnreadNewsCount(java.lang.String feedXMLUrl)
Get the number of unread news for the given feed. This method is called when determining unread news from a certain feed inside an aggregation.

Parameters:
feedXMLUrl - The URL of the newsfeed
Returns:
int The number of unread news for the given feed

getUpdateFrequency

public java.lang.String getUpdateFrequency()
Get update frequency

Returns:
String update frequency

getUpdatePeriod

public java.lang.String getUpdatePeriod()
Get the update period

Returns:
String update period

getWebmaster

public java.lang.String getWebmaster()
Get the webmaster

Returns:
String webmaster

insertItem

public void insertItem(NewsItem item)
Insert a newsitem into the Channel and generate a unique title

Parameters:
item - The NewsItem to insert

insertItem

public void insertItem(NewsItem item,
                       boolean generateUniqueTitle)
Insert a newsitem into the Channel. Generate a unique title if set so.

Parameters:
item - The newsitem to add
generateUniqueTitle - TRUE if the title must be unique

isAggregatedCat

public boolean isAggregatedCat()
Returns:
boolean TRUE if the Feed is an aggregated category

peformSearch

public void peformSearch(ParsedSearch parsedSearch)
Run a Search on the Items of this Channel.

Parameters:
parsedSearch - The parsed Search to use for the Search. A search may either use the pattern directly as regular expression or use lists of must- and must-not words.

setCategory

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

Parameters:
category -

setCopyright

public void setCopyright(java.lang.String copyright)
Set the copyright

Parameters:
copyright -

setCreator

public void setCreator(java.lang.String creator)
Set the creator

Parameters:
creator -

setDescription

public void setDescription(java.lang.String description)
Set the description

Parameters:
description -

setDocs

public void setDocs(java.lang.String docs)
Set the docs

Parameters:
docs -

setDocument

public void setDocument(org.jdom.Document document)
Set the document

Parameters:
document -

setFormat

public void setFormat(java.lang.String format)
Set the Format

Parameters:
format -

setGenerator

public void setGenerator(java.lang.String generator)
Set the generator

Parameters:
generator -

setHomepage

public void setHomepage(java.lang.String homepage)
Set the Feeds Homepage

Parameters:
homepage -

setImage

public void setImage(ChannelImage image)
Set the RSS channel image

Parameters:
image -

setItemCount

public void setItemCount(int itemCount)
Set the item count

Parameters:
itemCount -

setLanguage

public void setLanguage(java.lang.String language)
Set the language

Parameters:
language -

setLastBuildDate

public void setLastBuildDate(java.lang.String lastBuildDate)
Set the last build date

Parameters:
lastBuildDate -

setLink

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

Parameters:
link -

setManagingEditor

public void setManagingEditor(java.lang.String managingEditor)
Set the managing editor

Parameters:
managingEditor -

setPubDate

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

Parameters:
pubDate -

setPublisher

public void setPublisher(java.lang.String publisher)
Set the publisher

Parameters:
publisher -

setTitle

public void setTitle(java.lang.String title)
Set the title

Parameters:
title -

setTtl

public void setTtl(java.lang.String ttl)
Set the time to live

Parameters:
ttl -

setUpdateFrequency

public void setUpdateFrequency(java.lang.String updateFrequency)
Set the update frequency

Parameters:
updateFrequency -

setUpdatePeriod

public void setUpdatePeriod(java.lang.String updatePeriod)
Set the update period

Parameters:
updatePeriod -

setWebmaster

public void setWebmaster(java.lang.String webmaster)
Set the webmaster

Parameters:
webmaster -

toDocument

public org.jdom.Document toDocument()
Create a RSS 2.0 XML document from the Channel. This is used when saving newsfeeds.

Returns:
Document A new JDom XML document

updateReadStatusOnNews

public void updateReadStatusOnNews()
Check for each NewsItem of the given Channel if the news was read before or is unread. This is done with using the archive that saves read news.


aggregateChannels

private void aggregateChannels(java.util.Vector rssChannels,
                               boolean generateUniqueTitles)
Aggregate a Vector of RSS channels into this channel

Parameters:
rssChannels - Vector holding some rss channels
generateUniqueTitles - Set to TRUE if news-titles have to be unique

search

private void search(ParsedSearch parsedSearch)

Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable

This search is using two ArrayLists containing the must- and the must-not words.

Parameters:
parsedSearch - Parsed Search Pattern containing the words that must and the words that must not be part of the NewsItem and Scope to search.

search

private void search(SearchDefinition searchDefinition)

Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable.

This search is using the Pattern of the Definition directly as RegEx.

Parameters:
searchDefinition - Pattern and Scope of the Search.


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo