Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.database
Class DbPollManager

java.lang.Object
  extended by com.jivesoftware.base.database.DbPollManager
All Implemented Interfaces:
PollManager

public class DbPollManager
extends java.lang.Object
implements PollManager

Database implementation of the PollManager interface.


Field Summary
static int BLOCK_SIZE
          Number of pollID's per cache block.
protected static java.util.LinkedList insertQueue
          A queue for batch inserts of new votes.
 
Method Summary
 Poll createPoll(int objectType, long objectID, User user, java.lang.String name)
          Create a new Poll.
 void deletePoll(Poll poll)
          Deletes a poll.
 void deletePolls(int objectType, long objectID)
           
 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.
 java.util.Iterator getActivePolls()
          Returns an iterator of active polls in the system.
 java.util.Iterator getActivePolls(int objectType, long objectID)
          Returns an iterator of active polls associated with the object specified by the objectType and objectID.
protected  long[] getBlock(java.lang.String query, int startIndex)
          Returns a block of objectID's (threads or messages) from a query and performs transparent caching of those blocks.
static DbPollManager getInstance()
           
 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.
 java.util.Iterator getLivePolls()
          Returns an iterator of live polls in the system.
 java.util.Iterator getLivePolls(int objectType, long objectID)
          Returns an iterator 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.
 java.util.Iterator getPolls()
          Returns an iterator of all polls, both active and inactive.
 java.util.Iterator getPolls(int objectType, long objectID)
          Returns an iterator of polls, both active and inactive, associated with the object specified by the objectType and objectID.
 void movePolls(int sourceObjectType, long sourceObjectID, int targetObjectType, long targetObjectID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BLOCK_SIZE

public static final int BLOCK_SIZE
Number of pollID's per cache block.

See Also:
Constant Field Values

insertQueue

protected static java.util.LinkedList insertQueue
A queue for batch inserts of new votes. Values are written to the database in a process that is on a timer.

Method Detail

getInstance

public static DbPollManager getInstance()

createPoll

public Poll createPoll(int objectType,
                       long objectID,
                       User user,
                       java.lang.String name)
Description copied from interface: PollManager
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.

Specified by:
createPoll in interface PollManager
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.

deletePoll

public void deletePoll(Poll poll)
                throws PollException
Description copied from interface: PollManager
Deletes a poll.

Specified by:
deletePoll in interface PollManager
Parameters:
poll - the poll to delete
Throws:
PollException

deletePolls

public void deletePolls(int objectType,
                        long objectID)

getPollCount

public int getPollCount()
Description copied from interface: PollManager
Returns a count of all polls, both active and inactive.

Specified by:
getPollCount in interface PollManager
Returns:
a count of all polls, both active and inactive.

getPolls

public java.util.Iterator getPolls()
Description copied from interface: PollManager
Returns an iterator 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.

Specified by:
getPolls in interface PollManager
Returns:
an iterator of all polls, both active and inactive.

getPollCount

public int getPollCount(int objectType,
                        long objectID)
Description copied from interface: PollManager
Returns an count of polls, both active and inactive, associated with the object specified by the objectType and objectID.

Specified by:
getPollCount in interface PollManager
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.

getPolls

public java.util.Iterator getPolls(int objectType,
                                   long objectID)
Description copied from interface: PollManager
Returns an iterator of polls, both active and inactive, associated with the object specified by the objectType and objectID.

Specified by:
getPolls in interface PollManager
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 iterator of Poll objects for polls, both active and inactive, associated with the object specified by the objectType and objectID.

getActivePolls

public java.util.Iterator getActivePolls()
Description copied from interface: PollManager
Returns an iterator 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.

Specified by:
getActivePolls in interface PollManager
Returns:
an iterator of active polls in the system.

getActivePollCount

public int getActivePollCount()
Description copied from interface: PollManager
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.

Specified by:
getActivePollCount in interface PollManager
Returns:
a count of all active polls in the system.

getActivePolls

public java.util.Iterator getActivePolls(int objectType,
                                         long objectID)
Description copied from interface: PollManager
Returns an iterator 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.

Specified by:
getActivePolls in interface PollManager
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 iterator of Poll objects for active polls associated with the object specified by the objectType and objectID.

getActivePollCount

public int getActivePollCount(int objectType,
                              long objectID)
Description copied from interface: PollManager
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.

Specified by:
getActivePollCount in interface PollManager
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

public java.util.Iterator getLivePolls()
Description copied from interface: PollManager
Returns an iterator 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.

Specified by:
getLivePolls in interface PollManager
Returns:
an iterator of live polls in the system.

getLivePollCount

public int getLivePollCount()
Description copied from interface: PollManager
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.

Specified by:
getLivePollCount in interface PollManager
Returns:
a count of all live polls in the system.

getLivePolls

public java.util.Iterator getLivePolls(int objectType,
                                       long objectID)
Description copied from interface: PollManager
Returns an iterator 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.

Specified by:
getLivePolls in interface PollManager
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 iterator of Poll objects for live polls associated with the object specified by the objectType and objectID.

getLivePollCount

public int getLivePollCount(int objectType,
                            long objectID)
Description copied from interface: PollManager
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.

Specified by:
getLivePollCount in interface PollManager
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.

getPoll

public Poll getPoll(long pollID)
             throws NotFoundException
Description copied from interface: PollManager
Returns the Poll specified by the poll ID.

Specified by:
getPoll in interface PollManager
Parameters:
pollID - the id of the poll to return.
Returns:
the Poll specified by the pollID.
Throws:
NotFoundException - if the poll of the given ID was not found.

movePolls

public void movePolls(int sourceObjectType,
                      long sourceObjectID,
                      int targetObjectType,
                      long targetObjectID)

getBlock

protected long[] getBlock(java.lang.String query,
                          int startIndex)
Returns a block of objectID's (threads or messages) from a query and performs transparent caching of those blocks. The two parameters specify a database query and a startIndex for the results in that query.

Parameters:
query - the SQL message list query to cache blocks from.
startIndex - the startIndex in the list to get a block for.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.