Class AnswerEntity
- java.lang.Object
-
- org.silverpeas.components.survey.web.AnswerEntity
-
- All Implemented Interfaces:
Serializable,org.silverpeas.core.web.rs.WebEntity
public class AnswerEntity extends Object implements org.silverpeas.core.web.rs.WebEntity
This is a WEB entity representation of anAnswerlinked to aQuestion.- Author:
- silveryocha
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAnswerEntity()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AnswerEntityasWebEntity(org.silverpeas.core.questioncontainer.answer.model.Answer answer)Gets theAnswerEntityinstance from givenAnswerone.StringgetId()Gets the identifier of the answer.StringgetImageUrl()Gets the URL of a linked image if any.StringgetInstanceId()Gets the identifier of the survey component instance hosting the answer.StringgetLabel()Gets the label of the answer.intgetNbVoters()Gets the number of voters who choose the answer.StringgetQuestionId()Gets the identifier of the question the answer is linked to.URIgetURI()booleanisOpened()Indicates if the answer is an opened one.static Optional<String>normalizeImageUrl(String instanceId, String imageUrl)Normalizes the image URL of an answer.voidsetId(String id)voidsetImageUrl(String imageUrl)voidsetInstanceId(String instanceId)voidsetLabel(String label)voidsetNbVoters(int nbVoters)voidsetOpened(boolean opened)voidsetQuestionId(String questionId)
-
-
-
Method Detail
-
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
public static Optional<String> normalizeImageUrl(String instanceId, String imageUrl)
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
public String getId()
Gets the identifier of the answer.- Returns:
- a string identifier.
-
setId
public void setId(String id)
-
getInstanceId
public String getInstanceId()
Gets the identifier of the survey component instance hosting the answer.- Returns:
- a string identifier.
-
setInstanceId
public void setInstanceId(String instanceId)
-
getQuestionId
public String getQuestionId()
Gets the identifier of the question the answer is linked to.- Returns:
- a string identifier.
-
setQuestionId
public void setQuestionId(String questionId)
-
getLabel
public String getLabel()
Gets the label of the answer.- Returns:
- a string.
-
setLabel
public void setLabel(String label)
-
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
public String getImageUrl()
Gets the URL of a linked image if any.- Returns:
- a string if any, null or empty otherwise.
-
setImageUrl
public void setImageUrl(String imageUrl)
-
getURI
public URI getURI()
- Specified by:
getURIin interfaceorg.silverpeas.core.web.rs.WebEntity
-
-