net.sourceforge.java.feednread.backend.model.newstable
Class AggregatedNewsFeed

java.lang.Object
  extended bynet.sourceforge.java.feednread.backend.model.newstable.NewsFeed
      extended bynet.sourceforge.java.feednread.backend.model.newstable.AggregatedNewsFeed
All Implemented Interfaces:
Comparable, IArchivable, INewsFeedStatus, Serializable

public class AggregatedNewsFeed
extends NewsFeed

Container for NewsFeeds to model an aggregation.

Author:
Sebastian Machhausen
See Also:
Serialized Form

Field Summary
private  List newsFeeds
           The List of aggregated NewsFeeds
static long serialVersionUID
           The serialVersionUID of this class
 
Fields inherited from class net.sourceforge.java.feednread.backend.model.newstable.NewsFeed
newsFeedEntries, originalFeed, url
 
Constructor Summary
AggregatedNewsFeed()
           Creates a new empty AggregatedNewsFeed with an unique url.
 
Method Summary
 void add(List entries)
           Adds the list of NewsFeedEntry feed entries to this AggregatedNewsFeed.
 void add(NewsFeed newsFeed)
           Adds a NewsFeed to this AggregatedNewsFeed.
 void addToArchive(NewsFeedArchive archive)
           Adds this AggregatedNewsFeed to the specified NewsFeedArchive.
 boolean contains(NewsFeed newsFeed)
           Returns true if the specified NewsFeed is aggregated in this AggregatedNewsFeed.
private  String createUniqueUrl()
           Creates an unique url for this AggregatedNewsFeed.
 boolean equals(Object obj)
           Tests if this AggregatedNewsFeed is equal to the specified obj.
 NewsFeed[] getNewsFeeds()
           Get all NewsFeeds aggregated in this AggregatedNewsFeed.
 int hashCode()
           Calculates the hashcode of this AggregatedNewsFeed.
 void remove(NewsFeed newsFeed)
           Removes the specified NewsFeed from this AggregatedNewsFeed.
private  void replace(NewsFeed replacedFeed, NewsFeed replacementFeed)
           Replaces replacedFeed with the specified replacementFeed.
 void synchronizeWithArchive(NewsFeedArchive archive)
           Synchronizes this AggregatedNewsFeed with the specified NewsFeedArchive.
 
Methods inherited from class net.sourceforge.java.feednread.backend.model.newstable.NewsFeed
compareTo, getAuthors, getCopyright, getDescription, getEncoding, getEntries, getFeedType, getImage, getLanguage, getLink, getOriginalEntries, getOriginalFeed, getPublishedDate, getReadCount, getReadNews, getTitle, getUnreadCount, getUnreadNews, getUrl, isUnread, markAllRead, markAllUnread, setAuthors, setCopyright, setDescription, setEncoding, setEntries, setFeedType, setImage, setLanguage, setLink, setOriginalEntries, setPublishedDate, setTitle, setUrl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID

The serialVersionUID of this class

See Also:
Constant Field Values

newsFeeds

private List newsFeeds

The List of aggregated NewsFeeds

Constructor Detail

AggregatedNewsFeed

public AggregatedNewsFeed()

Creates a new empty AggregatedNewsFeed with an unique url.

Method Detail

equals

public boolean equals(Object obj)

Tests if this AggregatedNewsFeed is equal to the specified obj. Two AggregatedNewsFeed instances are considered equal if they are both instances of the AggregatedNewsFeed class and if all embedded NewsFeed instances are equal, i.e. all point to the same urls as returned by the NewsFeed.getUrl() method.

Overrides:
equals in class NewsFeed
Parameters:
obj - the Object to be tested against this AggregatedNewsFeed for equality
Returns:
true if this AggregatedNewsFeed is equal to the specified obj; false otherwise

hashCode

public int hashCode()

Calculates the hashcode of this AggregatedNewsFeed.

Overrides:
hashCode in class NewsFeed
Returns:
the hashcode of this AggregatedNewsFeed

add

public void add(NewsFeed newsFeed)

Adds a NewsFeed to this AggregatedNewsFeed.

Parameters:
newsFeed - the NewsFeed to add

contains

public boolean contains(NewsFeed newsFeed)

Returns true if the specified NewsFeed is aggregated in this AggregatedNewsFeed.

Parameters:
newsFeed - the NewsFeed to test
Returns:
true if the specified NewsFeed is aggregated in this AggregatedNewsFeed; false otherwise

getNewsFeeds

public NewsFeed[] getNewsFeeds()

Get all NewsFeeds aggregated in this AggregatedNewsFeed.

Returns:
all NewsFeeds aggregated in this AggregatedNewsFeed

add

public void add(List entries)

Adds the list of NewsFeedEntry feed entries to this AggregatedNewsFeed.

Parameters:
entries - the list of NewsFeedEntry elements with the feed entries to add

remove

public void remove(NewsFeed newsFeed)

Removes the specified NewsFeed from this AggregatedNewsFeed.

Parameters:
newsFeed - the NewsFeed to remove

addToArchive

public void addToArchive(NewsFeedArchive archive)

Adds this AggregatedNewsFeed to the specified NewsFeedArchive. This is done by querying a potential existing ArchivedNewsFeed and adding all NewsFeedEntry objects to it. If no ArchivedNewsFeed yet exists in the specified NewsFeedArchive a new one has to be created and filled with thisAggregatedNewsFeed's entries.

Specified by:
addToArchive in interface IArchivable
Overrides:
addToArchive in class NewsFeed
Parameters:
archive - the NewsFeedArchive to use for synchronization
See Also:
NewsFeedArchive

synchronizeWithArchive

public void synchronizeWithArchive(NewsFeedArchive archive)

Synchronizes this AggregatedNewsFeed with the specified NewsFeedArchive. This is done by reconciling each embedded NewsFeedEntry with the entries in an archived ArchivedNewsFeed.

Specified by:
synchronizeWithArchive in interface IArchivable
Overrides:
synchronizeWithArchive in class NewsFeed
Parameters:
archive - the NewsFeedArchive to use for synchronization
See Also:
NewsFeedArchive

replace

private void replace(NewsFeed replacedFeed,
                     NewsFeed replacementFeed)

Replaces replacedFeed with the specified replacementFeed.

Parameters:
replacedFeed - the NewsFeed to be replaced
replacementFeed - the NewsFeed to act as replacement

createUniqueUrl

private String createUniqueUrl()

Creates an unique url for this AggregatedNewsFeed.

Returns:
an unique url for this AggregatedNewsFeed