cmu.survey.editor.data.table
Class QuestionDataBitSetTable

java.lang.Object
  extended by cmu.survey.editor.data.table.QuestionDataBitSetTable
All Implemented Interfaces:
DataBitSet, QuestionDataBitSet, HasID
Direct Known Subclasses:
QuestionDataBitSetSQL

public abstract class QuestionDataBitSetTable
extends java.lang.Object
implements QuestionDataBitSet, HasID


Field Summary
protected  StringDataBit backgroundColor
           
protected  IntegerDataBit cacheRandomizeInnerOrder
           
static boolean debug
           
protected  StringDataBit endQuestion
           
protected  StringDataBit helpText
           
protected  IntegerDataBit numberOfChoices
           
protected  IntegerDataBit pageIDInsideThis
          Not the page this is on.
protected  Page pageInsideThis
           
protected  IntegerDataBit questionID
           
protected  IntegerDataBit questionIDForChoicesTable
           
protected  IntegerDataBit randomizeInnerOrder
           
protected  IntegerDataBit singleQuestionFlag
           
protected  StringDataBit sourceOfChoices
           
protected  StringDataBit startQuestion
           
protected  StringDataBit type
           
 
Constructor Summary
QuestionDataBitSetTable(DataBitStorageTable objectStorage, IntegerDataBit questionID, StringDataBit startQuestion, StringDataBit endQuestion, StringDataBit helpText, StringDataBit type, StringDataBit backgroundColor, IntegerDataBit questionIDForChoicesTable, StringDataBit sourceOfChoices, IntegerDataBit numberOfChoices, IntegerDataBit pageIDInsideThis, IntegerDataBit singleQuestionFlag, IntegerDataBit randomizeInnerOrder, IntegerDataBit cacheRandomizeInnerOrder)
           
 
Method Summary
protected abstract  AuxillaryQuestionPartSetTable getAuxillaryQuestionPartSet()
           
 StringDataBit getBackgroundColor()
           
 IntegerDataBit getCacheRandomizeInnerOrder()
           
 IntegerDataBit getChoicesNumber()
           
 StringDataBit getChoicesType()
           
 StringDataBit getEndQuestion()
          HTML text that shows at the end of the question.
 StringDataBit getHelpText()
          HTML text that shows when you click a little "?".
 java.lang.Integer getID()
           
 IntegerDataBit getPageIDInsideThis()
          Only required when the type is PAGE.
 Page getPageInsideThis()
           
 Page getPageInsideThisIfLoaded()
          Only for things saving -- don't load the page if it's not loaded.
 IntegerDataBit getQuestionID()
           
 IntegerDataBit getRandomizeInnerOrder()
           
 boolean getSavesToDatabase()
           
 IntegerDataBit getSingleQuestionFlag()
          This means one of two things.
 StringDataBit getStartQuestion()
          HTML text that shows at the beginning of the question.
 StringDataBit getType()
           
protected abstract  VariableDataBitSetTableStub getVariableStubIfExists()
          This will get
 java.util.Vector<DataBit> getVectorOfDataBits()
           
abstract  boolean hasAuxOptionsBeenModified()
           
 boolean hasBeenModified()
           
 boolean hasBeenModifiedInDatabaseTable()
          There's a separate method that does not check whether orderIndex has been modified because orderIndex actually gets saved to the Page table -- all the things mentioned here get saved to the questions table.
 boolean hasBeenModifiedWithoutChoicesOrAuxOptions()
           
 boolean isNew()
           
protected  boolean modifiedBit(DataBit bit)
           
 boolean save(PageSQL p, boolean createVariablesFresh)
           
protected abstract  boolean saveAuxOptions()
           
protected abstract  Pair<java.lang.Boolean,java.lang.Boolean> saveChoicesAndAuxOptions(PageSQL p)
           
protected  boolean savePageIfNecessary()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface cmu.survey.editor.data.QuestionDataBitSet
getAuxillaryParts, getChoices, getErrorDescription, getVariable, hasError
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

questionID

protected IntegerDataBit questionID

startQuestion

protected StringDataBit startQuestion

endQuestion

protected StringDataBit endQuestion

helpText

protected StringDataBit helpText

type

protected StringDataBit type

backgroundColor

protected StringDataBit backgroundColor

questionIDForChoicesTable

protected IntegerDataBit questionIDForChoicesTable

pageIDInsideThis

protected IntegerDataBit pageIDInsideThis
Not the page this is on. This is the page this refers to if this is of type PAGE.


pageInsideThis

protected Page pageInsideThis

sourceOfChoices

protected StringDataBit sourceOfChoices

numberOfChoices

protected IntegerDataBit numberOfChoices

singleQuestionFlag

protected IntegerDataBit singleQuestionFlag

randomizeInnerOrder

protected IntegerDataBit randomizeInnerOrder

cacheRandomizeInnerOrder

protected IntegerDataBit cacheRandomizeInnerOrder
Constructor Detail

QuestionDataBitSetTable

