Interface XPollManager


  • @Role
    @Unstable
    public interface XPollManager
    Provides methods to interact with the polls of a XWiki page.
    Since:
    2.1
    Version:
    $Id$
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      String getRestURL​(org.xwiki.model.reference.DocumentReference documentReference)  
      Map<String,​Integer> getVoteResults​(org.xwiki.model.reference.DocumentReference documentReference)  
      void vote​(org.xwiki.model.reference.DocumentReference page, org.xwiki.model.reference.DocumentReference user, Vote vote)
      Casts a vote of a user to an existing poll in a XWiki page.
    • Method Detail

      • vote

        void vote​(org.xwiki.model.reference.DocumentReference page,
                  org.xwiki.model.reference.DocumentReference user,
                  Vote vote)
           throws XPollException
        Casts a vote of a user to an existing poll in a XWiki page.
        Parameters:
        page - the page that has a poll associated with itself
        user - a reference to the user that cast the votes
        vote - user voted options
        Throws:
        XPollException - thrown if the page is not found or if the function fails to create a new XPollVote or save the Document
      • getRestURL

        String getRestURL​(org.xwiki.model.reference.DocumentReference documentReference)
        Parameters:
        documentReference - the document that we want to get the URL for
        Returns:
        the REST URL of the XPoll associated with the specific document
      • getVoteResults

        Map<String,​Integer> getVoteResults​(org.xwiki.model.reference.DocumentReference documentReference)
                                          throws XPollException
        Parameters:
        documentReference - a document reference
        Returns:
        a map that has the XPoll proposals as keys and the scores as values.
        Throws:
        XPollException - thrown if the document is missing or if it lacks a poll.