cmu.survey.editor.data
Interface DataBitStorage

All Known Implementing Classes:
DataBitStorageSQL, DataBitStorageTable

public interface DataBitStorage


Field Summary
static int CANNOT_CHECK
           
static java.lang.String DEFAULT_USERS_TABLE_NAME
           
static int ERROR_FIXABLE
           
static int ERROR_FIXABLE_CREATE
           
static int ERROR_NOT_FIXABLE
           
static int ERROR_USER_FIXABLE
           
static int IS_GOOD
           
static int OPERATION_FAILED
           
static int OPERATION_PARTIALLY_SUCCEEDED
           
static int OPERATION_SUCCEEDED
           
 
Method Summary
 int createNewSurveyInDatabase()
          Fix a broken table by creating the survey database into this database.
 java.util.Vector<DataTableModel> getAllPossibleAnswerTableModels()
           
 java.util.Vector<java.lang.String> getAllPossibleAnswerTables()
           
 DataTableModel getAnswersTable()
           
 DataTableModel getAnswersTable(java.util.Vector<java.lang.Integer> userIDs)
           
 DataTableModel getAnswersTableNamed(java.lang.String answersTableName)
          Gets a table formatted for answers.
 PageTable getNewPage()
           
 QuestionDataBitSet getNewQuestion()
           
 Page getPage(int id)
           
 java.util.Vector<Page> getPages(java.lang.String pageName)
          Gets all pages by this name -- since it's possible that there are multiple pages by the same name.
 DataTableModel getRepeatedMeasuresTableNamed(java.lang.String repeatedMeasuresTableName)
          Get a table formatted for storing repeated measures (NOT an answers table for repeated measures, but for the list of repeated measures).
 Survey getSurvey()
          If it returns null, the database is in an old format of the survey tool or does not have a survey in the database, or is not a valid database, etc.
 DataTableModel getTableNamed(java.lang.String tableName)
           
 TableStorage getTableStorage()
           
 DataTableModel getUsersTable()
           
 boolean isOpen()
           
 int isSurveyValid()
          This should be called first to check whether the survey is a recent one or not.
 

Field Detail

IS_GOOD

static final int IS_GOOD
See Also:
Constant Field Values

CANNOT_CHECK

static final int CANNOT_CHECK
See Also:
Constant Field Values

ERROR_NOT_FIXABLE

static final int ERROR_NOT_FIXABLE
See Also:
Constant Field Values

ERROR_FIXABLE

static final int ERROR_FIXABLE
See Also:
Constant Field Values

ERROR_USER_FIXABLE

static final int ERROR_USER_FIXABLE
See Also:
Constant Field Values

ERROR_FIXABLE_CREATE

static final int ERROR_FIXABLE_CREATE
See Also:
Constant Field Values

OPERATION_SUCCEEDED

static final int OPERATION_SUCCEEDED
See Also:
Constant Field Values

OPERATION_FAILED

static final int OPERATION_FAILED
See Also:
Constant Field Values

OPERATION_PARTIALLY_SUCCEEDED

static final int OPERATION_PARTIALLY_SUCCEEDED
See Also:
Constant Field Values

DEFAULT_USERS_TABLE_NAME

static final java.lang.String DEFAULT_USERS_TABLE_NAME
See Also:
Constant Field Values
Method Detail

isOpen

boolean isOpen()

isSurveyValid

int isSurveyValid()
This should be called first to check whether the survey is a recent one or not.

Returns:
ERROR_FIXABLE_CREATE, ERROR_NOT_FIXABLE, or IS_GOOD.

createNewSurveyInDatabase

int createNewSurveyInDatabase()
Fix a broken table by creating the survey database into this database. This assumes the pre-req that you've called the isSurveyValid() method and gotten a ERROR_FIXABLE_CREATE as a response. If you haven't checked, it might not be possible, and if it's not possible, this will return false, perhaps gracefully or not.

Returns:
OPERATION_SUCCEEDED, OPERATION_FAILED, or OPERATION_PARTIALLY_SUCCEEDED

getSurvey

Survey getSurvey()
If it returns null, the database is in an old format of the survey tool or does not have a survey in the database, or is not a valid database, etc.

Returns:
the whole Survey

getUsersTable

DataTableModel getUsersTable()

getAnswersTable

DataTableModel getAnswersTable()

getAnswersTable

DataTableModel getAnswersTable(java.util.Vector<java.lang.Integer> userIDs)

getTableNamed

DataTableModel getTableNamed(java.lang.String tableName)

getAllPossibleAnswerTableModels

java.util.Vector<DataTableModel> getAllPossibleAnswerTableModels()

getAllPossibleAnswerTables

java.util.Vector<java.lang.String> getAllPossibleAnswerTables()

getAnswersTableNamed

DataTableModel getAnswersTableNamed(java.lang.String answersTableName)
Gets a table formatted for answers. If the table does not exist, the table will be created.

Parameters:
answersTableName -
Returns:

getRepeatedMeasuresTableNamed

DataTableModel getRepeatedMeasuresTableNamed(java.lang.String repeatedMeasuresTableName)
Get a table formatted for storing repeated measures (NOT an answers table for repeated measures, but for the list of repeated measures).

Parameters:
repeatedMeasuresTableName -
Returns:

getNewQuestion

QuestionDataBitSet getNewQuestion()

getNewPage

PageTable getNewPage()

getPages

java.util.Vector<Page> getPages(java.lang.String pageName)
Gets all pages by this name -- since it's possible that there are multiple pages by the same name.

Parameters:
pageName -
Returns:

getPage

Page getPage(int id)

getTableStorage

TableStorage getTableStorage()