com.objectplanet.survey.plugin.api
Class ResponseMatrix

java.lang.Object
  extended by com.objectplanet.survey.plugin.api.Response
      extended by com.objectplanet.survey.plugin.api.ResponseMatrix

public class ResponseMatrix
extends Response

Represents a response to the matrix question.

ATTENTION: It is possible to create invalid matrix response. Make sure that you follow the rules set for the matrix question. I.e do not set two values for one matrix row inside the cellgroup CELLGROUP_ONE_PER_ROW.

Author:
Irina Brun

Method Summary
 void clearCellValues()
          Clear cell responses.
 java.lang.String getCellValue(int columnPosition, int rowPosition, int cellType)
          Gets the cell value
 java.lang.String getErrorMessage(int columnPosition, int rowPosition)
          Gets the error message for an matrix cell.
 boolean isValid(int columnPosition, int rowPosition)
          Checks if response to the matrix cell is valid.
 void keepBusinessObject()
          Get and keep business object.
 void releaseBusinessObject()
          Release business object.
 void removeCellValue(int columnPosition, int rowPosition)
          Remove cell value
 void setCellValue(int columnPosition, int rowPosition, int cellType, java.lang.String answer)
          Sets response to the matrix cell.
 
Methods inherited from class com.objectplanet.survey.plugin.api.Response
deleteEssayResponse, deleteIntextResponse, getErrorMessage, getErrorMessage, getEssayResponse, getFreeText, getIntextResponse, getQuestionNo, getRespondentId, getResponseDate, hasBusinessObject, isPersisted, isValid, isValid, setEssayResponse, setFreeText, setIntextResponse
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setCellValue

public void setCellValue(int columnPosition,
                         int rowPosition,
                         int cellType,
                         java.lang.String answer)
                  throws SurveySystemException,
                         java.lang.IllegalArgumentException
Sets response to the matrix cell. If the cell is of type QuestionMatrix.CELL_CHECKBOX or QuestionMatrix.CELL_RADIO, use "true" for selected. Everything but "true" will be considered as not selected option.

Parameters:
columnPosition - Matrix cell column position, starts at 0
rowPosition - Matrix cell row position, starts at 0
answer - The response to the matrix cell
cellType - Matrix cell type. One of the defined in QuestionMatrix
Throws:
java.lang.IllegalArgumentException - If illegal positions
SurveySystemException - If an error occurs in the system.

getCellValue

public java.lang.String getCellValue(int columnPosition,
                                     int rowPosition,
                                     int cellType)
                              throws SurveySystemException,
                                     java.lang.IllegalArgumentException
Gets the cell value

Parameters:
columnPosition - Matrix cell column position, starts at 0
rowPosition - Matrix cell row position, starts at 0
cellType - Matrix cell type. One of the defined in QuestionMatrix
Returns:
The cellValue value
Throws:
java.lang.IllegalArgumentException - If illegal parameters
SurveySystemException - If an error occurs in the system.

getErrorMessage

public java.lang.String getErrorMessage(int columnPosition,
                                        int rowPosition)
                                 throws SurveySystemException
Gets the error message for an matrix cell. This will exist if the response to the matrix cell is invalid. Read more here .

Parameters:
columnPosition - Matrix cell column position, starts at 0
rowPosition - Matrix cell row position, starts at 0
Returns:
The error message
Throws:
SurveySystemException - If any error occurs in the system.

isValid

public boolean isValid(int columnPosition,
                       int rowPosition)
                throws SurveySystemException
Checks if response to the matrix cell is valid.

Parameters:
columnPosition - Matrix cell column position, starts at 0
rowPosition - Matrix cell row position, starts at 0
Returns:
The valid value
Throws:
SurveySystemException - If any error occurs in the system.

clearCellValues

public void clearCellValues()
                     throws SurveySystemException
Clear cell responses.

Throws:
SurveySystemException - If an error occurs in the system.

keepBusinessObject

public void keepBusinessObject()
                        throws SurveySystemException
Get and keep business object. See ATTENTION .

Overrides:
keepBusinessObject in class Response
Throws:
SurveySystemException - If an error occurs in the system.

releaseBusinessObject

public void releaseBusinessObject()
Release business object. See ATTENTION .

Overrides:
releaseBusinessObject in class Response

removeCellValue

public void removeCellValue(int columnPosition,
                            int rowPosition)
                     throws SurveySystemException,
                            java.lang.IllegalArgumentException
Remove cell value

Parameters:
columnPosition - Matrix cell column position, starts at 0
rowPosition - Matrix cell row position, starts at 0
Throws:
java.lang.IllegalArgumentException - If illegal positions
SurveySystemException - If an error occurs in the system.

Copyright ? ObjectPlanet Inc. All Rights Reserved.

Built on December 20 2016