WPI GDC CMS 0.0.1

org.wpi.gdc.cms.main
Class NewsStory

java.lang.Object
  |
  +--org.wpi.gdc.cms.main.NewsStory

public class NewsStory
extends java.lang.Object

A news story.

Version:
1.7
Author:
dmpotter

Field Summary
static int FIELD_ABSTRACT
          The story abstract field.
static int FIELD_AUTHOR
          The story author field.
static int FIELD_BODY
          The story body field.
static int FIELD_HEADLINE
          The story headline field.
static int FIELD_ID
          The story ID field.
static int FIELD_POSTED
          The story posted field.
static int FIELD_TOPIC
          The story topic field.
 
Constructor Summary
NewsStory(int id, User author, Topic topic, java.util.Calendar posted, java.lang.String headline, java.lang.String abstractBody, java.lang.String fullBody)
          Creates a new NewsStory based on the passed values.
 
Method Summary
 java.lang.String getAbstract()
          Gets the abstract of the story.
 User getAuthor()
          Gets the author of the article.
 java.lang.String getBody()
          Gets the full body of the story.
 java.lang.String getHeadline()
          Gets the headline of the story.
 int getID()
          Gets the ID of the news story.
 java.util.Calendar getPosted()
          Gets the time the story was posted.
 Topic getTopic()
          Gets the Topic object for this story.
 void setAbstract(java.lang.String abstractBody)
          Sets the abstract of the story.
 void setAuthor(User author)
          Sets the author of the article.
 void setBody(java.lang.String fullBody)
          Sets the full body of the story.
 void setHeadline(java.lang.String headline)
          Sets the headline of the story.
 void setID(int id)
          Sets the story ID.
 void setPosted(java.util.Calendar posted)
          Sets the time the story was posted.
 void setTopic(Topic topic)
          Sets the Topic object for this story.
 java.lang.String toString()
          Creates a string that represents the fields in the story.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_ID

public static final int FIELD_ID
The story ID field.
See Also:
getID()

FIELD_AUTHOR

public static final int FIELD_AUTHOR
The story author field.
See Also:
getAuthor()

FIELD_TOPIC

public static final int FIELD_TOPIC
The story topic field.
See Also:
getTopic()

FIELD_POSTED

public static final int FIELD_POSTED
The story posted field.
See Also:
getPosted()

FIELD_HEADLINE

public static final int FIELD_HEADLINE
The story headline field.
See Also:
getHeadline()

FIELD_ABSTRACT

public static final int FIELD_ABSTRACT
The story abstract field.
See Also:
getAbstract()

FIELD_BODY

public static final int FIELD_BODY
The story body field.
See Also:
getBody()
Constructor Detail

NewsStory

public NewsStory(int id,
                 User author,
                 Topic topic,
                 java.util.Calendar posted,
                 java.lang.String headline,
                 java.lang.String abstractBody,
                 java.lang.String fullBody)
Creates a new NewsStory based on the passed values.
Parameters:
id - the ID of the story; set to a negative number for a story to be inserted into the DB layer.
author - the author of the story
topic - the topic this story belongs to
posted - when the story was posted
headline - the story's headline
abstractBody - a shorter version of the story
fullBody - the full version of the story
Method Detail

getID

public int getID()
Gets the ID of the news story.

The ID is used both for references and as the ID in the database.

Returns:
the ID of the news story

getAuthor

public User getAuthor()
Gets the author of the article.
Returns:
the author

getTopic

public Topic getTopic()
Gets the Topic object for this story.
Returns:
the topic

getPosted

public java.util.Calendar getPosted()
Gets the time the story was posted.

If the returned time is null, then the story has not been posted yet.

Returns:
the time the story was posted or null if it hasn't been posted

getHeadline

public java.lang.String getHeadline()
Gets the headline of the story.
Returns:
the headline

getAbstract

public java.lang.String getAbstract()
Gets the abstract of the story.

The abstract is a shorter version of the full body and is usually displayed on listing of stories.

Returns:
the abstract

getBody

public java.lang.String getBody()
Gets the full body of the story.

The full body is often longer than the abstract, and should be displayed separate from other stories.

Returns:
the abstract

setID

public void setID(int id)
Sets the story ID.

This may have consequences if changed randomly - changing the ID will NOT change the ID in the database, it will most likely be left in the DB with the old ID. Setting the id to a negative number will cause the story to replicated in the database.

Parameters:
id - the new ID

setAuthor

public void setAuthor(User author)
Sets the author of the article.
Parameters:
author - the author

setTopic

public void setTopic(Topic topic)
Sets the Topic object for this story.
Parameters:
topic - the new topic

setPosted

public void setPosted(java.util.Calendar posted)
Sets the time the story was posted.

Setting the time to null indicates it hasn't been posted yet.

Parameters:
posted - the time the story was posted or null if it hasn't been posted

setHeadline

public void setHeadline(java.lang.String headline)
Sets the headline of the story.
Parameters:
headline - the headline
Throws:
NullPointerException - if headline is null

setAbstract

public void setAbstract(java.lang.String abstractBody)
Sets the abstract of the story.

The abstract is a shorter version of the full body and is usually displayed on listing of stories.

Parameters:
abstractBody - the new abstract body
Throws:
NullPointerException - if abstractBody is null

setBody

public void setBody(java.lang.String fullBody)
Sets the full body of the story.

The full body is often longer than the abstract, and should be displayed separate from other stories.

Parameters:
fullBody - the full body of the story
Throws:
NullPointerException - if fullBody is null

toString

public java.lang.String toString()
Creates a string that represents the fields in the story.
Overrides:
toString in class java.lang.Object
Returns:
a string

WPI GDC CMS 0.0.1

Copyright © 2001 WPI Game Development Club. All Rights Reserved.