com.objectplanet.survey.plugin.api
Class ResponseMultiple

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

public class ResponseMultiple
extends Response

Represents a response to the multiple choice question. Response to a multiple choice question is an array of selected option positions.

Author:
Irina Brun

Method Summary
 void clearOptionValues()
          Clear option values and 'other-field' value.
 boolean getOptionValue(int index)
          Gets the value for multiple option.
 boolean[] getOptionValues()
          Gets the array of option values.
 java.lang.String getOtherValue()
          Gets the response to the 'other-field'
 void keepBusinessObject()
          Get and keep business object.
 void releaseBusinessObject()
          Release business object.
 void setOptionValue(int index, boolean value)
          Sets the value (selected/not selected) for multiple option.
 void setOtherValue(java.lang.String otherAnswer)
          Sets the input for multiple other field, if applicable.
 
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

setOptionValue

public void setOptionValue(int index,
                           boolean value)
                    throws SurveySystemException,
                           java.lang.IllegalArgumentException
Sets the value (selected/not selected) for multiple option.

Parameters:
index - Multiple option index, starts at 0.
value - The option value.
Throws:
java.lang.IllegalArgumentException - If illegal index
SurveySystemException - If an error occurs in the system.

setOtherValue

public void setOtherValue(java.lang.String otherAnswer)
                   throws SurveySystemException,
                          java.lang.IllegalArgumentException
Sets the input for multiple other field, if applicable. This value will be stored in the storage only if the last option is selected.

Parameters:
otherAnswer - Response to the other field.
Throws:
java.lang.IllegalArgumentException - If illegal index or other filed is not on.
SurveySystemException - If an error occurs in the system.

getOptionValue

public boolean getOptionValue(int index)
                       throws SurveySystemException,
                              java.lang.IllegalArgumentException
Gets the value for multiple option. True if the option is selected, false otherwise.

Parameters:
index - Option index, starts at 0.
Returns:
The option value.
Throws:
java.lang.IllegalArgumentException - If illegal index
SurveySystemException - If an error occurs in the system.

getOptionValues

public boolean[] getOptionValues()
                          throws SurveySystemException
Gets the array of option values.

Returns:
Array of boolean values, where true means that option at the corresponding position in multiple question is selected.
Throws:
SurveySystemException - If an error occurs in the system.

getOtherValue

public java.lang.String getOtherValue()
                               throws SurveySystemException,
                                      java.lang.IllegalArgumentException
Gets the response to the 'other-field'

Returns:
The value of -other-field'
Throws:
java.lang.IllegalArgumentException - If illegal index
SurveySystemException - If an error occurs in the system.

clearOptionValues

public void clearOptionValues()
                       throws SurveySystemException
Clear option values and 'other-field' value.

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

Copyright ? ObjectPlanet Inc. All Rights Reserved.

Built on December 20 2016