cmu.survey.jsp.tags
Class GenericUpdate

java.lang.Object
  extended by cmu.survey.jsp.tags.GenericUpdate
Direct Known Subclasses:
GenericUpdateSQL

public abstract class GenericUpdate
extends java.lang.Object


Field Summary
protected  boolean changedDBLastUpdate
           
protected  java.util.Vector<java.lang.String> dateInsertStringNames
           
protected  java.util.Vector dateInsertStringValues
           
protected  java.util.HashMap<java.lang.String,java.util.Calendar> dateMap
           
protected  java.util.HashMap dateMapIsNull
           
protected  java.util.Vector<java.lang.String> dateNames
           
protected  java.util.Vector<java.lang.String> dateSubtypes
           
protected  java.util.Vector<java.lang.String> dateTimeInsertStringNames
           
protected  java.util.Vector dateTimeInsertStringValues
           
protected  java.util.HashMap<java.lang.String,java.util.Calendar> dateTimeMap
           
protected  java.util.HashMap dateTimeMapIsEmpty
           
protected  java.util.Vector<java.lang.String> dateTimeNames
           
protected  java.util.Vector<java.lang.String> dateTimeSubtypes
           
protected  java.util.Vector dateTimeValues
           
protected  java.util.Vector dateValues
           
protected static boolean debug
           
static int DELETE
           
protected  boolean didParseOutParameters
           
protected  boolean formWasSubmitted
          Whether or not the form was submitted on this page -- i.e. whether someone clicked submit on a previous page and this would have data if it could
static int INSERT
           
protected  java.util.Vector<PairOfVectors<java.lang.String,java.lang.Object>> keyValueLists
           
protected  java.lang.String lastMessage
           
static int NOTHING
           
protected  java.util.Vector<java.lang.String> numberKeyNames
           
protected  java.util.Vector<java.lang.Number> numberKeyValues
           
protected  java.util.Vector<java.lang.String> numberNames
           
protected  java.util.Vector<java.lang.Number> numberValues
           
protected  javax.servlet.jsp.PageContext pageContext
           
protected  java.lang.String parametersTurnedIntoTextForm
           
protected  boolean parametersWerePassedIn
           
protected  boolean saveChangesToDB
           
protected  java.util.Vector<java.lang.String> stringKeyNames
           
protected  java.util.Vector<java.lang.String> stringKeyValues
           
protected  java.util.Vector<java.lang.String> stringNames
           
protected  java.util.Vector<java.lang.String> stringValues
           
protected  Survey survey
           
protected  java.lang.String tableName
           
protected  javax.servlet.http.HttpServletRequest theRequest
          The request object from the page
protected  int thingToDo
           
protected  java.util.Vector<java.lang.String> timeInsertStringNames
           
protected  java.util.Vector timeInsertStringValues
           
protected  java.util.HashMap<java.lang.String,java.util.Calendar> timeMap
           
protected  java.util.HashMap timeMapIsEmpty
           
protected  java.util.Vector<java.lang.String> timeNames
           
protected  java.util.Vector<java.lang.String> timeSubtypes
           
protected  java.util.Vector timeValues
           
static int UPDATE
           
protected static java.lang.String[] VALID_SUBTYPES
           
 
Constructor Summary
GenericUpdate(Survey surveyToUse, javax.servlet.jsp.PageContext usePageContext)
           
 
Method Summary
protected  java.lang.String cleanStringValue(java.lang.String string)
          A wrapper method for Survey.cleanStringBetter() and DatabaseConnection.cleanString()
protected  void convertDateTimeFormToCalendars()
           
protected abstract  int decideWhatToDo()
           
protected abstract  void doDatabaseChanges()
           
protected  void doUpdate()
           
protected abstract  java.util.Calendar getCalendar()
           
 boolean getChangedDBLastUpdate()
           
protected abstract  java.lang.String getDateTimeNowStringFormat()
          Get the date and time right now as a string
 Pair<java.util.Vector<java.lang.String>,java.util.Vector<java.lang.Object>> getKeys()
          Makes a two-vector (tuple) Vector of two
 java.lang.String getLastMessage()
           
protected  QuestionInfo getQuestionInfo(java.lang.String name, java.lang.String paramSubtype, boolean isListMember)
           
 int getTypeOfChangeDone()
           
 boolean getWasPageSubmitted()
           
 boolean getWereParametersPassedIn()
           
protected  boolean hasParamBeenAddedBefore(java.lang.String name, java.lang.Object value)
          Use this instead of the regular add, to make sure we don't have duplicates.
protected  boolean isValidSubtype(java.lang.String subtype)
          Checks whether a subtype (in date_year_birthDay, "year" is the subtype) is one of the valid subtypes.
 void parseOutParameters()
           
protected  java.lang.String parseOutParameters(boolean saveToTextForm)
           
 void setLastMessage(java.lang.String string)
           
 void setSaveChangesToDB(boolean allowChangesToDB)
           
protected  java.util.Calendar updateFormToCalendar(java.lang.String type, java.lang.String value, java.util.Calendar cal)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static final boolean debug
See Also:
Constant Field Values

stringNames

protected java.util.Vector<java.lang.String> stringNames

stringValues

protected java.util.Vector<java.lang.String> stringValues

numberNames

protected java.util.Vector<java.lang.String> numberNames

numberValues

protected java.util.Vector<java.lang.Number> numberValues

dateNames

protected java.util.Vector<java.lang.String> dateNames

dateSubtypes

protected java.util.Vector<java.lang.String> dateSubtypes

dateValues

protected java.util.Vector dateValues

dateMap

protected java.util.HashMap<java.lang.String,java.util.Calendar> dateMap

dateMapIsNull

protected java.util.HashMap dateMapIsNull

dateTimeNames

protected java.util.Vector<java.lang.String> dateTimeNames

dateTimeSubtypes

protected java.util.Vector<java.lang.String> dateTimeSubtypes

dateTimeValues

protected java.util.Vector dateTimeValues

dateTimeMap

protected java.util.HashMap<java.lang.String,java.util.Calendar> dateTimeMap

dateTimeMapIsEmpty

protected java.util.HashMap dateTimeMapIsEmpty

timeNames

protected java.util.Vector<java.lang.String> timeNames

timeSubtypes

protected java.util.Vector<java.lang.String> timeSubtypes

timeValues

protected java.util.Vector timeValues

timeMap

protected java.util.HashMap<java.lang.String,java.util.Calendar> timeMap

timeMapIsEmpty

protected java.util.HashMap timeMapIsEmpty

numberKeyNames

protected java.util.Vector<java.lang.String> numberKeyNames

numberKeyValues

protected java.util.Vector<java.lang.Number> numberKeyValues

stringKeyNames

protected java.util.Vector<java.lang.String> stringKeyNames

stringKeyValues

protected java.util.Vector<java.lang.String> stringKeyValues

dateTimeInsertStringNames

protected java.util.Vector<java.lang.String> dateTimeInsertStringNames

dateTimeInsertStringValues

protected java.util.Vector dateTimeInsertStringValues

timeInsertStringNames

protected java.util.Vector<java.lang.String> timeInsertStringNames

timeInsertStringValues

protected java.util.Vector timeInsertStringValues

dateInsertStringNames

protected java.util.Vector<java.lang.String> dateInsertStringNames

dateInsertStringValues

protected java.util.Vector dateInsertStringValues

keyValueLists

protected java.util.Vector<PairOfVectors<java.lang.String,java.lang.Object>> keyValueLists

survey

protected Survey survey

tableName

protected java.lang.String tableName

thingToDo

protected int thingToDo

NOTHING

public static final int NOTHING
See Also:
Constant Field Values

UPDATE

public static final int UPDATE
See Also:
Constant Field Values

INSERT

public static final int INSERT
See Also:
Constant Field Values

DELETE

public static final int DELETE
See Also:
Constant Field Values

saveChangesToDB

protected boolean saveChangesToDB

changedDBLastUpdate

protected boolean changedDBLastUpdate

parametersWerePassedIn

protected boolean parametersWerePassedIn

didParseOutParameters

protected boolean didParseOutParameters

parametersTurnedIntoTextForm

protected java.lang.String parametersTurnedIntoTextForm

lastMessage

protected java.lang.String lastMessage

theRequest

protected javax.servlet.http.HttpServletRequest theRequest
The request object from the page


formWasSubmitted

protected boolean formWasSubmitted
Whether or not the form was submitted on this page -- i.e. whether someone clicked submit on a previous page and this would have data if it could


VALID_SUBTYPES

protected static final java.lang.String[] VALID_SUBTYPES

pageContext

protected javax.servlet.jsp.PageContext pageContext
Constructor Detail

GenericUpdate

public GenericUpdate(Survey surveyToUse,
                     javax.servlet.jsp.PageContext usePageContext)
Method Detail

cleanStringValue

protected java.lang.String cleanStringValue(java.lang.String string)
A wrapper method for Survey.cleanStringBetter() and DatabaseConnection.cleanString()

Parameters:
string -
Returns:

isValidSubtype

protected boolean isValidSubtype(java.lang.String subtype)
Checks whether a subtype (in date_year_birthDay, "year" is the subtype) is one of the valid subtypes. Subtypes are only used for the submissions of dates and times.


setLastMessage

public void setLastMessage(java.lang.String string)

getLastMessage

public java.lang.String getLastMessage()

getChangedDBLastUpdate

public boolean getChangedDBLastUpdate()

setSaveChangesToDB

public void setSaveChangesToDB(boolean allowChangesToDB)

getTypeOfChangeDone

public int getTypeOfChangeDone()

getKeys

public Pair<java.util.Vector<java.lang.String>,java.util.Vector<java.lang.Object>> getKeys()
Makes a two-vector (tuple) Vector of two

Returns:

getQuestionInfo

protected QuestionInfo getQuestionInfo(java.lang.String name,
                                       java.lang.String paramSubtype,
                                       boolean isListMember)

parseOutParameters

public void parseOutParameters()

hasParamBeenAddedBefore

protected boolean hasParamBeenAddedBefore(java.lang.String name,
                                          java.lang.Object value)
Use this instead of the regular add, to make sure we don't have duplicates.

Parameters:
names -
name -
type -
value -
Returns:

parseOutParameters

protected java.lang.String parseOutParameters(boolean saveToTextForm)

updateFormToCalendar

protected java.util.Calendar updateFormToCalendar(java.lang.String type,
                                                  java.lang.String value,
                                                  java.util.Calendar cal)

convertDateTimeFormToCalendars

protected void convertDateTimeFormToCalendars()

doUpdate

protected void doUpdate()

decideWhatToDo

protected abstract int decideWhatToDo()

doDatabaseChanges

protected abstract void doDatabaseChanges()

getCalendar

protected abstract java.util.Calendar getCalendar()

getDateTimeNowStringFormat

protected abstract java.lang.String getDateTimeNowStringFormat()
Get the date and time right now as a string


getWereParametersPassedIn

public boolean getWereParametersPassedIn()
Returns:

getWasPageSubmitted

public boolean getWasPageSubmitted()