net.sourceforge.eclipsetrader.core.db
Class NewsItem

java.lang.Object
  extended byjava.util.Observable
      extended bynet.sourceforge.eclipsetrader.core.db.PersistentObject
          extended bynet.sourceforge.eclipsetrader.core.db.NewsItem

public class NewsItem
extends PersistentObject

Instances of this class represents a news headline.


Constructor Summary
NewsItem()
          Construct an empty news item.
NewsItem(java.lang.Integer id)
          Construct an empty news item with the given id.
 
Method Summary
 void addSecurities(java.util.List list)
          Adds the securities in the given list to the list of securities related to this headline.
 void addSecurity(Security security)
          Adds a security to the list of securities related to this headline.
 boolean equals(java.lang.Object obj)
          Compares two headline objects for equality.
 java.util.Date getDate()
          Returns the headline's date.
 java.util.List getSecurities()
          Returns an unmodifiable list of securities related to this headline.
 java.lang.String getSource()
          Returns the headline's source (news agency).
 java.lang.String getTitle()
          Returns the headline's title.
 java.lang.String getUrl()
          Returns the url of the headline's web page.
 boolean isReaded()
          Returns wether this headline was readed by the user.
 boolean isRecent()
          Returns wether this headline was recently added to the database.
 boolean isSecurity(Security security)
          Returns wether this headline is related to the given security.
 void setDate(java.util.Date date)
          Sets the headline's date.
 void setReaded(boolean readed)
          Sets the readed flag.
 void setRecent(boolean recent)
          Sets the recently added flag.
 void setSecurities(java.util.List securities)
          Sets the list of securities related to this headline.
 void setSource(java.lang.String source)
          Sets the headline's source (news agency).
 void setTitle(java.lang.String title)
          Sets the headline's title.
 void setUrl(java.lang.String url)
          Sets the url of the headline's web page.
 
Methods inherited from class net.sourceforge.eclipsetrader.core.db.PersistentObject
clearChanged, getData, getId, getRepository, setChanged, setData, setId, setRepository
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewsItem

public NewsItem()
Construct an empty news item.


NewsItem

public NewsItem(java.lang.Integer id)
Construct an empty news item with the given id.

Method Detail

getDate

public java.util.Date getDate()
Returns the headline's date.

Returns:
the date.

setDate

public void setDate(java.util.Date date)
Sets the headline's date.

Parameters:
date - the date to set.

getTitle

public java.lang.String getTitle()
Returns the headline's title.

Returns:
the title.

setTitle

public void setTitle(java.lang.String title)
Sets the headline's title.

Parameters:
title - the title to set.

getSecurities

public java.util.List getSecurities()
Returns an unmodifiable list of securities related to this headline.

Returns:
a list of securities.

setSecurities

public void setSecurities(java.util.List securities)
Sets the list of securities related to this headline.


addSecurity

public void addSecurity(Security security)
Adds a security to the list of securities related to this headline.
Duplicates are ignored.

Parameters:
security - the security to add.

addSecurities

public void addSecurities(java.util.List list)
Adds the securities in the given list to the list of securities related to this headline.
Non security objects and duplicates are ignored.

Parameters:
list - the list of securities to add.

isSecurity

public boolean isSecurity(Security security)
Returns wether this headline is related to the given security.

Parameters:
security - the security to check.
Returns:
true if this headline is related to the security.

getSource

public java.lang.String getSource()
Returns the headline's source (news agency).

Returns:
the source name.

setSource

public void setSource(java.lang.String source)
Sets the headline's source (news agency).

Parameters:
source - the name to set.

getUrl

public java.lang.String getUrl()
Returns the url of the headline's web page.

Returns:
the headline's url.

setUrl

public void setUrl(java.lang.String url)
Sets the url of the headline's web page.

Parameters:
url - the url to set.

isRecent

public boolean isRecent()
Returns wether this headline was recently added to the database.
The means of 'recently added' is specific to the news provider plugin. The UI may display recently added headlines with a different font/color.
This field is not persisted across sessions.

Returns:
true if this headline was recently added to the database.

setRecent

public void setRecent(boolean recent)
Sets the recently added flag.
The means of 'recently added' is specific to the news provider plugin. The UI may display recently added headlines with a different font/color.
This field is not persisted across sessions.

Parameters:
recent - the recently flag status.

isReaded

public boolean isReaded()
Returns wether this headline was readed by the user.
The UI may display recently added headlines with a different font/color.

Returns:
true if this headline was readed by the user.

setReaded

public void setReaded(boolean readed)
Sets the readed flag.
The UI may display readed headlines with a different font/color.

Parameters:
readed - the readed flag status.

equals

public boolean equals(java.lang.Object obj)
Compares two headline objects for equality.
News items are considered equals if the headlines dates and titles are equal.

Overrides:
equals in class PersistentObject
Parameters:
obj - the object to compare.
Returns:
true if the given object is equal to this.