model
Class Article

java.lang.Object
  extended by model.Article

public class Article
extends java.lang.Object

The Article class represents an article from an RSS feed. This class has two types of instantiations, one created directly from the database and one created by the parser. The latter has less knowledge of its environment (and in particular it has no database id number).

Author:
pgroudas

Field Summary
private  java.lang.String author
           
private  boolean hasId
           
private  int id
           
private  boolean inOutbox
           
private  boolean inTrash
           
private  int parentid
           
private  java.util.Date pubDate
           
private  int rating
           
private  boolean read
           
private  java.lang.String summary
           
private  java.lang.String title
           
private  java.lang.String url
           
 
Constructor Summary
Article(int id, int parentid, java.lang.String author, java.lang.String title, java.lang.String url, java.lang.String summary, java.util.Date pubDate, boolean read, boolean trash, boolean outbox, int rating)
          Constructor takes input information and constructs an Article object with a given id.
Article(java.lang.String author, java.lang.String title, java.lang.String url, java.lang.String summary, java.util.Date pubDate)
          Constructor takes input information and constructs an Article object.
 
Method Summary
 java.lang.String getAuthor()
          Get the article's author.
 int getId()
          Gets the article's id, if it was created in such a way that it has an id (i.e.
 int getParentid()
          Returns the article's parent id.
 java.util.Date getPubDate()
          Gets the article's published date, supplied on construction.
 int getRating()
          Returns the article's rating, an integer.
 boolean getRead()
          Returns the read status of the article.
 java.lang.String getSummary()
          Gets the article's summary, which is the (optional) bit of content displayed beneath the article's title in the mailbox view.
 java.lang.String getTitle()
          Gets the article's title.
 java.lang.String getUrl()
          Gets the article's url, supplied on construction.
private  boolean hasId()
          Tests if article knows its id (basically tests if this article was returned by the database)
 boolean isInOutbox()
          Tests to see if the article is in the outbox.
 boolean isInTrash()
          Tests to see if the article is in the trash.
 boolean isSame(Article a)
          Compares an article to another given article.
 void markRead(boolean read)
          Marks the article as read.
 void setInOutbox(boolean inOutbox)
          Sets the article's in-outbox status.
 void setInTrash(boolean inTrash)
          Sets the article's trashed status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

author

private java.lang.String author

title

private java.lang.String title

url

private java.lang.String url

summary

private java.lang.String summary

pubDate

private java.util.Date pubDate

read

private boolean read

inTrash

private boolean inTrash

inOutbox

private boolean inOutbox

hasId

private boolean hasId

rating

private int rating

id

private int id

parentid

private int parentid
Constructor Detail

Article

public Article(java.lang.String author,
               java.lang.String title,
               java.lang.String url,
               java.lang.String summary,
               java.util.Date pubDate)
Constructor takes input information and constructs an Article object. This represents an article which is brand new and has no id (intended usage is for the parser to create a new article, not for the database to create an article with existing information -- since any database construction should use the article's id.) By default, a new article is unread (read == false). It also has a default rating of zero. It is, by default, not in the Trash or Outbox. Additionally, it has no id (hasid = false).

Parameters:
author - Author of article; If null, it is set to the empty string
title - Title of article; If null, it is set to the empty string
url - URL of full article; If null, it is set to the empty string
summary - Text summary of article; If null, it is set to the empty string
pubDate - Date that article was published. If null, it is passed along as null.

Article

public Article(int id,
               int parentid,
               java.lang.String author,
               java.lang.String title,
               java.lang.String url,
               java.lang.String summary,
               java.util.Date pubDate,
               boolean read,
               boolean trash,
               boolean outbox,
               int rating)
Constructor takes input information and constructs an Article object with a given id. This represents an article which already exists in the database (already has an id).

Parameters:
id - Internal id number for the article. (From a database; guaranteed to be unique.)
parentid - Internal id number for the article's parent.
author - Author of article. If null, becomes the empty string.
title - Title of article. If null, becomes the empty string.
url - URL of full article. If null, becomes the empty string.
summary - Text summary of article. If null, becomes the empty string.
pubDate - Date that article was published. If null, is passed along as a null date.
read - Whether or not the article has been read yet.
trash - Whether or not this article is in the trash.
outbox - Whether or not this article is in the outbox.
rating - The article's rating.
Method Detail

markRead

public void markRead(boolean read)
Marks the article as read. Any article can be marked as read; should always work, and returns nothing.

Parameters:
read - The new read status of the article (true->read, false->unread)

isSame

public boolean isSame(Article a)
Compares an article to another given article. Two articles are "the same" if they have the same author, title, and URL.

Parameters:
a - Article to be compared.
Returns:
true if the two articles have the same author, title, and url.

hasId

private boolean hasId()
Tests if article knows its id (basically tests if this article was returned by the database)

Returns:
boolean

getAuthor

public java.lang.String getAuthor()
Get the article's author. Because of the way this is constructed, should never be null (only the empty string.)

Returns:
String author

getPubDate

public java.util.Date getPubDate()
Gets the article's published date, supplied on construction.

Returns:
Date pubDate

getSummary

public java.lang.String getSummary()
Gets the article's summary, which is the (optional) bit of content displayed beneath the article's title in the mailbox view. This may be the empty string, but shouldn't be null.

Returns:
String summary

getTitle

public java.lang.String getTitle()
Gets the article's title. This should not be null.

Returns:
String title

getUrl

public java.lang.String getUrl()
Gets the article's url, supplied on construction. This should not be null.

Returns:
String url

getId

public int getId()
          throws java.lang.IllegalAccessException
Gets the article's id, if it was created in such a way that it has an id (i.e. if it was created by the database and not by the parser).

Returns:
int ID
Throws:
java.lang.IllegalAccessException - if this article has no id (this means the article wasn't made from the database)

getRead

public boolean getRead()
Returns the read status of the article. True means read, false means unread.

Returns:
boolean read

getRating

public int getRating()
Returns the article's rating, an integer.

Returns:
int rating

getParentid

public int getParentid()
Returns the article's parent id. This will be zero for an article that is not constructed from the database (and therefore has no knowledge of its parent).

Returns:
int parentid

isInTrash

public boolean isInTrash()
Tests to see if the article is in the trash. True means it is trashed.

Returns:
boolean inTrash

setInTrash

public void setInTrash(boolean inTrash)
Sets the article's trashed status. True means it is in the trash.

Parameters:
inTrash - boolean New trash status of the article

setInOutbox

public void setInOutbox(boolean inOutbox)
Sets the article's in-outbox status. True means it is in the outbox feed.

Parameters:
inOutbox - boolean New outbox status of the article

isInOutbox

public boolean isInOutbox()
Tests to see if the article is in the outbox.

Returns: