de.nava.informa.impl.hibernate
Class Item

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

public class Item
extends Object
implements ItemIF

Hibernate 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 getCommentsString()
           
 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()
           
 String getLinkString()
           
 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> aCategories)
           
 void setChannel(ChannelIF parentChannel)
           
 void setComments(URL comments)
           
 void setCommentsString(String commentsStr)
           
 void setCreator(String aCreator)
           
 void setDate(Date aDate)
           
 void setDescription(String aDescription)
           
 void setEnclosure(ItemEnclosureIF anEnclosure)
           
 void setFound(Date foundDate)
           
 void setGuid(ItemGuidIF guid)
           
 void setId(long id)
           
 void setLink(URL aLink)
           
 void setLinkString(String linkStr)
           
 void setSource(ItemSourceIF aSource)
           
 void setSubject(String aSubject)
           
 void setTitle(String aTitle)
           
 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:
integer representation of identity.

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:
parent channel.

setChannel

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

getTitle

public String getTitle()
Specified by:
getTitle in interface WithTitleMIF
Returns:
title.

setTitle

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

getDescription

public String getDescription()
Specified by:
getDescription in interface WithDescriptionMIF
Returns:
description.

setDescription

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

getUnRead

public boolean getUnRead()
Specified by:
getUnRead in interface WithUnreadMIF
Returns:
unread flag.

setUnRead

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

getLinkString

public String getLinkString()
Returns:
link to original article.

setLinkString

public void setLinkString(String linkStr)

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 aLink)
Specified by:
setLink in interface WithLinkMIF
Parameters:
aLink - 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:
categories.

setCategories

public void setCategories(Collection<CategoryIF> aCategories)
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.

setCreator

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

getSubject

public String getSubject()
Specified by:
getSubject in interface ItemIF
Returns:
subject.

setSubject

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

getDate

public Date getDate()
Specified by:
getDate in interface ItemIF
Returns:
date.

setDate

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

getFound

public Date getFound()
Specified by:
getFound in interface ItemIF
Returns:
date when item was found.

setFound

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

getGuid

public ItemGuidIF getGuid()
Specified by:
getGuid in interface ItemIF
Returns:
guid.

setGuid

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

getCommentsString

public String getCommentsString()
Returns:
comments.

setCommentsString

public void setCommentsString(String commentsStr)

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
Returns:
source.

setSource

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

getEnclosure

public ItemEnclosureIF getEnclosure()
Specified by:
getEnclosure in interface ItemIF
Returns:
enclosure.

setEnclosure

public void setEnclosure(ItemEnclosureIF anEnclosure)
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.

toString

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

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

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.basic.Item.hashCode().

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


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