net.sourceforge.rssowl.model
Class Channel

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

public class Channel
extends Object

Model for a Channel

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
private  Category aggregatedCategory
          If this is an aggregation, the aggregated category
private  TreeSet aggregatedFavorites
          If the Channel was built from an aggregated category, this field will remember which favorites where aggregated.
private  String category
           
private  String copyright
           
private  String creator
           
private  String description
           
private  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  String generator
          A string indicating the program used to generate the channel.
private  String homepage
          URL of this feed's homepage
private  ChannelImage image
          May Attributes
private  int itemCount
          Number of items (= news) in this RSS
private  Hashtable items
          Newsitems
private  String language
           
private  String lastBuildDate
          The last time the channel was modified
private  Date lastBuildDateParsed
          The parsed lastBuildDate
private  String link
           
private  String managingEditor
          The email address of the managing editor of the site
private  Vector newsChannelInfos
          Save what channel infos are available
private  Vector newsItemInfos
          Save what newsitem infos are available
private  Vector newsItemOrder
          Save order of the news from the XML
private  String pubDate
          Date when channel was published.
private  Date pubDateParsed
          The parsed publish date
private  String publisher
           
private  String rssFormat
          Format of this Newsfeed
private  Vector searchResultsItemOrder
          Sorted items that match the search
private  Hashtable searchResultsItems
          Items that match the search
private  String title
           
private  String ttl
          ttl stands for time to live.
private  String updateFrequency
           
private  String updatePeriod
           
private  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(String title, Category aggregatedCategory, Vector rssChannels, TreeSet aggregatedFavorites, boolean generateUniqueTitles)
          This constructor is used to aggregate a Vector of RSSChannels into one channel.
Channel(String title, String description, String link, String language)
          Instantiates a news Channel
 
Method Summary
 void addAvailableNewsChannelInfo(String i18nName)
          Add an available news channel info
 void addAvailableNewsItemInfo(String i18nName)
          Add an available news item info
