|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.objectplanet.survey.plugin.api.Respondent
public class Respondent
ATTENTION: This class is a
facade for the system business Respondent. To improve performance you can
force it to keep the reference to the business object by calling keepBusinessObject()
. Keeping references to objects may cause inconsistencies in the system, so
always remember to call releaseBusinessObject()
as soon as you
are finished using them.
Respondent is an object that encapsulates information about users response
to a survey like entry date, last response, completed date and so on. Flag
isPersisted
is set to true if respondent is saved in the
storage.
To populate respondent object with user input (answers):
1) getResponse() to create new or get the existing response
2) set values to the response object (respondents answers)
3) call question.validate() method to validate the input
4) update current response: setCurrentResponse()
5) get the next question: getNextQuestion()
6) go to 1) and repeat until you reach the last question
7) store the respondent to the storage: SurveyManager.storeRespondent(). If
the respondent has answered all the questions (getNextQuestion() returns -1),
the completed date will be set and respondent will be removed from the
cache.
Method Summary | |
---|---|
void |
deleteResponse(int questionNo)
Deletes a response. |
java.lang.String |
getAttribute(java.lang.String attributeName)
Gets the value for a respondent attribute. |
java.util.HashMap |
getAttributes()
Gets all the respondent attributes. |
boolean |
getAttributesExist()
Returns true if one or more attributes exist for this respondent. |
boolean |
getBlocked()
Get the flag that determines if the respondent is to be blocked from continuing the survey. |
long |
getCompletedDate()
Gets the completed date |
int |
getCurrentResponse()
Gets the current response. |
long |
getEntryDate()
Gets the entry date |
boolean |
getFinishClicked()
Get the flag that determines the finish-button was clicked in the survey. |
long |
getInviteeId()
Gets the invitee id (if applicable) |
java.lang.String |
getIpAddress()
Gets the ip address. |
java.lang.String |
getLanguageCode()
Gets the languageCode for which language the respondent responded to the survey in. |
int |
getLastResponse()
Gets the question number of last answered question. |
int |
getNextQuestion()
Gets the number of the next question (after current response). If survey contains branch conditions some questions might be filtered out based on responses to the previous questions. |
long |
getRespondentId()
Gets the respondent id |
Response |
getResponse(int questionNo)
Gets a question response. |
long |
getSurveyId()
Gets the survey id |
java.lang.String |
getThankYouNote()
Gets the custom thank-you note for current respondent. |
java.lang.String |
getTicket()
Gets the ticket value |
java.lang.String |
getUserData(int index)
Gets the user data at a specified index. |
boolean |
hasBusinessObject()
Check if this question has reference to the business Respondent object. |
boolean |
isFilteredOut(int questionNo)
Check if question is filtered out by condition branching. |
boolean |
isPersisted()
Returns true if respondent is persisted (some of the respondent information/responses are saved in the storage). |
void |
keepBusinessObject()
Get and keep business object. |
void |
releaseBusinessObject()
Release business object. |
void |
setAttribute(java.lang.String attributeName,
java.lang.String attributeValue)
Sets an attribute of the respondent object. |
void |
setBlocked(boolean blocked)
Set this attribute to block the respondent from continue the survey. |
void |
setCurrentResponse(int currentResponse)
Sets the current response. |
void |
setFinishClicked(boolean finishClicked)
Sets the finishedClicked attribute. |
void |
setThankYouNote(java.lang.String thankYouNote)
Sets the custom thank-you note for current respondent. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public void setAttribute(java.lang.String attributeName, java.lang.String attributeValue) throws SurveySystemException
opdata_()
are allowed.
Attributes with a different name will simply be ignored.
When the respondent object is stored/updated the respondent attributes
will be stored in the OPS_RespondentAttribute table in the database.
String
- attributeName The attribute nameString
- attributeValue The attribute value
SurveySystemException
public void setFinishClicked(boolean finishClicked) throws SurveySystemException
finishClicked
- True to simulate clicking on finish button.
SurveySystemException
public void setBlocked(boolean blocked) throws SurveySystemException
blocked
- True to block respondent, false otherwise.
SurveySystemException
public void setThankYouNote(java.lang.String thankYouNote) throws SurveySystemException
thankYouNote
- The customized thank-you note.
SurveySystemException
public java.lang.String getAttribute(java.lang.String attributeName) throws SurveySystemException
String
- attributeName The attribute name
SurveySystemException
public java.util.HashMap getAttributes() throws SurveySystemException
SurveySystemException
public boolean getAttributesExist() throws SurveySystemException
SurveySystemException
public java.lang.String getUserData(int index) throws SurveySystemException
index
- The index of the user data.
SurveySystemException
- If an error occurs in the system.public void setCurrentResponse(int currentResponse) throws java.lang.IllegalArgumentException, SurveySystemException
currentResponse
- The number of the question the
respondent is answering.
java.lang.IllegalArgumentException
- If invalid currentResponse
SurveySystemException
- If an error occurs in the system.public long getCompletedDate() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public long getInviteeId() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public int getCurrentResponse() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public long getEntryDate() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public java.lang.String getIpAddress() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public java.lang.String getLanguageCode() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public int getLastResponse() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public int getNextQuestion() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public long getRespondentId()
public boolean getBlocked() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public boolean getFinishClicked() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public java.lang.String getThankYouNote() throws SurveySystemException
SurveySystemException
public Response getResponse(int questionNo) throws java.lang.IllegalArgumentException, SurveySystemException
questionNo
- Question number of response to get
java.lang.IllegalArgumentException
- If illegal question number
SurveySystemException
- If an error occurs in the system.public long getSurveyId()
public java.lang.String getTicket() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public boolean isFilteredOut(int questionNo) throws java.lang.IllegalArgumentException, SurveySystemException
questionNo
- Question number
java.lang.IllegalArgumentException
- If illegal question number
SurveySystemException
- If any error occurs in the system.public boolean isPersisted() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public void deleteResponse(int questionNo) throws SurveySystemException
questionNo
- Question number of response to remove.
SurveySystemException
- If an error occurs in the system.public boolean hasBusinessObject()
public void keepBusinessObject() throws SurveySystemException
SurveySystemException
- If an error occurs in the system.public void releaseBusinessObject()
|
Copyright ? ObjectPlanet Inc. All Rights Reserved. | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |