|
Clearspace API (2.5.29) Core Javadocs | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Poll
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.
PollManager| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.jivesoftware.community.JiveContentObject |
|---|
JiveContentObject.Field, JiveContentObject.Status |
| 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)
Add a guest vote for an option in the poll. |
void |
addOption(String value)
Add a new option to the poll. |
void |
addUserVote(int index,
User user)
Add a user vote for an option in the poll. |
void |
changeAnonymousVote(int prevOptionIndex,
int newOptionIndex,
String uniqueID)
Change a guest vote. |
void |
changeUserVote(int prevOptionIndex,
int newOptionIndex,
User user)
Change a user vote. |
void |
deleteOption(int index)
Remove an option from the poll. |
int |
getAnonymousVoteCount()
Returns a count of all guests user votes for all options in the poll. |
int |
getAnonymousVoteCount(int index)
Returns a count of all user votes for the specified option in the poll. |
Iterable<String> |
getAnonymousVotes()
Returns an Iterator of uniqueID's for guests who have voted for the option at the given index. |
Iterable<String> |
getAnonymousVotes(int index)
Returns an Iterator of uniqueID's for guests who have voted for the option at the given index. |
List<Integer> |
getAnonymousVotes(String uniqueID)
Returns a list of option indexes corresponding to the anonymous votes, or an empty array if the user has not voted. |
com.jivesoftware.community.CommentDelegator |
getCommentDelegator()
Retrieve a comment delegator to manage poll comments. |
int |
getCommentStatus()
Returns the comment status of this poll which may be any one of the following: NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
Defaults to OPEN. |
long |
getContainerObjectID()
Returns the object ID of the container that 'contains' the poll. |
int |
getContainerObjectType()
Returns the object type of the container that 'contains' the poll. |
Date |
getCreationDate()
Returns the date the poll was created. |
String |
getDescription()
Returns a brief description of the poll. |
Date |
getEndDate()
Returns the date voting for the poll should end. |
Date |
getExpirationDate()
Returns the date the poll should expire. |
long |
getID()
Returns the unique ID of the poll. |
Date |
getModificationDate()
Returns the date the poll was last modified. |
String |
getName()
Returns the name of the poll. |
String |
getOption(int index)
Returns the text of the option at the specified index. |
int |
getOptionCount()
Returns the number of options available in the poll. |
Date |
getStartDate()
Returns the date voting for the poll is set to start. |
User |
getUser()
Returns the user who created the poll or null if the poll was created anonymously. |
int |
getUserVoteCount()
Returns a count of all user votes for all options in the poll. |
int |
getUserVoteCount(int index)
Returns a count of all user votes for the specified option in the poll. |
Iterable<User> |
getUserVotes()
Returns an Iterator of User objects for users who have voted for any options in the poll. |
Iterable<User> |
getUserVotes(int index)
Returns an Iterator of User objects for users who have voted for the option at the given index. |
List<Integer> |
getUserVotes(User user)
Returns a list of option indexes corresponding to the user votes, or an empty array if the user has not voted. |
int |
getVoteCount()
Returns a count of all votes (both guest and user votes) for all options in the poll. |
int |
getVoteCount(int index)
Returns a count of all votes (both guest and user votes) for the specified option in the poll. |
boolean |
hasAnonymousVoted(String uniqueID)
Returns true if the guest associated with the uniqueID has previously voted in the poll, false otherwise. |
boolean |
hasUserVoted(User user)
Returns true if the user specified has previously voted in the poll, false otherwise. |
boolean |
isAuthorized(long permissionType)
Returns true if the handle on the object has the permission specified. |
boolean |
isModeEnabled(long mode)
Returns true if the mode specified is enabled for the poll, false otherwise. |
void |
removeAnonymousVote(int prevOptionIndex,
String uniqueID)
Remove a guest vote. |
void |
removeUserVote(int prevOptionIndex,
User user)
Remove a user vote. |
void |
setCommentStatus(int status)
Sets the comment status of this poll which may be any one of the following: NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
|
void |
setDescription(String description)
Sets the description of the poll. |
void |
setEndDate(Date endDate)
Sets the date the poll should end. |
void |
setExpirationDate(Date expireDate)
Sets the date the poll should expire. |
void |
setMode(long mode,
boolean enabled)
Sets a mode to be enabled or disabled for the poll. |
void |
setName(String name)
Sets the name of the poll. |
void |
setOption(int index,
String value)
Sets the text of the option at the specified index. |
void |
setOptionIndex(int currentIndex,
int newIndex)
Moves the option's index. |
void |
setStartDate(Date startDate)
Sets the date voting for the poll should start. |
| Methods inherited from interface com.jivesoftware.community.JiveContentObject |
|---|
getBody, getContainerID, getContainerType, getIndexContent, getPlainBody, getPlainSubject, getStatus, getSubject, getUnfilteredSubject |
| Methods inherited from interface com.jivesoftware.community.JiveObject |
|---|
getObjectType |
| Methods inherited from interface com.jivesoftware.community.JiveObject |
|---|
getObjectType |
| Field Detail |
|---|
static final long ALLOW_USER_VOTE_MODIFICATION
static final long ALLOW_ANONYMOUS_VOTE_MODIFICATION
static final long MULTIPLE_SELECTIONS_ALLOWED
| Method Detail |
|---|
User getUser()
getUser in interface JiveContentObjectint getContainerObjectType()
long getContainerObjectID()
long getID()
getID in interface JiveObjectString getName()
void setName(String name)
throws UnauthorizedException
name - the new name of the poll.
UnauthorizedException - if the user does not have permissions to administer the poll.String getDescription()
void setDescription(String description)
throws UnauthorizedException
description - the description of the poll.
UnauthorizedException - if the user does not have permissions to administer the poll.boolean isModeEnabled(long mode)
mode - a valid poll mode
void setMode(long mode,
boolean enabled)
throws UnauthorizedException
mode - a valid modeenabled - true if the poll should be enabled, false if not
UnauthorizedException - if the user does not have permissions to administer the poll.Date getCreationDate()
getCreationDate in interface JiveContentObjectDate getModificationDate()
getModificationDate in interface JiveContentObjectDate getStartDate()
void setStartDate(Date startDate)
throws UnauthorizedException
startDate - the date voting for the poll should start.
UnauthorizedException - if the user does not have permissions to administer the poll.Date getEndDate()
void setEndDate(Date endDate)
throws UnauthorizedException
endDate - the date the poll should end.
UnauthorizedException - if the user does not have permissions to administer the poll.Date getExpirationDate()
void setExpirationDate(Date expireDate)
throws UnauthorizedException
expireDate - the date the poll should expire.
UnauthorizedException - if the user does not have permissions to administer the poll.int getOptionCount()
String getOption(int index)
index - the index of the option to return the text for.
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
void setOption(int index,
String value)
throws UnauthorizedException
index - the index of the option to set the text for.value - the new text for the option.
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
UnauthorizedException - if the user does not have permissions to administer the poll.
void setOptionIndex(int currentIndex,
int newIndex)
throws UnauthorizedException
currentIndex - the current index of the option.newIndex - the new index of the option.
IndexOutOfBoundsException - if 0 > oldIndex/newIndex > getOptionCount() - 1
UnauthorizedException - if the user does not have permissions to administer the poll.
void addOption(String value)
throws UnauthorizedException
value - the text for the new option.
UnauthorizedException - if the user does not have permissions to administer the poll.
void deleteOption(int index)
throws UnauthorizedException
index -
UnauthorizedException - if the user does not have permissions to administer the poll.
int getVoteCount()
throws PollException
PollException - reserved for future changes.
int getVoteCount(int index)
throws PollException
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
PollException - reserved for future changes.
int getUserVoteCount()
throws PollException
PollException - reserved for future changes.
int getUserVoteCount(int index)
throws PollException
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
PollException - reserved for future changes.
int getAnonymousVoteCount()
throws PollException
PollException - reserved for future changes.
int getAnonymousVoteCount(int index)
throws PollException
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
PollException - reserved for future changes.
Iterable<User> getUserVotes()
throws PollException
PollException - reserved for future changes.
Iterable<User> getUserVotes(int index)
throws PollException
index - the index to return the voting users for.
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
PollException - reserved for future changes.
Iterable<String> getAnonymousVotes()
throws PollException
PollException - reserved for future changes.
Iterable<String> getAnonymousVotes(int index)
throws PollException
index - the index to return the voting guests for.
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
PollException - reserved for future changes.boolean hasUserVoted(User user)
user - the user to check to see if they've voted already.
boolean hasAnonymousVoted(String uniqueID)
uniqueID - the uniqueID of the guest to check to see if they've voted already.
void addUserVote(int index,
User user)
throws PollException,
UnauthorizedException
index - the index of the option that the user is voting foruser - the user making the vote
PollException - if the user has previously voted in the poll (2 second leeway is
provided for posting multiple votes if that mode is enabled) or the poll is not active.
UnauthorizedException - if the user does not have permission to vote.
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
void addAnonymousVote(int index,
String uniqueID)
throws PollException,
UnauthorizedException
index - the index of the option that the guest is voting foruniqueID - a uniqueID for the guest. We suggest either using a session ID or the remote
IP of the guest voting.
PollException - if the guest has previously voted in the poll (2 second leeway is
provided for posting multiple votes if that mode is enabled) or the poll is not active.
UnauthorizedException - if the guest does not have permission to vote.
IndexOutOfBoundsException - if 0 > index > getOptionCount() - 1
void changeUserVote(int prevOptionIndex,
int newOptionIndex,
User user)
throws PollException,
UnauthorizedException
prevOptionIndex - the index of the option to change the vote from.newOptionIndex - the index of the option to change the vote to.
PollException - if the poll is not active, the user did not vote for the
prevOptionIndex or vote modification is not enabled for users.
UnauthorizedException - if the user does not have permission to vote.
IndexOutOfBoundsException - if 0 > prevOptionIndex/newOptionIndex > getOptionCount() - 1
void changeAnonymousVote(int prevOptionIndex,
int newOptionIndex,
String uniqueID)
throws PollException,
UnauthorizedException
prevOptionIndex - the index of the option to change the vote from.newOptionIndex - the index of the option to change the vote to.uniqueID - a uniqueID for the guest.
PollException - if the poll is not active, the guest did not vote for the
prevOptionIndex or vote modification is not enabled for guests.
UnauthorizedException - if the guest does not have permission to vote.
IndexOutOfBoundsException - if 0 > prevOptionIndex/newOptionIndex > getOptionCount() - 1
void removeUserVote(int prevOptionIndex,
User user)
throws PollException,
UnauthorizedException
prevOptionIndex - the index of the option to remove the vote from.
PollException - if the poll is not active, the user did not vote for the
prevOptionIndex or vote modification is not enabled for users.
UnauthorizedException - if the user does not have permission to vote.
IndexOutOfBoundsException - if 0 > prevOptionIndex > getOptionCount() - 1
void removeAnonymousVote(int prevOptionIndex,
String uniqueID)
throws PollException,
UnauthorizedException
prevOptionIndex - the index of the option to remove the vote from.uniqueID - a uniqueID for the guest.
PollException - if the poll is not active, the guest did not vote for the
prevOptionIndex or vote modification is not enabled for guests.
UnauthorizedException - if the guest does not have permission to vote.
IndexOutOfBoundsException - if 0 > prevOptionIndex > getOptionCount() - 1List<Integer> getUserVotes(User user)
user - the user to return the indexes of options the user has voted for.
List<Integer> getAnonymousVotes(String uniqueID)
uniqueID - a uniqueID for the guest.
int getCommentStatus()
NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
OPEN.
getCommentStatus in interface com.jivesoftware.community.CommentContentResource
void setCommentStatus(int status)
throws UnauthorizedException
NONE -- no comments allowed
OPEN -- comments are permitted
CLOSED -- comments were permitted but are not allowed now
status - the comment status of this document
UnauthorizedException - if the user does not have permission to modify the poll.com.jivesoftware.community.CommentDelegator getCommentDelegator()
getCommentDelegator in interface com.jivesoftware.community.CommentContentResourceboolean isAuthorized(long permissionType)
A list of possible permissions can be found in the Permissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
permissionType - permissionType a permission type.
|
Clearspace Project Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||