Clearspace API (2.5.29) Core Javadocs

com.jivesoftware.community
Interface PollManager


public interface PollManager

Provides a manager to create, retrieve and delete polls.

Polls can exist at the system (global) level or can be attached to any object.

See Also:
Poll

Method Summary
 Poll createPoll(int objectType, long objectID, User user, String name)
          Create a new Poll.
 void deletePoll(Poll poll)
          Deletes a poll.
 void deleteUserPolls(User user)
          Deletes all of a user's polls.
 int getActivePollCount()
          Returns a count of all active polls in the system.
 int getActivePollCount(int objectType, long objectID)
          Returns a count of all active polls of a given type and object ID.
 JiveIterator<Poll> getActivePolls()
          Returns an iterable of active polls in the system.
 JiveIterator<Poll> getActivePolls(int objectType, long objectID)
          Returns an iterable of active polls associated with the object specified by the objectType and objectID.
 int getLivePollCount()
          Returns a count of all live polls in the system.
 int getLivePollCount(int objectType, long objectID)
          Returns a count of all live polls of a given type and object ID.
 JiveIterator<Poll> getLivePolls()
          Returns an iterable of live polls in the system.
 JiveIterator<Poll> getLivePolls(int objectType, long objectID)
          Returns an iterable of live polls associated with the object specified by the objectType and objectID.
 Poll getPoll(long pollID)
          Returns the Poll specified by the poll ID.
 int getPollCount()
          Returns a count of all polls, both active and inactive.
 int getPollCount(int objectType, long objectID)
          Returns an count of polls, both active and inactive, associated with the object specified by the objectType and objectID.
 JiveIterator<Poll> getPolls()
          Returns an iterable of all polls, both active and inactive.
 JiveIterator<Poll> getPolls(int objectType, long objectID)
          Returns an iterable of polls, both active and inactive, associated with the object specified by the objectType and objectID.
 

Method Detail

createPoll

Poll createPoll(int objectType,
                long objectID,
                User user,
                String name)
                throws UnauthorizedException
Create a new Poll. The objectType should be a valid constant from the JiveConstants class, and the objectID should be a valid ID for the given object type.

Parameters:
objectType - the object type of the object the poll is associated with.
objectID - the objectID of the object the poll is associated with.
user - the user creating the poll or null if is an anonymous user.
name - the name of the new poll.
Returns:
a new Poll object.
Throws:
UnauthorizedException - if no permissions to create a poll.

deletePoll

void deletePoll(Poll poll)
                throws UnauthorizedException,
                       PollException
Deletes a poll.

Parameters:
poll - the poll to delete
Throws:
UnauthorizedException - if no permissions to delete the poll.
PollException - if the poll could not be deleted

deleteUserPolls

void deleteUserPolls(User user)
                     throws UnauthorizedException,
                            PollException
Deletes all of a user's polls.

Parameters:
user - the author of the polls being deleted.
Throws:
UnauthorizedException - if no permissions to delete the poll.
PollException - if the polls could not be deleted

getPollCount

int getPollCount()
Returns a count of all polls, both active and inactive.

Returns:
a count of all polls, both active and inactive.

getPolls

JiveIterator<Poll> getPolls()
Returns an iterable of all polls, both active and inactive. The ordering of the polls is from active to inactive polls and then from newest to oldest in each group.

Returns:
an iterable of all polls, both active and inactive.

getPollCount

int getPollCount(int objectType,
                 long objectID)
                 throws UnauthorizedException
Returns an count of polls, both active and inactive, associated with the object specified by the objectType and objectID.

Parameters:
objectType - the object type of the object the poll is associated with.
objectID - the objectID of the object the poll is associated with.
Returns:
an count of polls, both active and inactive, associated with the object specified by the objectType and objectID.
Throws:
UnauthorizedException - if no permissions to view polls for the specified objectType and objectID.

getPolls

JiveIterator<Poll> getPolls(int objectType,
                            long objectID)
                            throws UnauthorizedException
Returns an iterable of polls, both active and inactive, associated with the object specified by the objectType and objectID.

Parameters:
objectType - the object type of the object the poll is associated with.
objectID - the objectID of the object the poll is associated with.
Returns:
an iterable of Poll objects for polls, both active and inactive, associated with the object specified by the objectType and objectID.
Throws:
UnauthorizedException - if no permissions to view polls for the specified objectType and objectID.

getActivePolls

JiveIterator<Poll> getActivePolls()
Returns an iterable of active polls in the system. Active polls are defined as polls where the current date is between the poll's start and expire dates.

Returns:
an iterable of active polls in the system.

getActivePollCount

int getActivePollCount()
Returns a count of all active polls in the system. Active polls are defined as polls where the current date is between the poll's start and expire dates.

Returns:
a count of all active polls in the system.

getActivePolls

JiveIterator<Poll> getActivePolls(int objectType,
                                  long objectID)
                                  throws UnauthorizedException
Returns an iterable of active polls associated with the object specified by the objectType and objectID. Active polls are defined as polls where the current date is between the poll's start and expire dates.

Parameters:
objectType - the object type of the object the poll is associated with.
objectID - the objectID of the object the poll is associated with.
Returns:
an iterable of Poll objects for active polls associated with the object specified by the objectType and objectID.
Throws:
UnauthorizedException - if no permissions to view polls for the specified objectType and objectID.

getActivePollCount

int getActivePollCount(int objectType,
                       long objectID)
Returns a count of all active polls of a given type and object ID. Active polls are defined as polls where the current date is between the poll's start and expire dates.

Parameters:
objectType - the type of object we're looking at (defined in the JiveConstants class.
objectID - the ID of the object we're looking at.
Returns:
a count of all active polls for the given object.

getLivePolls

JiveIterator<Poll> getLivePolls()
Returns an iterable of live polls in the system. Live polls are defined as polls where the current date is between the poll's start and end dates.

Returns:
an iterable of live polls in the system.

getLivePollCount

int getLivePollCount()
Returns a count of all live polls in the system. Live polls are defined as polls where the current date is between the poll's start and end dates.

Returns:
a count of all live polls in the system.

getLivePolls

JiveIterator<Poll> getLivePolls(int objectType,
                                long objectID)
                                throws UnauthorizedException
Returns an iterable of live polls associated with the object specified by the objectType and objectID. Live polls are defined as polls where the current date is between the poll's start and end dates.

Parameters:
objectType - the object type of the object the poll is associated with.
objectID - the objectID of the object the poll is associated with.
Returns:
an iterable of Poll objects for live polls associated with the object specified by the objectType and objectID.
Throws:
UnauthorizedException - if no permissions to view polls for the specified objectType and objectID.

getLivePollCount

int getLivePollCount(int objectType,
                     long objectID)
                     throws UnauthorizedException
Returns a count of all live polls of a given type and object ID. Live polls are defined as polls where the current date is between the poll's start and end dates.

Parameters:
objectType - the type of object we're looking at (defined in the JiveConstants class.
objectID - the ID of the object we're looking at.
Returns:
a count of all live polls for the given object.
Throws:
UnauthorizedException - if not allowed

getPoll

Poll getPoll(long pollID)
             throws UnauthorizedException,
                    NotFoundException
Returns the Poll specified by the poll ID.

Parameters:
pollID - the id of the poll to return.
Returns:
the Poll specified by the pollID.
Throws:
UnauthorizedException - if no permissions to view the poll.
NotFoundException - if the poll of the given ID was not found.

Clearspace Project Page

Copyright © 1999-2007 Jive Software.