|
Jive Forums API (5.5.20.2-oracle) Developer Javadocs | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jivesoftware.base.database.DbPoll
public class DbPoll
Database implementation of the Poll Interface.
Field Summary |
---|
Fields inherited from interface com.jivesoftware.base.Poll |
---|
ALLOW_ANONYMOUS_VOTE_MODIFICATION, ALLOW_USER_VOTE_MODIFICATION, MULTIPLE_SELECTIONS_ALLOWED |
Constructor Summary | |
---|---|
protected |
DbPoll(int objectType,
long objectID,
User user,
java.lang.String name)
Create a new poll. |
protected |
DbPoll(long id)
load an existing poll. |
Method Summary | |
---|---|
void |
addAnonymousVote(int optionIndex,
java.lang.String uniqueID)
Add a guest vote for an option in the poll. |
void |
addAnonymousVote(int optionIndex,
java.lang.String uniqueID,
java.util.Date voteDate)
|
void |
addOption(java.lang.String value)
Add a new option to the poll. |
void |
addUserVote(int optionIndex,
User user)
Add a user vote for an option in the poll. |
void |
addUserVote(int optionIndex,
User user,
java.util.Date voteDate)
|
void |
changeAnonymousVote(int prevOptionIndex,
int newOptionIndex,
java.lang.String uniqueID)
Change a guest vote. |
void |
changeUserVote(int prevOptionIndex,
int newOptionIndex,
User user)
Change a user vote. |
protected void |
deleteFromDb()
|
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 optionIndex)
Returns a count of all user votes for the specified option in the poll. |
java.util.Iterator |
getAnonymousVotes()
Returns an Iterator of uniqueID's for guests who have voted for the option at the given index. |
java.util.Iterator |
getAnonymousVotes(int optionIndex)
Returns an Iterator of uniqueID's for guests who have voted for the option at the given index. |
java.util.List |
getAnonymousVotes(java.lang.String uniqueID)
Returns a list of option indexes corresponding to the anonymous votes, or an empty array if the user has not voted. |
int |
getCachedSize()
Returns the approximate size of the Object in bytes. |
java.util.Date |
getCreationDate()
Returns the date the poll was created. |
java.lang.String |
getDescription()
Returns a brief description of the poll. |
java.util.Date |
getEndDate()
Returns the date voting for the poll should end. |
java.util.Date |
getExpirationDate()
Returns the date the poll should expire. |
long |
getID()
Returns the unique ID of the poll. |
java.util.Date |
getModificationDate()
Returns the date the poll was last modified. |
java.lang.String |
getName()
Returns the name of the poll. |
long |
getObjectID()
Returns the object ID of the container that 'contains' the poll. |
int |
getObjectType()
Returns the object type of the container that 'contains' the poll. |
java.lang.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. |
java.util.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 optionIndex)
Returns a count of all user votes for the specified option in the poll. |
java.util.Iterator |
getUserVotes()
Returns an Iterator of User objects for users who have voted for any options in the poll. |
java.util.Iterator |
getUserVotes(int optionIndex)
Returns an Iterator of User objects for users who have voted for the option at the given index. |
java.util.List |
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 optionIndex)
Returns a count of all votes (both guest and user votes) for the specified option in the poll. |
java.util.Iterator |
getVotes()
|
boolean |
hasAnonymousVoted(java.lang.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,
java.lang.String uniqueID)
Remove a guest vote. |
void |
removeUserVote(int prevOptionIndex,
User user)
Remove a user vote. |
void |
setDescription(java.lang.String description)
Sets the description of the poll. |
void |
setEndDate(java.util.Date endDate)
Sets the date the poll should end. |
void |
setExpirationDate(java.util.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(java.lang.String name)
Sets the name of the poll. |
void |
setOption(int index,
java.lang.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(java.util.Date startDate)
Sets the date voting for the poll should start. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected DbPoll(long id) throws NotFoundException
id
- the ID of the poll to load
NotFoundException
protected DbPoll(int objectType, long objectID, User user, java.lang.String name)
objectType
- objectID
- name
- Method Detail |
---|
public User getUser()
Poll
getUser
in interface Poll
public int getObjectType()
Poll
getObjectType
in interface Poll
public long getObjectID()
Poll
getObjectID
in interface Poll
public long getID()
Poll
getID
in interface Poll
public java.lang.String getName()
Poll
getName
in interface Poll
public void setName(java.lang.String name)
Poll
setName
in interface Poll
name
- the new name of the poll.public java.lang.String getDescription()
Poll
getDescription
in interface Poll
public void setDescription(java.lang.String description)
Poll
setDescription
in interface Poll
description
- the description of the poll.public boolean isModeEnabled(long mode)
Poll
isModeEnabled
in interface Poll
public void setMode(long mode, boolean enabled)
Poll
setMode
in interface Poll
mode
- a valid modepublic java.util.Date getCreationDate()
Poll
getCreationDate
in interface Poll
public java.util.Date getModificationDate()
Poll
getModificationDate
in interface Poll
public java.util.Date getStartDate()
Poll
getStartDate
in interface Poll
public void setStartDate(java.util.Date startDate)
Poll
setStartDate
in interface Poll
startDate
- the date voting for the poll should start.public java.util.Date getEndDate()
Poll
getEndDate
in interface Poll
public void setEndDate(java.util.Date endDate)
Poll
setEndDate
in interface Poll
endDate
- the date the poll should end.public java.util.Date getExpirationDate()
Poll
getExpirationDate
in interface Poll
public void setExpirationDate(java.util.Date expireDate) throws UnauthorizedException
Poll
setExpirationDate
in interface Poll
expireDate
- the date the poll should expire.
UnauthorizedException
- if the user does not have permissions to administer the poll.public int getOptionCount()
Poll
getOptionCount
in interface Poll
public java.lang.String getOption(int index)
Poll
getOption
in interface Poll
index
- the index of the option to return the text for.
public void setOption(int index, java.lang.String value)
Poll
setOption
in interface Poll
index
- the index of the option to set the text for.value
- the new text for the option.public void setOptionIndex(int currentIndex, int newIndex) throws UnauthorizedException
Poll
setOptionIndex
in interface Poll
currentIndex
- the current index of the option.newIndex
- the new index of the option.
UnauthorizedException
- if the user does not have permissions to administer the poll.public void addOption(java.lang.String value)
Poll
addOption
in interface Poll
value
- the text for the new option.public void deleteOption(int index)
Poll
deleteOption
in interface Poll
public int getVoteCount()
Poll
getVoteCount
in interface Poll
public int getVoteCount(int optionIndex)
Poll
getVoteCount
in interface Poll
public int getUserVoteCount()
Poll
getUserVoteCount
in interface Poll
public int getUserVoteCount(int optionIndex)
Poll
getUserVoteCount
in interface Poll
public int getAnonymousVoteCount()
Poll
getAnonymousVoteCount
in interface Poll
public int getAnonymousVoteCount(int optionIndex)
Poll
getAnonymousVoteCount
in interface Poll
public java.util.Iterator getUserVotes()
Poll
getUserVotes
in interface Poll
public java.util.Iterator getVotes()
public java.util.Iterator getUserVotes(int optionIndex)
Poll
getUserVotes
in interface Poll
optionIndex
- the index to return the voting users for.
public java.util.Iterator getAnonymousVotes()
Poll
getAnonymousVotes
in interface Poll
public java.util.Iterator getAnonymousVotes(int optionIndex)
Poll
getAnonymousVotes
in interface Poll
optionIndex
- the index to return the voting guests for.
public boolean hasUserVoted(User user)
Poll
hasUserVoted
in interface Poll
user
- the user to check to see if they've voted already.
public boolean hasAnonymousVoted(java.lang.String uniqueID)
Poll
hasAnonymousVoted
in interface Poll
uniqueID
- the uniqueID of the guest to check to see if they've voted already.
public void addUserVote(int optionIndex, User user) throws PollException
Poll
addUserVote
in interface Poll
optionIndex
- 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.public void addUserVote(int optionIndex, User user, java.util.Date voteDate) throws PollException
PollException
public void addAnonymousVote(int optionIndex, java.lang.String uniqueID) throws PollException
Poll
addAnonymousVote
in interface Poll
optionIndex
- 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.public void addAnonymousVote(int optionIndex, java.lang.String uniqueID, java.util.Date voteDate) throws PollException
PollException
public void changeUserVote(int prevOptionIndex, int newOptionIndex, User user) throws PollException
Poll
changeUserVote
in interface Poll
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.public void changeAnonymousVote(int prevOptionIndex, int newOptionIndex, java.lang.String uniqueID) throws PollException
Poll
changeAnonymousVote
in interface Poll
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.public void removeUserVote(int prevOptionIndex, User user) throws PollException
Poll
removeUserVote
in interface Poll
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.public void removeAnonymousVote(int prevOptionIndex, java.lang.String uniqueID) throws PollException
Poll
removeAnonymousVote
in interface Poll
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.public java.util.List getUserVotes(User user)
Poll
getUserVotes
in interface Poll
user
- the user to return the indexes of options the user has voted for.
public java.util.List getAnonymousVotes(java.lang.String uniqueID)
Poll
getAnonymousVotes
in interface Poll
uniqueID
- a uniqueID for the guest.
public boolean isAuthorized(long permissionType)
Poll
A list of possible permissions can be found in the ForumPermissions class. Certain methods of this class are restricted to certain permissions as specified in the method comments.
isAuthorized
in interface Poll
permissionType
- permissionType a permission type.
public int getCachedSize()
Cacheable
getCachedSize
in interface Cacheable
public java.lang.String toString()
toString
in class java.lang.Object
protected void deleteFromDb()
|
Jive Forums Project Page | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |