de.nava.informa.impl.basic
Class Item

java.lang.Object
  extended by de.nava.informa.impl.basic.Item
All Implemented Interfaces:
ItemIF, WithCategoriesMIF, WithChannelMIF, WithCreatorMIF, WithDescriptionMIF, WithElementsAndAttributesMIF, WithIdMIF, WithLinkMIF, WithTitleMIF, WithUnreadMIF, Serializable
Direct Known Subclasses:
Item

public class Item
extends Object
implements ItemIF

In-Memory implementation of the ItemIF interface.

Author:
Niko Schmuck (niko@nava.de)
See Also:
Serialized Form

Constructor Summary
Item()
           
Item(ChannelIF channel, String title, String description, URL link)
           
Item(org.jdom.Element itemElement, ChannelIF channel, String title, String description, URL link)
           
Item(org.jdom.Element itemElement, String title, String description, URL link)
           
Item(String title, String description, URL link)
           
 
Method Summary
 void addCategory(CategoryIF category)
           
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 String getAttributeValue(String path, String attribute)
          Returns the value of the attribute of the Channel's child element reached by the given path.
 String[] getAttributeValues(String path, String[] attributes)
          Returns the values of the specified attributes of the Channel's child element reached by the given path.
 Collection getCategories()
          Gets the assigned category objects for this channel.
 ChannelIF getChannel()
           
 URL getComments()
           
 String getCreator()
           
 Date getDate()
           
 String getDescription()
           
 String getElementValue(String path)
          Returns the value of the Channel's child element reached by the given path.
 String[] getElementValues(String path, String[] elements)
          Returns the values of the specified sub-elements of the Channel's child reached by the given path.
 ItemEnclosureIF getEnclosure()
           
 Date getFound()
           
 ItemGuidIF getGuid()
           
 long getId()
           
 URL getLink()
           
 ItemSourceIF getSource()
           
 String getSubject()
           
 String getTitle()
           
 boolean getUnRead()
           
 int hashCode()
          Returns a hash code value for the object.
 void removeCategory(CategoryIF category)
           
 void setCategories(Collection<CategoryIF> categories)
           
 void setChannel(ChannelIF channel)
           
 void setComments(URL comments)
           
 void setCreator(String creator)
           
 void setDate(Date date)
           
 void setDescription(String description)
           
 void setEnclosure(ItemEnclosureIF enclosure)
           
 void setFound(Date found)
           
 void setGuid(ItemGuidIF guid)
           
 void setId(long id)
           
 void setLink(URL link)
           
 void setSource(ItemSourceIF source)
           
 void setSubject(String subject)
           
 void setTitle(String title)
           
 void setUnRead(boolean val)
           
 String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Item

public Item()

Item

public Item(String title,
            String description,
            URL link)

Item

public Item(ChannelIF channel,
            String title,
            String description,
            URL link)

Item

public Item(org.jdom.Element itemElement,
            String title,
            String description,
            URL link)

Item

public Item(org.jdom.Element itemElement,
            ChannelIF channel,
            String title,
            String description,
            URL link)
Method Detail

getId

public long getId()
Specified by:
getId in interface WithIdMIF
Returns:
identifier of the object.

setId

public void setId(long id)
Specified by:
setId in interface WithIdMIF
Parameters:
id - the identifier of the object to be set.

getChannel

public ChannelIF getChannel()
Specified by:
getChannel in interface WithChannelMIF
Returns:
channel, this object is related to

setChannel

public void setChannel(ChannelIF channel)
Specified by:
setChannel in interface WithChannelMIF
Parameters:
channel - the channel, this object is related to

getTitle

public String getTitle()
Specified by:
getTitle in interface WithTitleMIF
Returns:
the title of the object

setTitle

public void setTitle(String title)
Specified by:
setTitle in interface WithTitleMIF
Parameters:
title - the title of the object to be set

getDescription

public String getDescription()
Specified by:
getDescription in interface WithDescriptionMIF
Returns:
description of the object

setDescription

public void setDescription(String description)
Specified by:
setDescription in interface WithDescriptionMIF
Parameters:
description - the description of the object to be set

getUnRead

public boolean getUnRead()
Specified by:
getUnRead in interface WithUnreadMIF
Returns:
boolean indicating whether this item is currently unread.

setUnRead

public void setUnRead(boolean val)
Specified by:
setUnRead in interface WithUnreadMIF
Parameters:
val - boolean to indicate whether this item is unread or not.

getLink

public URL getLink()
Specified by:
getLink in interface WithLinkMIF
Returns:
The URL where the request action should be sent to

setLink

public void setLink(URL link)
Specified by:
setLink in interface WithLinkMIF
Parameters:
link - the URL where the request action should be sent to

getCategories

public Collection getCategories()
Description copied from interface: WithCategoriesMIF
Gets the assigned category objects for this channel.

Specified by:
getCategories in interface WithCategoriesMIF
Returns:
A collection of CategoryIF objects, in the case of no assigned categories an empty collection is returned..

setCategories

public void setCategories(Collection<CategoryIF> categories)
Specified by:
setCategories in interface WithCategoriesMIF

addCategory

