com.sap.netweaver.coll.forums.api

Interface IForumPoll


public interface IForumPoll

A poll can be attached to any object in the system or can exist at the global level. Additionally, polls can exist in a certain time range. For example, one can create a poll and have it be active in 2 weeks for 1 month. Inactive polls can also be displayed and can be later permanently deleted from the system. с


Field Summary
static long ALLOW_ANONYMOUS_VOTE_MODIFICATION
          Mode to allow guests to change their vote after casting the vote.
static long ALLOW_USER_VOTE_MODIFICATION
          Mode to allow users to change their vote after casting the vote.
static long MULTIPLE_SELECTIONS_ALLOWED
          Mode to allow users to select multiple options in a poll.
 
Method Summary
 void addAnonymousVote(int index, String uniqueID)
          Adds anonymous vote to the poll
 void addOption(String value)
          Adds option to the poll
 void addUserVote(int index, String userName)
          Adds user vote to the poll
 void changeAnonymousVote(int prevIndex, int newIndex, String uniqueID)
          Changes anonymous vote
 void changeUserVote(int prevIndex, int newIndex, String username)
          Changes user vote
 void delete()
          Deletes the poll
 void deleteOption(int index)
          Deletes option
 int getAnonymousVoteCount()
          Retrieves anonymous vote count
 int getAnonymousVoteCount(int index)
          Retrieves anonymous vote count
 int[] getAnonymousVotes(String uniqueID)
          Retrieves option votes
 String getAuthorName()
          Retrieves the author name of the poll
 Date getCreationDate()
          Retrieves creation date of the poll
 String getDescription()
          Retrieves description of the poll
 Date getEndDate()
          Retrieves end date of the poll
 Date getExpirationDate()
          Retrieves expiration date of the poll
 long getID()
          Retrieves the unique identifier of the poll
 Date getModificationDate()
          Retrieves modification date of the poll
 String getName()
          Retrieves the name of the poll
 String getOption(int index)
          Retrieves the value at specific index in the options of the poll
 int getOptionCount()
          Retrieves the option count for the poll
 Date getStartDate()
          Retrieves start date of the poll
 int getUserVoteCount()
          Retrieves the total number of user votes for the poll
 int getUserVoteCount(int index)
          Retrieves the number of count for specific option
 String[] getUserVotes()
          Retrieves users voted in the poll
 String[] getUserVotes(int index)
          Retrieves users voted for specific index in the poll
 int[] getUserVotes(String username)
          Retrieves the indexes of votes of specific user
 int getVoteCount()
          Get the total number of votes for the poll
 int getVoteCount(int index)
          Get total number of votes for specific option in the poll
 boolean hasAnonymousVoted(String uniqueID)
          Checks if anonymous with specific unique identifier has voted
 boolean hasUserVoted(String username)
          Checks if user with specific name has voted
 boolean isModeEnabled(long mode)
          Checks if mode is enabled.
 void refresh()
          Retrieves latest content of poll
 void removeAnonymousVote(int prevIndex, String uniqueID)
          Removes anonymous vote
 void removeUserVote(int prevIndex, String username)
          Removes user vote
 void save()
          Saves the poll
 void setDescription(String description)
          Sets the description of the poll
 void setEndDate(Date endDate)
          Sets the end date of the poll
 void setExpirationDate(Date expirationDate)
          Sets the expiration date of the poll
 void setMode(long mode, boolean enabled)
          Sets the mode.
 void setName(String name)
          Sets the name of the poll
 void setOption(int index, String value)
          Sets value of option by index.
 void setOptionIndex(int currentIndex, int newIndex)
          Changes option at specific index
 void setStartDate(Date startDate)
          Sets start date of the poll
 

Field Detail

ALLOW_USER_VOTE_MODIFICATION

static final long ALLOW_USER_VOTE_MODIFICATION
Mode to allow users to change their vote after casting the vote. Not set by default.

See Also:
Constant Field Values

ALLOW_ANONYMOUS_VOTE_MODIFICATION

static final long ALLOW_ANONYMOUS_VOTE_MODIFICATION
Mode to allow guests to change their vote after casting the vote. Not set by default.

See Also:
Constant Field Values

MULTIPLE_SELECTIONS_ALLOWED

