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

java.lang.Object
  extended bynet.sourceforge.java.feednread.backend.model.newstable.NewsFeedEntry
All Implemented Interfaces:
Comparable, Serializable

public class NewsFeedEntry
extends Object
implements Comparable, Serializable

Wrapper class for Rome SyndEntry news representation. It adds a marker flag for the read status and converts the news description to valid HTML 4.01 if only a plain text description is available.

Author:
Sebastian Machhausen
See Also:
Serialized Form

Field Summary
private  String authors
           The converted authors (comma separated list of authors)
private  String categories
           The converted categories (comma separated list of categories)
private  String description
           The HTML 4.01 converted news description
private  SyndEntry entry
           The original Rome SyndEntry representation
private  NewsFeed newsFeed
           The NewsFeed that the NewsFeedEntry is associated to
private  boolean read
           The news read status whereas true indicates a read and false an unread NewsFeedEntry<
private static long serialVersionUID
           The serialVersionUID of this class
private  boolean tagged
           The news tag status whereas true indicates a tagged and false an untagged NewsFeedEntry<
private  String title
           The trimmed news title
 
Constructor Summary
NewsFeedEntry(NewsFeed newsFeed, SyndEntry entry)
           Creates a new NewsFeedEntry wrapper for the specified Rome SyndEntry news representation.
 
Method Summary
 int compareTo(Object obj)
           Compares this NewsFeedEntry to another NewsFeedEntry object.
private  String convertAuthors()
           Converts the authors of the wrapped SyndEntry to a single String that separates the SyndPerson instances by commas.
private  String convertCategories()
           Converts the categories of the wrapped SyndEntry to a single String that separates the SyndCategory instances by commas.
private  String convertDescription()
           Converts the description of the wrapped SyndEntry to valid HTML 4.01.
private static String convertToHTML(SyndEntry entry)
           Converts the specified news entry to HTML.
 boolean equals(Object obj)
           Returns true if this NewsFeedEntry equals the specified obj, otherwise false.
 String getAuthors()
           Gets the news authors.
 String getCategories()
           Get the news categories.
 String getDescription()
           Gets the news description.
 String getLink()
           Gets the url link to the news.
 NewsFeed getNewsFeed()
           Gets the NewsFeed that this NewsFeedEntry is related to.
 Date getPublishedDate()
           Gets the news publication date.
 SyndEntry getSyndEntry()
           Gets the wrapped original Rome SyndEntry news representation.
 String getTitle()
           Gets the news title.
 boolean hasEnclosures()
           Returns true if this NewsFeedEntry holds any enclosures.
 boolean hasPodcastEnclosures()
           Returns true if this NewsFeedEntry holds any podcast enclosures.
 boolean isRead()
           Gets the read status of this news.
 boolean isTagged()
           Gets the tagged status of this news.
 void setRead(boolean read)
           Sets the read status of this news.
 void setTagged(boolean tagged)
           Sets the tagged status of this news.
 String toString()
           Returns the textual representation of this NewsFeedEntry.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID

The serialVersionUID of this class

See Also:
Constant Field Values

entry

private SyndEntry entry

The original Rome SyndEntry representation


description

private String description

The HTML 4.01 converted news description


categories

private String categories

The converted categories (comma separated list of categories)


authors

private String authors

The converted authors (comma separated list of authors)


title

private String title

The trimmed news title


read

private boolean read

The news read status whereas true indicates a read and false an unread NewsFeedEntry<


tagged

private boolean tagged

The news tag status whereas true indicates a tagged and false an untagged NewsFeedEntry<


newsFeed

private NewsFeed newsFeed

The NewsFeed that the NewsFeedEntry is associated to

Constructor Detail

NewsFeedEntry

public NewsFeedEntry(NewsFeed newsFeed,
                     SyndEntry entry)

Creates a new NewsFeedEntry wrapper for the specified Rome SyndEntry news representation.

Parameters:
newsFeed - the NewsFeed that this NewsFeedEntry is related to
entry - the original Rome news entry representation
Method Detail

equals

public boolean equals(Object obj)

Returns true if this NewsFeedEntry equals the specified obj, otherwise false. Two NewsFeedEntry objects are considered equal if their publishedDate, title and url match.

Parameters:
obj - the NewsFeedEntry instance to compare with this NewsFeedEntry instance
Returns:
true if this NewsFeedEntry equals the specified obj, otherwise false

compareTo

public int compareTo(Object obj)

Compares this NewsFeedEntry to another NewsFeedEntry object.

Specified by:
compareTo in interface Comparable
Parameters:
obj - a second NewsFeedEntry object to compare this NewsFeedEntry to
Returns:
a negative integer, zero, or a positive integer as this NewsFeedEntry is less than, equal to, or greater than the specified NewsFeedEntry object.

getNewsFeed

public NewsFeed getNewsFeed()

Gets the NewsFeed that this NewsFeedEntry is related to.

Returns:
the NewsFeed that this NewsFeedEntry is related to

getSyndEntry

public SyndEntry getSyndEntry()

Gets the wrapped original Rome SyndEntry news representation.

Returns:
the wrapped original Rome SyndEntry news representation

getTitle

public String getTitle()

Gets the news title.

Returns:
the news title

getLink

public String getLink()

Gets the url link to the news.

Returns:
the url link to the news

getDescription

public String getDescription()

Gets the news description.

Returns:
the news description

getAuthors

public String getAuthors()

Gets the news authors.

Returns:
the news authors

getPublishedDate

public Date getPublishedDate()

Gets the news publication date.

Returns:
the news publication date

getCategories

public String getCategories()

Get the news categories.

Returns:
the news categories

setRead

public void setRead(boolean read)

Sets the read status of this news.

Parameters:
read - true to mark this news as read, false to mark it as unread

isRead

public boolean isRead()

Gets the read status of this news.

Returns:
true if this news has been read, false if unread

setTagged

public void setTagged(boolean tagged)

Sets the tagged status of this news.

Parameters:
tagged - true to tag this news, false to untag

isTagged

public boolean isTagged()

Gets the tagged status of this news.

Returns:
true if this news has been tagged, false if untagged

hasEnclosures

public boolean hasEnclosures()

Returns true if this NewsFeedEntry holds any enclosures.

Returns:
true if this NewsFeedEntry holds any enclosures; false otherwise

hasPodcastEnclosures

public boolean hasPodcastEnclosures()

Returns true if this NewsFeedEntry holds any podcast enclosures.

Returns:
true if this NewsFeedEntry holds any podcast enclosures; false otherwise

toString

public String toString()

Returns the textual representation of this NewsFeedEntry.

Returns:
the textual representation of this NewsFeedEntry

convertDescription

private String convertDescription()

Converts the description of the wrapped SyndEntry to valid HTML 4.01.

Returns:
the converted description as HTML 4.01

convertCategories

private String convertCategories()

Converts the categories of the wrapped SyndEntry to a single String that separates the SyndCategory instances by commas.

Returns:
the converted categories

convertAuthors

private String convertAuthors()

Converts the authors of the wrapped SyndEntry to a single String that separates the SyndPerson instances by commas.

Returns:
the converted authors

convertToHTML

private static String convertToHTML(SyndEntry entry)

Converts the specified news entry to HTML. HTML 4.01 is being used.

Parameters:
entry - the news entry to convert
Returns:
the converted news entry as HTML