cmu.jspsurveymanager.data
Class Survey

java.lang.Object
  extended by cmu.jspsurveymanager.data.Survey

public class Survey
extends java.lang.Object

User JavaBean represents admin user information cached from the database. Developed by Peter Centgraf as final project for the CMU 15-397: Web Application Development course, Spring 2004. Almost entirely updated by Saagar Patel on 2004-12-17 to take advantage of the new TableStorage functionality and remove SQL calls from the code.

See Also:
SurveyStorage

Nested Class Summary
 class Survey.Permission
          A utility class used to determine and set permissions relating to specific Admins and surveys.
 
Constructor Summary
Survey(int id, java.lang.String title, Survey.Permission perm, java.lang.String dbHost, java.lang.String dbDatabase, java.lang.String dbUser, java.lang.String dbPassword, java.lang.String webappPath, java.lang.String path, SurveyStorage s)
          Builds a Survey based upon a given unique id, title, and permissions.
Survey(SurveyStorage s)
          Required default constructor.
 
Method Summary
 Survey.Permission defaultPermission()
           
 void delete()
          Deletes this survey.
 java.lang.String getDatabaseConnectionDatabase()
          Returns the database connection database name
 java.lang.String getDatabaseConnectionHost()
          Returns the database connection host
 java.lang.String getDatabaseConnectionPassword()
          Returns the database connection user name
 java.lang.String getDatabaseConnectionUser()
          Returns the database connection user name
 java.lang.String getFilesystemLocation()
           
 boolean getHasBeenModified()
          Determines whether this survey has been modified since being loaded.
 int getId()
          Returns the unique ID of this survey (or -1 if the survey has not yet been stored).
 java.lang.String getTitle()
          Returns title
 java.lang.String getWebappPath()
           
 Survey.Permission permissions()
          Provides an interface to set permissions to this survey.
 boolean save()
          Saves this survey.
 void setDatabaseConnectionDatabase(java.lang.String database)
          Sets the database connection database name
 void setDatabaseConnectionHost(java.lang.String host)
          Sets the database connection host
 void setDatabaseConnectionPassword(java.lang.String password)
          Sets the database connection database user
 void setDatabaseConnectionUser(java.lang.String user)
          Sets the database connection database user
 void setFilesystemLocation(java.lang.String absolutePath)
           
 void setTitle(java.lang.String title)
          Sets title
 void setWebappPath(java.lang.String path)
           
 java.lang.String toString()
          A basic string representation of the Survey.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Survey

public Survey(SurveyStorage s)
Required default constructor. It is recommended that when creating a new Survey, the Admin who is creating it is given all permissions to it -- otherwise, nobody will have Permissions to modify the Survey.


Survey

public Survey(int id,
              java.lang.String title,
              Survey.Permission perm,
              java.lang.String dbHost,
              java.lang.String dbDatabase,
              java.lang.String dbUser,
              java.lang.String dbPassword,
              java.lang.String webappPath,
              java.lang.String path,
              SurveyStorage s)
Builds a Survey based upon a given unique id, title, and permissions.

Parameters:
id - The unique ID for this survey
title - The title (50 character max) of this survey
perm - The permissions to be attributed to this survey.
Method Detail

getId

public int getId()
Returns the unique ID of this survey (or -1 if the survey has not yet been stored).

Returns:
the ID

setTitle

public void setTitle(java.lang.String title)
Sets title

Parameters:
title - a String, 50 character max

getTitle

public java.lang.String getTitle()
Returns title

Returns:
the title

toString

public java.lang.String toString()
A basic string representation of the Survey.

Overrides:
toString in class java.lang.Object
Returns:
Survey representation

getHasBeenModified

public boolean getHasBeenModified()
Determines whether this survey has been modified since being loaded.

Returns:

permissions

public Survey.Permission permissions()
Provides an interface to set permissions to this survey.

Returns:

save

public boolean save()
Saves this survey.


delete

public void delete()
Deletes this survey. Note that any references to this survey will be invalid after deleting it.


setDatabaseConnectionHost

public void setDatabaseConnectionHost(java.lang.String host)
Sets the database connection host


getDatabaseConnectionHost

public java.lang.String getDatabaseConnectionHost()
Returns the database connection host


setDatabaseConnectionDatabase

public void setDatabaseConnectionDatabase(java.lang.String database)
Sets the database connection database name


getDatabaseConnectionDatabase

public java.lang.String getDatabaseConnectionDatabase()
Returns the database connection database name


setDatabaseConnectionUser

public void setDatabaseConnectionUser(java.lang.String user)
Sets the database connection database user


getDatabaseConnectionUser

public java.lang.String getDatabaseConnectionUser()
Returns the database connection user name


setDatabaseConnectionPassword

public void setDatabaseConnectionPassword(java.lang.String password)
Sets the database connection database user


getDatabaseConnectionPassword

public java.lang.String getDatabaseConnectionPassword()
Returns the database connection user name


setWebappPath

public void setWebappPath(java.lang.String path)

getWebappPath

public java.lang.String getWebappPath()

defaultPermission

public Survey.Permission defaultPermission()

getFilesystemLocation

public java.lang.String getFilesystemLocation()

setFilesystemLocation

public void setFilesystemLocation(java.lang.String absolutePath)