org.exoplatform.poll.service
Class Utils

java.lang.Object
  extended by org.exoplatform.poll.service.Utils

public class Utils
extends Object


Field Summary
static String COLON
           
 
Constructor Summary
Utils()
           
 
Method Summary
static Poll calculateVote(Poll poll, String userId, String voteOptions)
          Calculate data of poll when user Voted.
static String getCurrentUserVote(Poll poll)
           
static Calendar getGreenwichMeanTime()
           
static String getInfoVote(Poll poll)
          Get a string from infoVote of poll
static String getUserVote(Poll poll, String userName)
          Convert userVote of poll to s string
static boolean isEmpty(String s)
           
static boolean isListEmpty(List<String> list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COLON

public static final String COLON
Constructor Detail

Utils

public Utils()
Method Detail

getGreenwichMeanTime

public static Calendar getGreenwichMeanTime()

isEmpty

public static boolean isEmpty(String s)

isListEmpty

public static boolean isListEmpty(List<String> list)

calculateVote

public static Poll calculateVote(Poll poll,
                                 String userId,
                                 String voteOptions)
                          throws Exception
Calculate data of poll when user Voted. Apply for all case (Single vote and multi vote)

Parameters:
poll - the poll after user vote.
userId - the user name voted.
voteOptions - the value user voted. - If is single vote, the value is one number. - If is multi vote, the value has format a:b:c, with a,b,c is number user selected.
Throws:
Exception - the exception

getInfoVote

public static String getInfoVote(Poll poll)
Get a string from infoVote of poll

Parameters:
poll -
Returns:

getUserVote

public static String getUserVote(Poll poll,
                                 String userName)
Convert userVote of poll to s string

Parameters:
poll -
userName -
Returns:

getCurrentUserVote

public static String getCurrentUserVote(Poll poll)


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.