static final long MULTIPLE_SELECTIONS_ALLOWED
Mode to allow users to select multiple options in a poll. Not set by default.

See Also:
Constant Field Values
Method Detail

getID

long getID()
Retrieves the unique identifier of the poll

Returns:
unique identifier

delete

void delete()
            throws com.sap.netweaver.coll.forums.exceptions.PollNotFoundException,
                   com.sap.netweaver.coll.forums.exceptions.PollDeletionException
Deletes the poll

Throws:
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
com.sap.netweaver.coll.forums.exceptions.PollDeletionException

save

void save()
          throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                 com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Saves the poll

Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

refresh

void refresh()
             throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                    com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves latest content of poll

Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

addOption

void addOption(String value)
               throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                      com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Adds option to the poll

Parameters:
value - the value of the option
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

addAnonymousVote

void addAnonymousVote(int index,
                      String uniqueID)
                      throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                             com.sap.netweaver.coll.forums.exceptions.PollException,
                             com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Adds anonymous vote to the poll

Parameters:
index - the index of the option
uniqueID - the unique identifier of the anonymous user
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

addUserVote

void addUserVote(int index,
                 String userName)
                 throws com.sap.netweaver.coll.forums.exceptions.UserNotFoundException,
                        com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                        com.sap.netweaver.coll.forums.exceptions.PollNotFoundException,
                        com.sap.netweaver.coll.forums.exceptions.PollException
Adds user vote to the poll

Parameters:
index - the index of the option
userName - the user name
Throws:
com.sap.netweaver.coll.forums.exceptions.UserNotFoundException
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
com.sap.netweaver.coll.forums.exceptions.PollException

changeAnonymousVote

void changeAnonymousVote(int prevIndex,
                         int newIndex,
                         String uniqueID)
                         throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                                com.sap.netweaver.coll.forums.exceptions.PollException,
                                com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Changes anonymous vote

Parameters:
prevIndex - the previous index of the option
newIndex - the new index of the option
uniqueID - the unique identifier of the anonymous user
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

changeUserVote

void changeUserVote(int prevIndex,
                    int newIndex,
                    String username)
                    throws com.sap.netweaver.coll.forums.exceptions.UserNotFoundException,
                           com.sap.netweaver.coll.forums.exceptions.PollException,
                           com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                           com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Changes user vote

Parameters:
prevIndex - the previous index of the option
newIndex - the new index of the option
username - the user name
Throws:
com.sap.netweaver.coll.forums.exceptions.UserNotFoundException
com.sap.netweaver.coll.forums.exceptions.PollException
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

deleteOption

void deleteOption(int index)
                  throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                         com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Deletes option

Parameters:
index - the index of the option
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getAnonymousVoteCount

int getAnonymousVoteCount()
                          throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                                 com.sap.netweaver.coll.forums.exceptions.PollException,
                                 com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves anonymous vote count

Returns:
count of anonymous votes
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getAnonymousVoteCount

int getAnonymousVoteCount(int index)
                          throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                                 com.sap.netweaver.coll.forums.exceptions.PollException,
                                 com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves anonymous vote count

Parameters:
index -
Returns:
anonymous vote count
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getAnonymousVotes

int[] getAnonymousVotes(String uniqueID)
                        throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                               com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves option votes

Parameters:
uniqueID - the unique identifier of anonymous user
Returns:
array of option indexes
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getCreationDate

Date getCreationDate()
Retrieves creation date of the poll

Returns:
the creation date

getDescription

String getDescription()
Retrieves description of the poll

Returns:
the description

getEndDate

Date getEndDate()
Retrieves end date of the poll

Returns:
the end date

getExpirationDate

Date getExpirationDate()
Retrieves expiration date of the poll

Returns:
the expiration date

getModificationDate

Date getModificationDate()
Retrieves modification date of the poll

Returns:
the modification date

getName

String getName()
Retrieves the name of the poll

Returns:
name of the poll

getOption

String getOption(int index)
                 throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                        com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves the value at specific index in the options of the poll

Parameters:
index - the index
Returns:
the value of the option
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getOptionCount

int getOptionCount()
                   throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                          com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves the option count for the poll