public QuestionDataBitSetTable(DataBitStorageTable objectStorage,
                               IntegerDataBit questionID,
                               StringDataBit startQuestion,
                               StringDataBit endQuestion,
                               StringDataBit helpText,
                               StringDataBit type,
                               StringDataBit backgroundColor,
                               IntegerDataBit questionIDForChoicesTable,
                               StringDataBit sourceOfChoices,
                               IntegerDataBit numberOfChoices,
                               IntegerDataBit pageIDInsideThis,
                               IntegerDataBit singleQuestionFlag,
                               IntegerDataBit randomizeInnerOrder,
                               IntegerDataBit cacheRandomizeInnerOrder)
Method Detail

modifiedBit

protected boolean modifiedBit(DataBit bit)

hasBeenModified

public boolean hasBeenModified()
Specified by:
hasBeenModified in interface DataBitSet
Returns:
whether the question has been modified since load or if it is new. Basically, it returns whether this DataBitSet needs to be saved.

hasBeenModifiedWithoutChoicesOrAuxOptions

public boolean hasBeenModifiedWithoutChoicesOrAuxOptions()

isNew

public boolean isNew()
Specified by:
isNew in interface QuestionDataBitSet

getChoicesType

public StringDataBit getChoicesType()

getChoicesNumber

public IntegerDataBit getChoicesNumber()

getQuestionID

public IntegerDataBit getQuestionID()

getEndQuestion

public StringDataBit getEndQuestion()
Description copied from interface: QuestionDataBitSet
HTML text that shows at the end of the question.

Specified by:
getEndQuestion in interface QuestionDataBitSet
Returns:

getStartQuestion

public StringDataBit getStartQuestion()
Description copied from interface: QuestionDataBitSet
HTML text that shows at the beginning of the question.

Specified by:
getStartQuestion in interface QuestionDataBitSet
Returns:

getHelpText

public StringDataBit getHelpText()
Description copied from interface: QuestionDataBitSet
HTML text that shows when you click a little "?".

Specified by:
getHelpText in interface QuestionDataBitSet
Returns:

getType

public StringDataBit getType()
Specified by:
getType in interface QuestionDataBitSet

getPageIDInsideThis

public IntegerDataBit getPageIDInsideThis()
Description copied from interface: QuestionDataBitSet
Only required when the type is PAGE.

Specified by:
getPageIDInsideThis in interface QuestionDataBitSet
Returns:

getPageInsideThis

public Page getPageInsideThis()
Specified by:
getPageInsideThis in interface QuestionDataBitSet

getPageInsideThisIfLoaded

public Page getPageInsideThisIfLoaded()
Only for things saving -- don't load the page if it's not loaded.

Returns:

getBackgroundColor

public StringDataBit getBackgroundColor()
Specified by:
getBackgroundColor in interface QuestionDataBitSet

hasAuxOptionsBeenModified

public abstract boolean hasAuxOptionsBeenModified()

getSavesToDatabase

public boolean getSavesToDatabase()
Specified by:
getSavesToDatabase in interface QuestionDataBitSet

getVariableStubIfExists

protected abstract VariableDataBitSetTableStub getVariableStubIfExists()
This will get

Parameters:
v -

getVectorOfDataBits

public java.util.Vector<DataBit> getVectorOfDataBits()

getID

public java.lang.Integer getID()
Specified by:
getID in interface HasID
Returns:
0 or -1 if it has no id or hasn't been set yet, and anything higher than that is the integer ID.

getAuxillaryQuestionPartSet

protected abstract AuxillaryQuestionPartSetTable getAuxillaryQuestionPartSet()

saveChoicesAndAuxOptions

protected abstract Pair<java.lang.Boolean,java.lang.Boolean> saveChoicesAndAuxOptions(PageSQL p)

saveAuxOptions

protected abstract boolean saveAuxOptions()

save

public boolean save(PageSQL p,
                    boolean createVariablesFresh)

savePageIfNecessary

protected boolean savePageIfNecessary()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hasBeenModifiedInDatabaseTable

public boolean hasBeenModifiedInDatabaseTable()
There's a separate method that does not check whether orderIndex has been modified because orderIndex actually gets saved to the Page table -- all the things mentioned here get saved to the questions table. Also does not check choices nor auxillary options.

Returns:

getSingleQuestionFlag

public IntegerDataBit getSingleQuestionFlag()
Description copied from interface: QuestionDataBitSet
This means one of two things. (a) If the type is a radio button or text field, this is whether this one should be auto-submitted. (b) If this is a group, this is whether it should show only one item from the list. (c) If it's any other type, this is ignored.

Specified by:
getSingleQuestionFlag in interface QuestionDataBitSet
Returns:

getRandomizeInnerOrder

public IntegerDataBit getRandomizeInnerOrder()
Specified by:
getRandomizeInnerOrder in interface QuestionDataBitSet

getCacheRandomizeInnerOrder

public IntegerDataBit getCacheRandomizeInnerOrder()
Specified by:
getCacheRandomizeInnerOrder in interface QuestionDataBitSet