public void addCategory(CategoryIF category)
Specified by:
addCategory in interface WithCategoriesMIF

removeCategory

public void removeCategory(CategoryIF category)
Specified by:
removeCategory in interface WithCategoriesMIF

getCreator

public String getCreator()
Specified by:
getCreator in interface WithCreatorMIF
Returns:
Creator of the object. Returns null if nothing appropriate found. For RSS 0.91 and 2.0 feeds: return text under managingEditor element For RSS 1.0 feed: first checks if creator element exists as dublin core metadata, and then falls back to managingEditor element For RSS 2.0 entries: checks the author element for each entry or fallback to creator metadata element from dublin core For Atom 0.3 and 1.0 feeds: checks author element. For Atom 1.0, multiple authors are possible, in which case we return a list of authors delimited by semicolon. Note that the author name itself may contain a semicolon, in which case seperation of author names by splitting at every semicolon will not work.

setCreator

public void setCreator(String creator)
Specified by:
setCreator in interface WithCreatorMIF
Parameters:
creator - the creator of the object to be set

getSubject

public String getSubject()
Specified by:
getSubject in interface ItemIF

setSubject

public void setSubject(String subject)
Specified by:
setSubject in interface ItemIF

getDate

public Date getDate()
Specified by:
getDate in interface ItemIF

setDate

public void setDate(Date date)
Specified by:
setDate in interface ItemIF

getFound

public Date getFound()
Specified by:
getFound in interface ItemIF

setFound

public void setFound(Date found)
Specified by:
setFound in interface ItemIF

getGuid

public ItemGuidIF getGuid()
Specified by:
getGuid in interface ItemIF

setGuid

public void setGuid(ItemGuidIF guid)
Specified by:
setGuid in interface ItemIF

getComments

public URL getComments()
Specified by:
getComments in interface ItemIF

setComments

public void setComments(URL comments)
Specified by:
setComments in interface ItemIF

getSource

public ItemSourceIF getSource()
Specified by:
getSource in interface ItemIF

setSource

public void setSource(ItemSourceIF source)
Specified by:
setSource in interface ItemIF

getEnclosure

public ItemEnclosureIF getEnclosure()
Specified by:
getEnclosure in interface ItemIF

setEnclosure

public void setEnclosure(ItemEnclosureIF enclosure)
Specified by:
setEnclosure in interface ItemIF

getElementValue

public String getElementValue(String path)
Description copied from interface: WithElementsAndAttributesMIF
Returns the value of the Channel's child element reached by the given path.
For example, getElementValue("image/title") will return the title of the Channel's image element.

Specified by:
getElementValue in interface WithElementsAndAttributesMIF
Parameters:
path - a path to the child. Paths are specified as element names, separated by a "/". Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee".
Returns:
the value of the child. Returns null if path is null.

getElementValues

public String[] getElementValues(String path,
                                 String[] elements)
Description copied from interface: WithElementsAndAttributesMIF
Returns the values of the specified sub-elements of the Channel's child reached by the given path. This is useful in cases where a child has several children.
For example, getElementValues("image", new String[] {"title", "url", "link", "width", "height", "description"} ) will return the specified sub-elements of the "image" element.

Specified by:
getElementValues in interface WithElementsAndAttributesMIF
Parameters:
path - a path to the child. Paths are specified as element names, separated by a "/". Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee".
elements - An array of element names. May contain namespace specifiers.
Returns:
an array containing the value of each element.
If path is null, returns the specified sub-elements for the Channel. If elements is null, returns null.

getAttributeValue

public String getAttributeValue(String path,
                                String attribute)
Description copied from interface: WithElementsAndAttributesMIF
Returns the value of the attribute of the Channel's child element reached by the given path.
For example, getAttributeValue("admin:generatorAgent", "rdf:resource") will return the "rdf:resource" attribute of the Channel's "admin:generatorAgent" element.

Specified by:
getAttributeValue in interface WithElementsAndAttributesMIF
Parameters:
path - a path to the root of the elements. Paths are specified as element names, separated by a "/".
attribute - the attribute. May contain a namespace specifier e.g. "rdf:resource".
Returns:
the value of the attribute.
If path is null, returns the specified attribute for the Channel. If attribute is null, returns null.

getAttributeValues

public String[] getAttributeValues(String path,
                                   String[] attributes)
Description copied from interface: WithElementsAndAttributesMIF
Returns the values of the specified attributes of the Channel's child element reached by the given path. This is useful in cases where a child has several attributes.

Specified by:
getAttributeValues in interface WithElementsAndAttributesMIF
Parameters:
path - a path to the child. Paths are specified as element names, separated by a "/". Namespaces are allowed. e.g. "aaa:bbb/ccc:ddd/eee".
attributes - An array of element names. May contain namespace specifiers.
Returns:
an array containing the value of each attribute.
If path is null, returns the specified attributes for the Channel. If attributes is null, returns null.

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise. NOTE: Please keep this code in sync with de.nava.informa.impl.hibernate.Item.equals().
See Also:
hashCode()

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable. NOTE: Please keep this code in sync with de.nava.informa.impl.hibernate.Item.hashCode().

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.


Copyright © 2002-2007 Niko Schmuck. All Rights Reserved.