cmu.survey.jsp.tags
Class SurveyData

java.lang.Object
  extended by cmu.survey.jsp.tags.SurveyData

public class SurveyData
extends java.lang.Object


Constructor Summary
SurveyData(DataBitStorage dataBitStorage, LoginInfo loginInfo)
           
SurveyData(DataBitStorage dataBitStorage, LoginInfo loginInfo, javax.servlet.jsp.PageContext pageContext)
           
SurveyData(java.lang.String databaseName, LoginInfo loginInfo)
           
SurveyData(java.lang.String databaseName, LoginInfo loginInfo, javax.servlet.jsp.PageContext pageContext)
           
 
Method Summary
 java.util.List<java.lang.String> getAllUsersData(java.lang.String table, java.lang.String variableName)
          Get a list of all the answers that all users have put in for a specific variable.
 java.lang.String getData(java.lang.String table, java.lang.String variableName)
          Get one answer or bit of user data from the database for the logged in user.
 java.lang.String[] getData(java.lang.String table, java.lang.String[] variableNames)
          Get several answer or bit of user data from the database for the logged in user.
 java.lang.String[] getData(java.lang.String table, java.lang.String[] variableNames, java.lang.String repeatedMeasureVariable, java.lang.Object repeatedMeasureValue)
          Get several answer or bit of user data from the database for the logged in user.
 java.lang.String getData(java.lang.String table, java.lang.String variableName, java.lang.String repeatedMeasureVariable, java.lang.Number repeatedMeasureValue)
          Get several answer or bit of user data from the database for the logged in user.
 java.lang.String getData(java.lang.String table, java.lang.String variableName, java.lang.String repeatedMeasureVariable, java.lang.String repeatedMeasureValue)
           
 int getNumberOfUsers()
           
 javax.servlet.jsp.PageContext getPageContext()
           
 RandomizeGenerator getRandomizer()
           
 DataTableModel getTable(java.lang.String table)
          For advanced usage, you can get a full table straight from the database.
 java.lang.String getUserHostName()
           
 java.lang.String getUserID()
           
 boolean hasHostNameBeenUsedBefore()
           
 boolean isLoggedIn()
           
 void redirectTo(java.lang.String pageName)
           
 void saveUserHostName()
           
 boolean setData(java.lang.String table, java.lang.String variableName, java.lang.Object value)
           
 boolean setData(java.lang.String table, java.lang.String variableName, java.lang.String repeatedMeasureVariable, java.lang.Object repeatedMeasureValue, java.lang.Object value)
           
 void uninit()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurveyData

public SurveyData(DataBitStorage dataBitStorage,
                  LoginInfo loginInfo)

SurveyData

public SurveyData(DataBitStorage dataBitStorage,
                  LoginInfo loginInfo,
                  javax.servlet.jsp.PageContext pageContext)

SurveyData

public SurveyData(java.lang.String databaseName,
                  LoginInfo loginInfo)

SurveyData

public SurveyData(java.lang.String databaseName,
                  LoginInfo loginInfo,
                  javax.servlet.jsp.PageContext pageContext)
Method Detail

getUserID

public java.lang.String getUserID()

isLoggedIn

public boolean isLoggedIn()

getUserHostName

public java.lang.String getUserHostName()

saveUserHostName

public void saveUserHostName()

hasHostNameBeenUsedBefore

public boolean hasHostNameBeenUsedBefore()

getNumberOfUsers

public int getNumberOfUsers()

getTable

public DataTableModel getTable(java.lang.String table)
For advanced usage, you can get a full table straight from the database. Make sure to call "close()" on the table when you are done.

Parameters:
table -
Returns:

getData

public java.lang.String getData(java.lang.String table,
                                java.lang.String variableName)
Get one answer or bit of user data from the database for the logged in user. If the user is not logged in, this will return null. It will also return null if the database data is null.

Parameters:
table - the table in the database to pull the data from
variableName - the name of the variable in the table
Returns:

getAllUsersData

public java.util.List<java.lang.String> getAllUsersData(java.lang.String table,
                                                        java.lang.String variableName)
Get a list of all the answers that all users have put in for a specific variable. For example, if you want to show users what everyone else has answered, say, for a "other" variable for voting for a new name, you would do this in JSP: <% List answers = getAllUsersData("Answers", "surveyName"); if (answers!=null) for (int i=0; i0) %>  <%=answers.get(i)%>
<% } %>

Parameters:
table -
variableName -
Returns:

setData

public boolean setData(java.lang.String table,
                       java.lang.String variableName,
                       java.lang.Object value)

setData

public boolean setData(java.lang.String table,
                       java.lang.String variableName,
                       java.lang.String repeatedMeasureVariable,
                       java.lang.Object repeatedMeasureValue,
                       java.lang.Object value)

getData

public java.lang.String[] getData(java.lang.String table,
                                  java.lang.String[] variableNames)
Get several answer or bit of user data from the database for the logged in user. If the user is not logged in, this will return null. It will also return null if the database data is null.

Parameters:
table - the table in the database to pull the data from
variableNames - the names of the variable in the table
Returns:

getData

public java.lang.String[] getData(java.lang.String table,
                                  java.lang.String[] variableNames,
                                  java.lang.String repeatedMeasureVariable,
                                  java.lang.Object repeatedMeasureValue)
Get several answer or bit of user data from the database for the logged in user. If the user is not logged in, this will return null. It will also return null if the database data is null. It will return null if there is no such row in the database. If the row in the database exists, but all values are null, it will return an array filled with null.

Parameters:
table - the table in the database to pull the data from
variableNames - the names of the variable in the table
Returns:

getData

public java.lang.String getData(java.lang.String table,
                                java.lang.String variableName,
                                java.lang.String repeatedMeasureVariable,
                                java.lang.Number repeatedMeasureValue)
Get several answer or bit of user data from the database for the logged in user. If the user is not logged in, this will return null. It will also return null if the database data is null.

Parameters:
table - the table in the database to pull the data from
variableNames - the names of the variable in the table
Returns:

getData

public java.lang.String getData(java.lang.String table,
                                java.lang.String variableName,
                                java.lang.String repeatedMeasureVariable,
                                java.lang.String repeatedMeasureValue)

getRandomizer

public RandomizeGenerator getRandomizer()

uninit

public void uninit()

getPageContext

public javax.servlet.jsp.PageContext getPageContext()

redirectTo

public void redirectTo(java.lang.String pageName)