org.davesag.generica.core
Class Story

java.lang.Object
  extended byorg.davesag.generica.core.AbstractDateStamped
      extended byorg.davesag.generica.core.AbstractContent
          extended byorg.davesag.generica.core.AbstractExtensibleContent
              extended byorg.davesag.generica.core.AbstractText
                  extended byorg.davesag.generica.core.Story
All Implemented Interfaces:
Authorable, Content, DateStamped, Extensible, Localisable, Persistable, Serializable

public class Story
extends AbstractText

The Story bean represents a basic story suitable as a base for any content management system where stories should be displayed on a website. The stories are designed to be localizable.

Since:
Generica 1.0
Version:
CVS Revision $Id: Story.java,v 1.12 2004/04/08 13:19:08 davesag Exp $
Author:
Dave Sag http://www.davesag.com
See Also:
Serialized Form

Field Summary
protected  Category theCategory
          a category for this story
protected  List theComments
          a list of comments about this story
protected  String theDescription
          a short description of this story
protected  String theLink
          a url or other link for this story
 
Fields inherited from class org.davesag.generica.core.AbstractText
theAuthor, theText, theTitle
 
Fields inherited from class org.davesag.generica.core.AbstractExtensibleContent
theMetaData
 
Fields inherited from class org.davesag.generica.core.AbstractContent
theCountryCode, theLanguageCode
 
Fields inherited from class org.davesag.generica.core.AbstractDateStamped
theCreated, theId, theLastModified
 
Constructor Summary
Story()
          null constructor required by hibernate.
Story(String title, User author, String text, Locale loc)
          Constructor that takes a title, author, text and iso language code.
Story(String title, User author, String text, String lang)
          Constructor that takes a title, author, text and iso language code.
 
Method Summary
 void addComment(Comment comment)
          Add a Comment to this Story.
 boolean equals(Object o)
          Tests if the supplied object is equal to this Story.
 Category getCategory()
          the category.
 Comment getComment(int index)
          returns the Comment with the given index.
 List getComments()
          get the list of comments.
 String getDescription()
          the description.
 String getLink()
          the story link.
 int hashcode()
          hashode.
 void removeComment(Comment comment)
          Remove a Comment from this Story.
 void setCategory(Category cat)
          Set the Category for this Story.
 void setComment(int index, Comment picture)
          sets the Comment at the index specified.
 void setComments(List comments)
          Set this Story's comments list.
 void setDescription(String desc)
          Set a short description of this Story.
 void setLink(String link)
          Set an associated link for this Story.
 String toString()
          simple string of the story.
 
Methods inherited from class org.davesag.generica.core.AbstractText
getAuthor, getText, getTitle, setAuthor, setText, setTitle
 
Methods inherited from class org.davesag.generica.core.AbstractExtensibleContent
addMetaData, getMetaData, getMetaData, removeMetaData, setMetaData
 
Methods inherited from class org.davesag.generica.core.AbstractContent
getCountryCode, getLanguageCode, getLocale, setCountryCode, setLanguageCode, setLocale
 
Methods inherited from class org.davesag.generica.core.AbstractDateStamped
getCreated, getId, getLastModified, setCreated, setId, setLastModified, setTemplateId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.davesag.generica.core.DateStamped
getCreated, getLastModified, setCreated, setLastModified
 

Field Detail

theLink

protected String theLink
a url or other link for this story


theDescription

protected String theDescription
a short description of this story


theCategory

protected Category theCategory
a category for this story


theComments

protected List theComments
a list of comments about this story

Constructor Detail

Story

public Story()
null constructor required by hibernate.


Story

public Story(String title,
             User author,
             String text,
             String lang)
Constructor that takes a title, author, text and iso language code.

Parameters:
title - The title of the Story.
author - The User that wrote the story.
text - The text of the story.
lang - The ISO Language Code.

Story

public Story(String title,
             User author,
             String text,
             Locale loc)
Constructor that takes a title, author, text and iso language code.

Parameters:
title - The title of the Story.
author - The User that wrote the story.
text - The text of the story.
loc - The Locale we use to determine the ISO Language Code.
Method Detail

getLink

public String getLink()
the story link.

Returns:
An associated link for this Story. Can be null.
Hibernate Property:
length = "255"

setLink

public void setLink(String link)
Set an associated link for this Story.

Parameters:
link - A link for this Story.

getDescription

public String getDescription()
the description.

Returns:
A short description of this Story. Can be null.
Hibernate Property:
length = "1024"

setDescription

public void setDescription(String desc)
Set a short description of this Story.

Parameters:
desc - A description of this Story.

getCategory

public Category getCategory()
the category.

Returns:
This Story's Category. Can be null.

setCategory

public void setCategory(Category cat)
Set the Category for this Story.

Parameters:
cat - The Category of this Story.

getComments

public List getComments()
get the list of comments.

Returns:
The List of Comments about this Story.
Hibernate List:
lazy = "true" cascade="save-update"

setComments

public void setComments(List comments)
Set this Story's comments list.

Parameters:
comments - The List of Comments about this Story.

getComment

public Comment getComment(int index)
returns the Comment with the given index.

Parameters:
index - The index of the Comment you want.
Returns:
The Comment corresponding to the index or null if there was no picture for that index.

setComment

public void setComment(int index,
                       Comment picture)
sets the Comment at the index specified.

Parameters:
index - The index at which to set the Comment, overwriting any previous picture at that index.
picture - The picture to set.

addComment

public void addComment(Comment comment)
Add a Comment to this Story.

Parameters:
comment - The Comment to add.

removeComment

public void removeComment(Comment comment)
Remove a Comment from this Story.

Parameters:
comment - The Comment to remove.

toString

public String toString()
simple string of the story.

Specified by:
toString in class AbstractContent
Returns:
the story title. useful for debugging.

equals

public boolean equals(Object o)
Tests if the supplied object is equal to this Story.

Overrides:
equals in class AbstractText
Parameters:
o - The object to test against this Story. Must also be a Story to make sense.
Returns:
true if the two users have the same id.

hashcode

public int hashcode()
hashode.

Specified by:
hashcode in class AbstractContent
Returns:
a valid hashcode for this story.


Dave Sag Generica API version 0.5.9 - (prerelease) Copyright 2003 - 2004 Dave Sag.