Class AnswerPercentEntity

  • All Implemented Interfaces:
    Serializable, org.silverpeas.core.web.rs.WebEntity

    public class AnswerPercentEntity
    extends Object
    implements org.silverpeas.core.web.rs.WebEntity
    This is a representation of an answer percent against other answer percents of a question.
    Author:
    silveryocha
    See Also:
    Serialized Form
    • Constructor Detail

      • AnswerPercentEntity

        protected AnswerPercentEntity()
    • Method Detail

      • asWebEntities

        public static List<AnswerPercentEntity> asWebEntities​(Collection<org.silverpeas.core.questioncontainer.answer.model.Answer> answers,
                                                              int nbVoters,
                                                              boolean isUsers)
        Gets the given collection of answers to a question into a list of AnswerPercentEntity instances.
        Parameters:
        answers - answers to a question.
        nbVoters - the total number of survey voters.
        isUsers - false to shut down the percent computation, true otherwise.
        Returns:
        a list of AnswerPercentEntity instances.
      • getAnswer

        public AnswerEntity getAnswer()
        The WEB entity representation of an Answer.
        Returns:
        an AnswerEntity instance.
      • setAnswer

        public void setAnswer​(AnswerEntity answer)
      • getPercent

        public BigDecimal getPercent()
        The percent representation of the answer against the others for a question.
        Returns:
        a BigDecimal instance.
      • setPercent

        public void setPercent​(BigDecimal percent)
      • getURI

        public URI getURI()
        Specified by:
        getURI in interface org.silverpeas.core.web.rs.WebEntity