Returns:
count of options in the poll
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getAuthorName

String getAuthorName()
Retrieves the author name of the poll

Returns:
the name of poll author

getUserVotes

String[] getUserVotes()
                      throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                             com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves users voted in the poll

Returns:
array of user names
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getUserVotes

String[] getUserVotes(int index)
                      throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                             com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves users voted for specific index in the poll

Parameters:
index -
Returns:
array of user names
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getUserVotes

int[] getUserVotes(String username)
                   throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                          com.sap.netweaver.coll.forums.exceptions.UserNotFoundException,
                          com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves the indexes of votes of specific user

Parameters:
username - the user name
Returns:
array of indexes of votes
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.UserNotFoundException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getStartDate

Date getStartDate()
Retrieves start date of the poll

Returns:
the start date

hasAnonymousVoted

boolean hasAnonymousVoted(String uniqueID)
                          throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                                 com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Checks if anonymous with specific unique identifier has voted

Parameters:
uniqueID - the unique identifier of the anonymous user
Returns:
true if the anonymous user has voted
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

hasUserVoted

boolean hasUserVoted(String username)
                     throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                            com.sap.netweaver.coll.forums.exceptions.UserNotFoundException,
                            com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Checks if user with specific name has voted

Parameters:
username - the user name
Returns:
true if the user has voted
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.UserNotFoundException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

isModeEnabled

boolean isModeEnabled(long mode)
                      throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                             com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Checks if mode is enabled. Modes are defined in the interface.

Parameters:
mode - the mode
Returns:
true if mode is enabled
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

removeAnonymousVote

void removeAnonymousVote(int prevIndex,
                         String uniqueID)
                         throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                                com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Removes anonymous vote

Parameters:
prevIndex - the index of the option
uniqueID - the unique identifier of the anonymous user
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

removeUserVote

void removeUserVote(int prevIndex,
                    String username)
                    throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                           com.sap.netweaver.coll.forums.exceptions.UserNotFoundException,
                           com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Removes user vote

Parameters:
prevIndex - the index of the option
username - the user name
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.UserNotFoundException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

setDescription

void setDescription(String description)
Sets the description of the poll

Parameters:
description - the description

setEndDate

void setEndDate(Date endDate)
Sets the end date of the poll

Parameters:
endDate - the end date

setExpirationDate

void setExpirationDate(Date expirationDate)
Sets the expiration date of the poll

Parameters:
expirationDate - the expiration date

setMode

void setMode(long mode,
             boolean enabled)
             throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                    com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Sets the mode. Modes are defined in the interface.

Parameters:
mode - the mode
enabled - weather the mode should be enabled or disabled
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

setName

void setName(String name)
Sets the name of the poll

Parameters:
name - the name

setOption

void setOption(int index,
               String value)
               throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                      com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Sets value of option by index.

Parameters:
index -
value -
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

setOptionIndex

void setOptionIndex(int currentIndex,
                    int newIndex)
                    throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                           com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Changes option at specific index

Parameters:
currentIndex - the current index of the option
newIndex - the new index of the option
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

setStartDate

void setStartDate(Date startDate)
Sets start date of the poll

Parameters:
startDate - the start date

getUserVoteCount

int getUserVoteCount(int index)
                     throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                            com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves the number of count for specific option

Parameters:
index - the index of the option
Returns:
the count of user votes for the option
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getUserVoteCount

int getUserVoteCount()
                     throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                            com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Retrieves the total number of user votes for the poll

Returns:
the count of user votes
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getVoteCount

int getVoteCount()
                 throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                        com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Get the total number of votes for the poll

Returns:
the count of votes
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException

getVoteCount

int getVoteCount(int index)
                 throws com.sap.netweaver.coll.forums.exceptions.UnauthorizedException,
                        com.sap.netweaver.coll.forums.exceptions.PollNotFoundException
Get total number of votes for specific option in the poll

Parameters:
index - the option index
Returns:
the count of votes
Throws:
com.sap.netweaver.coll.forums.exceptions.UnauthorizedException
com.sap.netweaver.coll.forums.exceptions.PollNotFoundException


Copyright 2011 SAP AG Complete Copyright Notice