Class AnswerEntity
java.lang.Object
org.silverpeas.components.survey.web.AnswerEntity
- All Implemented Interfaces:
Serializable,org.silverpeas.core.web.rs.WebEntity
This is a WEB entity representation of an
Answer linked to a Question.- Author:
- silveryocha
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AnswerEntityasWebEntity(org.silverpeas.core.questioncontainer.answer.model.Answer answer) Gets theAnswerEntityinstance from givenAnswerone.getId()Gets the identifier of the answer.Gets the URL of a linked image if any.Gets the identifier of the survey component instance hosting the answer.getLabel()Gets the label of the answer.intGets the number of voters who choose the answer.Gets the identifier of the question the answer is linked to.getURI()booleanisOpened()Indicates if the answer is an opened one.normalizeImageUrl(String instanceId, String imageUrl) Normalizes the image URL of an answer.voidvoidsetImageUrl(String imageUrl) voidsetInstanceId(String instanceId) voidvoidsetNbVoters(int nbVoters) voidsetOpened(boolean opened) voidsetQuestionId(String questionId)
-
Constructor Details
-
AnswerEntity
protected AnswerEntity()
-
-
Method Details
-
asWebEntity
public static AnswerEntity asWebEntity(org.silverpeas.core.questioncontainer.answer.model.Answer answer) Gets theAnswerEntityinstance from givenAnswerone.- Parameters:
answer- the answer model to get into WEB entity representation.- Returns:
- an
AnswerEntityinstance.
-
normalizeImageUrl
Normalizes the image URL of an answer. This method does not take into parameters directly anAnswerinstance in order to be used in context of survey creation. In a such context,Answerdata are not safe.- Parameters:
instanceId- the identifier of the survey component instance.imageUrl- the URL of the image linked to an answer.- Returns:
- an optional normalized URL.
-
getId
Gets the identifier of the answer.- Returns:
- a string identifier.
-
setId
-
getInstanceId
Gets the identifier of the survey component instance hosting the answer.- Returns:
- a string identifier.
-
setInstanceId
-
getQuestionId
Gets the identifier of the question the answer is linked to.- Returns:
- a string identifier.
-
setQuestionId
-
getLabel
Gets the label of the answer.- Returns:
- a string.
-
setLabel
-
isOpened
public boolean isOpened()Indicates if the answer is an opened one.- Returns:
- true if opened, false otherwise.
-
setOpened
public void setOpened(boolean opened) -
getNbVoters
public int getNbVoters()Gets the number of voters who choose the answer.- Returns:
- an integer.
-
setNbVoters
public void setNbVoters(int nbVoters) -
getImageUrl
Gets the URL of a linked image if any.- Returns:
- a string if any, null or empty otherwise.
-
setImageUrl
-
getURI
- Specified by:
getURIin interfaceorg.silverpeas.core.web.rs.WebEntity
-