private  void aggregateChannels(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(String url, NewsfeedFactoryException e)
          Create a fake Channel that displays an warning message given from the Exception.
 Category getAggregatedCategory()
           
 TreeSet getAggregatedFavorites()
           
 Vector getAvailableNewsChannelInfos()
          Get available news channel infos
 Vector getAvailableNewsItemInfos()
          Get available news item infos
 String getCategory()
          Get the category
 String getCopyright()
          Get the copyright
 String getCreator()
          Get the creator
 String getDescription()
          Get the description
 String getDocs()
          Get the docs
 org.jdom.Document getDocument()
          Get the document
 String getGenerator()
          Get the generator
 String getHomepage()
          Get the Feeds Homepage
 ChannelImage getImage()
          Get the ChannelImage
 int getItemCount()
          Get count of items
 Hashtable getItems()
          Get all items
 String getLanguage()
          Get the language
 String getLastBuildDate()
          Get the last build date
 Date getLastBuildDateParsed()
          Get the parsed last build Date
 String getLink()
          Get the link
 String getManagingEditor()
          Get the managing editor
 Vector getNewsItemOrder()
          Get news item order
 String getPubDate()
          Get the publish date
 Date getPubDateParsed()
          Get the parsed publish Date
 String getPublisher()
          Get the publisher
 String getRSSFormat()
          Get the RSS Version
 Vector getSearchResultsItemOrder()
          Get the search results item order
 Hashtable getSearchResultsItems()
          Get the search result items
 String getTitle()
          Get the title
 String getTtl()
          Get the time to live
 int getUnreadNewsCount()
          Get the number of unread news for this channel
 int getUnreadNewsCount(String feedXMLUrl)
          Get the number of unread news for the given feed.
 String getUpdateFrequency()
          Get update frequency
 String getUpdatePeriod()
          Get the update period
 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 setCategory(String category)
          Set the category
 void setCopyright(String copyright)
          Set the copyright
 void setCreator(String creator)
          Set the creator
 void setDescription(String description)
          Set the description
 void setDocs(String docs)
          Set the docs
 void setDocument(org.jdom.Document document)
          Set the document
 void setGenerator(String generator)
          Set the generator
 void setHomepage(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(String language)
          Set the language
 void setLastBuildDate(String lastBuildDate)
          Set the last build date
 void setLink(String link)
          Set the link
 void setManagingEditor(String managingEditor)
          Set the managing editor
 void setNewsThatMatchSearch(Hashtable parsedPattern, Vector regEx)
          Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable
 void setNewsThatMatchSearch(String patternStr)
          Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable
 void setPubDate(String pubDate)
          Set the publish date
 void setPublisher(String publisher)
          Set the publisher
 void setRSSFormat(String rssFormat)
          Set the RSS Version
 void setTitle(String title)
          Set the title
 void setTtl(String ttl)
          Set the time to live
 void setUpdateFrequency(String updateFrequency)
          Set the update frequency
 void setUpdatePeriod(String updatePeriod)
          Set the update period
 void setWebmaster(String webmaster)
          Set the webmaster
 org.jdom.Document toDocument()
          Create a RSS 0.91 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 TreeSet aggregatedFavorites
If the Channel was built from an aggregated category, this field will remember which favorites where aggregated.


category

private String category

copyright

private String copyright

creator

private String creator

description

private String description

docs

private 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)


generator

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


homepage

private 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 Hashtable items
Newsitems


language

private String language

lastBuildDate

private String lastBuildDate
The last time the channel was modified


lastBuildDateParsed

private Date lastBuildDateParsed
The parsed lastBuildDate


link

private String link

managingEditor

private String managingEditor
The email address of the managing editor of the site


newsChannelInfos

private Vector newsChannelInfos
Save what channel infos are available


newsItemInfos

private Vector newsItemInfos
Save what newsitem infos are available


newsItemOrder

private Vector newsItemOrder
Save order of the news from the XML


pubDate

private String pubDate
Date when channel was published.


pubDateParsed

private Date pubDateParsed
The parsed publish date


publisher

private String publisher

rssFormat

private String rssFormat
Format of this Newsfeed


searchResultsItemOrder

private Vector searchResultsItemOrder
Sorted items that match the search


searchResultsItems

private Hashtable searchResultsItems
Items that match the search


title

private String title

ttl

private 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 String updateFrequency

updatePeriod

private String updatePeriod

webmaster

private 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(String title,
               Category aggregatedCategory,
               Vector rssChannels,
               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(String title,
               String description,
               String link,
               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(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(String i18nName)
Add an available news channel info

Parameters:
i18nName - The i18n key for the info

addAvailableNewsItemInfo

public void addAvailableNewsItemInfo(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 TreeSet getAggregatedFavorites()
Returns:
TreeSet Get the list of aggregated favorites if this channel was created from an aggregation

getAvailableNewsChannelInfos

public Vector getAvailableNewsChannelInfos()
Get available news channel infos

Returns:
Vector available news channel infos

getAvailableNewsItemInfos

public Vector getAvailableNewsItemInfos()
Get available news item infos

Returns:
Vector available news item infos

getCategory

public String getCategory()
Get the category

Returns:
String category

getCopyright

public String getCopyright()
Get the copyright

Returns:
String copyright

getCreator

public String getCreator()
Get the creator

Returns:
String creator

getDescription

public String getDescription()
Get the description

Returns:
String description

getDocs

public String getDocs()
Get the docs

Returns:
String docs

getDocument

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

Returns:
Document document

getGenerator

public String getGenerator()
Get the generator

Returns:
String generator

getHomepage

public 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 Hashtable getItems()
Get all items

Returns:
Hashtable items

getLanguage

public String getLanguage()
Get the language

Returns:
String language

getLastBuildDate

public String getLastBuildDate()
Get the last build date

Returns:
String last build date

getLastBuildDateParsed

public Date getLastBuildDateParsed()
Get the parsed last build Date

Returns:
Date The last build Date object

getLink

public String getLink()
Get the link

Returns:
String link

getManagingEditor

public String getManagingEditor()
Get the managing editor

Returns:
String managing editor

getNewsItemOrder

public Vector getNewsItemOrder()
Get news item order

Returns:
Vector news item order

getPubDate

public String getPubDate()
Get the publish date

Returns:
String publish date

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

getRSSFormat

public String getRSSFormat()
Get the RSS Version

Returns:
String RSS version

getSearchResultsItemOrder

public Vector getSearchResultsItemOrder()
Get the search results item order

Returns:
Vector search results item order

getSearchResultsItems

public Hashtable getSearchResultsItems()
Get the search result items

Returns:
Hashtable search result items

getTitle

public String getTitle()
Get the title

Returns:
String title

getTtl

public 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(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 String getUpdateFrequency()
Get update frequency

Returns:
String update frequency

getUpdatePeriod

public String getUpdatePeriod()
Get the update period

Returns:
String update period

getWebmaster

public 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

setCategory

public void setCategory(String category)
Set the category

Parameters:
category -

setCopyright

public void setCopyright(String copyright)
Set the copyright

Parameters:
copyright -

setCreator

public void setCreator(String creator)
Set the creator

Parameters:
creator -

setDescription

public void setDescription(String description)
Set the description

Parameters:
description -

setDocs

public void setDocs(String docs)
Set the docs

Parameters:
docs -

setDocument

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

Parameters:
document -

setGenerator

public void setGenerator(String generator)
Set the generator

Parameters:
generator -

setHomepage

public void setHomepage(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(String language)
Set the language

Parameters:
language -

setLastBuildDate

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

Parameters:
lastBuildDate -

setLink

public void setLink(String link)
Set the link

Parameters:
link -

setManagingEditor

public void setManagingEditor(String managingEditor)
Set the managing editor

Parameters:
managingEditor -

setNewsThatMatchSearch

public void setNewsThatMatchSearch(Hashtable parsedPattern,
                                   Vector regEx)
Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable

Parameters:
parsedPattern - The parsed pattern
regEx - Vector with regular expressions

setNewsThatMatchSearch

public void setNewsThatMatchSearch(String patternStr)
Perform the search and add the NewsItems that match the pattern to the searchResultsItems Hashtable

Parameters:
patternStr - The RegEx pattern as String

setPubDate

public void setPubDate(String pubDate)
Set the publish date

Parameters:
pubDate -

setPublisher

public void setPublisher(String publisher)
Set the publisher

Parameters:
publisher -

setRSSFormat

public void setRSSFormat(String rssFormat)
Set the RSS Version

Parameters:
rssFormat -

setTitle

public void setTitle(String title)
Set the title

Parameters:
title -

setTtl

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

Parameters:
ttl -

setUpdateFrequency

public void setUpdateFrequency(String updateFrequency)
Set the update frequency

Parameters:
updateFrequency -

setUpdatePeriod

public void setUpdatePeriod(String updatePeriod)
Set the update period

Parameters:
updatePeriod -

setWebmaster

public void setWebmaster(String webmaster)
Set the webmaster

Parameters:
webmaster -

toDocument

public org.jdom.Document toDocument()
Create a RSS 0.91 XML document from the Channel. This is used when saving an aggregated category.

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(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


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo