com.knowgate.surveys
Class Answer

java.lang.Object
  extended by com.knowgate.dataobjs.DBPersist
      extended by com.knowgate.surveys.Answer
All Implemented Interfaces:
java.util.Map

public class Answer
extends DBPersist

Single DataSheet Answer for a Survey


Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
static short ClassId
           
 
Fields inherited from class com.knowgate.dataobjs.DBPersist
AllVals, sAuditCls, sAuditUsr, sTransactId
 
Constructor Summary
Answer()
          Default constructor
Answer(java.lang.String sGuDataSheet, java.lang.String sGuPageSet, java.lang.String sGuPage, int iPgPage, java.lang.String sNmAnswer, int iPgAnswer, java.lang.String sGuWriter)
          Create answer and initialize some properties
 
Method Summary
 boolean delete(JDCConnection oConn)
          Delete answer from k_pageset_answers This method overrides the default implementation of DBPersist superclass.
 boolean exists(JDCConnection oConn)
          Check whether or not a page already exists at k_pageset_answers This method the default implementation of DBPersist superclass.
 java.lang.String getName()
           
 java.lang.String getType()
          Get Answer Type Name
 java.lang.String getValue()
          Get Answer value
 void setName(java.lang.String sName)
          Set Answer unique name within this DataSheet
 void setType(java.lang.String sType)
          Set Answer Type
 void setValue(java.lang.String sValue)
          Set value for answer If sValue contains single or double quotes then they are replace by acent characters " if replace by ´´ and ' is replaced by ´
 boolean store(JDCConnection oConn)
          Store Answer at database Field k_pageset_answers.dt_modified is automatically updated to the current date each time that an answer is stored.
 
Methods inherited from class com.knowgate.dataobjs.DBPersist
allcaps, allcaps, changelog, clear, clone, containsKey, containsValue, entrySet, get, get, getAuditClassName, getCreationDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getInteger, getIntervalPart, getItemMap, getItems, getMoney, getShort, getSQLDate, getSQLTime, getString, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, load, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, size, toLowerCase, toUpperCase, toXML, toXML, toXML, toXML, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

ClassId

public static final short ClassId
See Also:
Constant Field Values
Constructor Detail

Answer

public Answer()
Default constructor


Answer

public Answer(java.lang.String sGuDataSheet,
              java.lang.String sGuPageSet,
              java.lang.String sGuPage,
              int iPgPage,
              java.lang.String sNmAnswer,
              int iPgAnswer,
              java.lang.String sGuWriter)
Create answer and initialize some properties

Parameters:
sGuDataSheet - GUID of DataSheet to which this Answer belongs
sGuPageSet - GUID of PageSet to which this Answer belongs
sGuPage - Page GUID
iPgPage - Page number
sNmAnswer - Unique Name for this Answer
iPgAnswer - Answer number within the page
sGuWriter - GUID of ACLUser writting the Answer
Method Detail

setName

public void setName(java.lang.String sName)
             throws java.lang.IllegalArgumentException
Set Answer unique name within this DataSheet

Parameters:
sName - Answer Name. No spaces, asterisks, angle brackets, ampersands, quotes, slashes, question marks, or ats allowed.
Throws:
java.lang.IllegalArgumentException - if sName contains any forbidden character.

getName

public java.lang.String getName()

setValue

public void setValue(java.lang.String sValue)

Set value for answer

If sValue contains single or double quotes then they are replace by acent characters " if replace by ´´ and ' is replaced by ´

Parameters:
sValue - String

getValue

public java.lang.String getValue()
Get Answer value

Returns:
Answer value or empty string "" if there is no value for this Answer

setType

public void setType(java.lang.String sType)
Set Answer Type

Parameters:
sType - Type name in uppercase. One of: { TEXT, MEMO, CHOICE, LISTCHOICE, MULTICHOICE, LICKERT, MATRIX }

getType

public java.lang.String getType()
Get Answer Type Name

Returns:
Answer Type Name

delete

public boolean delete(JDCConnection oConn)
               throws java.sql.SQLException

Delete answer from k_pageset_answers

This method overrides the default implementation of DBPersist superclass.
It deletes the answer based on its name (nm_answer) or its position int the page (pg_answer).

Overrides:
delete in class DBPersist
Parameters:
oConn - JDCConnection Open JDBC database connection
Returns:
true if register was successfully erased, false if not.
Throws:
java.sql.SQLException

exists

public boolean exists(JDCConnection oConn)
               throws java.sql.SQLException

Check whether or not a page already exists at k_pageset_answers

This method the default implementation of DBPersist superclass.
It checks for answer existence based on its name (nm_answers) or its position in the page (pg_answer)

Overrides:
exists in class DBPersist
Parameters:
oConn - JDCConnection
Returns:
boolean
Throws:
java.sql.SQLException

store

public boolean store(JDCConnection oConn)
              throws java.sql.SQLException

Store Answer at database

Field k_pageset_answers.dt_modified is automatically updated to the current date each time that an answer is stored.

Overrides:
store in class DBPersist
Parameters:
oConn - Open JDBC database connection
Returns:
boolean true if register was stored for the first time, false if register already existed.
Throws:
java.sql.SQLException