com.dotmarketing.cms.polls.business
Class PollsAPILiferayImpl

java.lang.Object
  extended by com.dotmarketing.cms.polls.business.PollsAPILiferayImpl
All Implemented Interfaces:
PollsAPI

public class PollsAPILiferayImpl
extends java.lang.Object
implements PollsAPI

Author:
Roger Liferay implementation of the PollsAPI class uses Liferay Domain objects and com.liferay.portlet.polls.* methods.

Constructor Summary
PollsAPILiferayImpl()
           
 
Method Summary
 java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getActiveQuestions()
          Returns a list of PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects
 java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getActiveQuestions(java.lang.String orderBy, int direction)
          Returns a list of PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects
 java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getActiveQuestions(java.lang.String orderBy, int direction, java.util.List<java.lang.String> portletGroupIds)
          Returns a list of PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects
 java.util.List getChoices(java.lang.String questionId)
          Returns a List object containing string representations of the choices of a question, given a valid question id.
 int getChoiceVotes(java.lang.String questionId, java.lang.String choiceId)
          Returns the integer representation of the total vote count for a choice given a question id and a choice id.
 java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getInactiveQuestions()
          Returns a list of inactive PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects
 java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getInactiveQuestions(java.lang.String orderBy, int direction)
          Returns a list of inactive PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects
 com.liferay.portlet.polls.model.PollsQuestion getQuestion(java.lang.String questionId)
          Returns a PollQuestion object given a question id.
 int getTotalVotes(java.lang.String questionId)
          Returns the integer representation of the total vote count for a question given a question id.
 boolean hasExpired(java.lang.String questionId)
          Returns whether a question has expired or not.
 boolean hasVoted(java.lang.String questionId)
          Returns whether a vote has been casted on a question given a question id.
 boolean questionExists(java.lang.String questionId)
          Returns whether a question exists or not.
 void vote(java.lang.String voteUserId, java.lang.String questionId, java.lang.String choiceId)
          Performs a vote operation using Liferay API's given a valid user, question id an choice id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PollsAPILiferayImpl

public PollsAPILiferayImpl()
Method Detail

getActiveQuestions

public java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getActiveQuestions()
Returns a list of PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects

Specified by:
getActiveQuestions in interface PollsAPI
Returns:
List of PollsQuestion

getActiveQuestions

public java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getActiveQuestions(java.lang.String orderBy,
                                                                                        int direction)
Returns a list of PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects

Specified by:
getActiveQuestions in interface PollsAPI
Parameters:
orderBy - Permitted values createDate, expirationDate and questionId
direction - value -1 descending order and 1 to ascending order
Returns:
List of PollsQuestion

getActiveQuestions

public java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getActiveQuestions(java.lang.String orderBy,
                                                                                        int direction,
                                                                                        java.util.List<java.lang.String> portletGroupIds)
Returns a list of PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects

Specified by:
getActiveQuestions in interface PollsAPI
Parameters:
orderBy - Permitted values createDate, expirationDate and questionId
direction - value -1 descending order and 1 to ascending order
portletGroupIds - array list of group ids configured with the poll portlet
Returns:
List of PollsQuestion

getQuestion

public com.liferay.portlet.polls.model.PollsQuestion getQuestion(java.lang.String questionId)
Returns a PollQuestion object given a question id. The questionId argument must specify a valid question id.

This implementation uses the Liferay API's to obtain a PollQuestion object given a valid question id.

Specified by:
getQuestion in interface PollsAPI
Parameters:
questionId - a valid question id
Returns:
the PollQuestion

getChoices

public java.util.List getChoices(java.lang.String questionId)
Returns a List object containing string representations of the choices of a question, given a valid question id. The questionId argument must specify a valid question id.

This implementation uses the Liferay API's to obtain the list of choices.

Specified by:
getChoices in interface PollsAPI
Parameters:
questionId - a valid question id
Returns:
the List of choices

vote

public void vote(java.lang.String voteUserId,
                 java.lang.String questionId,
                 java.lang.String choiceId)
Performs a vote operation using Liferay API's given a valid user, question id an choice id.

Specified by:
vote in interface PollsAPI
Parameters:
voteUserId - a user id
questionId - a valid question id
choiceId - a valid choice id

getTotalVotes

public int getTotalVotes(java.lang.String questionId)
Returns the integer representation of the total vote count for a question given a question id.

Specified by:
getTotalVotes in interface PollsAPI
Parameters:
questionId - a valid question id
Returns:
the total vote count for a given question id.

getChoiceVotes

public int getChoiceVotes(java.lang.String questionId,
                          java.lang.String choiceId)
Returns the integer representation of the total vote count for a choice given a question id and a choice id.

Specified by:
getChoiceVotes in interface PollsAPI
Parameters:
questionId - a valid question id
choiceId - a valid choice id
Returns:
the total vote count for a given question id and choice id.

hasExpired

public boolean hasExpired(java.lang.String questionId)
Returns whether a question has expired or not.

Specified by:
hasExpired in interface PollsAPI
Parameters:
questionId - a valid question id
Returns:
if the question has expired.

questionExists

public boolean questionExists(java.lang.String questionId)
Returns whether a question exists or not.

Specified by:
questionExists in interface PollsAPI
Parameters:
questionId - a valid question id
Returns:
if the question exists.

hasVoted

public boolean hasVoted(java.lang.String questionId)
Returns whether a vote has been casted on a question given a question id.

Specified by:
hasVoted in interface PollsAPI
Parameters:
questionId - a valid question id
Returns:
if a vote has already been casted for the given question id.

getInactiveQuestions

public java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getInactiveQuestions()
Returns a list of inactive PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects

Specified by:
getInactiveQuestions in interface PollsAPI
Returns:
List of PollsQuestion

getInactiveQuestions

public java.util.List<com.liferay.portlet.polls.model.PollsQuestion> getInactiveQuestions(java.lang.String orderBy,
                                                                                          int direction)
Returns a list of inactive PollQuestion objects This implementation uses the Liferay API's to obtain the list of PollQuestion objects

Specified by:
getInactiveQuestions in interface PollsAPI
Parameters:
orderBy - Permitted values createDate, expirationDate and questionId
direction - value -1 descending order and 1 to ascending order
Returns:
List of PollsQuestion


Copyright © 2013 dotCMS Inc. All Rights Reserved.