|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jalios.jcms.db.BasicDBListener
com.jalios.jcms.vote.VoteManager
public class VoteManager
This class gives Utils to handle vote
Nested Class Summary | |
---|---|
class |
VoteManager.CacheEntry
|
Field Summary | |
---|---|
static String |
REVISION
|
Method Summary | |
---|---|
Publication |
cancelVote(Publication pub,
Member mbr)
Cancel the vote bound on a Publication and a Member |
boolean |
canVote(Publication pub,
Member mbr)
Return true if given Member can Vote on given Publication |
Vote |
createVote(Publication pub,
Member mbr,
Map context,
int rating)
Creates a vote and returns it |
String |
getDefaultNegativeVoteHighlightIcon()
|
String |
getDefaultNegativeVoteIcon()
|
String |
getDefaultPositiveVoteHighlightIcon()
|
String |
getDefaultPositiveVoteIcon()
|
String |
getDefaultVoteListTemplateJsp()
|
String |
getDefaultVoteTemplateJsp()
|
static VoteManager |
getInstance()
|
String |
getJcmsId(String sentence)
Returns the jcmsId from a given sentence for the ttCard "ttLike" |
List<Vote> |
getPositiveVoteList(Publication pub)
Return the positive vote List for given Publication |
Set<Member> |
getPublicationVoteAllMemberSet(Publication pub)
Returns the Set of all Members who have voted on given Publication |
Set<Member> |
getPublicationVoteMemberSet(Publication pub,
boolean positive)
Return the Set |
Vote |
getVote(Publication pub,
Member mbr)
Return a Vote bound on given Publication and given Member |
int |
getVoteCount(Publication pub)
Returns the count of vote on the given publication |
int[] |
getVoteCountFromVoteTable(Publication pub)
|
String |
getVoteIcon(int iconType)
|
List<Vote> |
getVoteList(Publication pub)
Return the vote List for given Publication |
int |
getVoteScore(Publication pub)
Return the voteScore of given Publication and update the voteCountMap if not in map |
boolean |
hasVote(Publication pub)
Returns true if the given publication has been voted. |
boolean |
hasVoted(Publication pub,
Member mbr)
Returns true if given Member has already voted for given Publication |
void |
invalidateVoteCountMap(String pubId)
Invalidate the count of comment on the given publication. |
boolean |
isDownVoteAnonymized()
|
boolean |
isSendVoteNotification()
|
boolean |
isUnvotableType(Class clazz)
Returns true if the given class is unvotable |
boolean |
isVotable(Publication pub)
|
boolean |
isVoteAnonymized()
|
boolean |
isVoteEnabled()
|
void |
notifyAuthor(Vote vote)
Notifies the Publication's author that he has received a new vote |
void |
onPostDelete(DBData data,
org.hibernate.event.PostDeleteEvent event,
boolean firstTime)
|
void |
onPostInsert(DBData data,
org.hibernate.event.PostInsertEvent event,
boolean firstTime)
|
void |
onPostUpdate(DBData data,
org.hibernate.event.PostUpdateEvent event,
boolean firstTime)
|
Object[] |
performVote(Publication pub,
Member mbr,
boolean positiveVote)
|
void |
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk. |
void |
recomputePublicationVote(Publication pub)
Recompute the Publication voteCount & voteScore by querying all its votes |
void |
updateVoteMap(String pubId)
Recompute the count of comment on the given publication. |
void |
updateVoteMapValue(String pubId,
VoteManager.CacheEntry cacheEntry)
Update values for a given Publication id in the cache vote map |
Methods inherited from class com.jalios.jcms.db.BasicDBListener |
---|
getAdateFromState, getAuthorIdFromState, getCdateFromState, getEdateFromState, getMdateFromState, getPdateFromState, getPrePstatus, getPrePstatus, getPstatusFromState, hasNoChange, hasNoChange, init, onPreUpdate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Method Detail |
---|
public static VoteManager getInstance()
public void propertiesChange(JProperties properties)
JPropertiesListener
You cannot alter the value received in parameters.
propertiesChange
in interface JPropertiesListener
properties
- the properties which have been modified (may not contain all JCMS properties)public List<Vote> getPositiveVoteList(Publication pub)
pub
- the Publication
public List<Vote> getVoteList(Publication pub)
pub
- the Publication
public Set<Member> getPublicationVoteAllMemberSet(Publication pub)
pub
- the Publication
public Set<Member> getPublicationVoteMemberSet(Publication pub, boolean positive)
pub
- the Publicationpositive
- , if true, returns only members who has made a positive vote. If false, it returns only members who made a negative vote
public boolean isVotable(Publication pub)
pub
- the Publication
public boolean isUnvotableType(Class clazz)
clazz
- the class to check
public boolean isVoteEnabled()
public boolean isVoteAnonymized()
public boolean isDownVoteAnonymized()
public boolean isSendVoteNotification()
public boolean canVote(Publication pub, Member mbr)
pub
- the Publicationmbr
- the Member
public Object[] performVote(Publication pub, Member mbr, boolean positiveVote)
pub
- the voted Publication
mbr
- the voter Member
public Publication cancelVote(Publication pub, Member mbr)
mbr
- the Memberpublic Vote getVote(Publication pub, Member mbr)
pub
- the Publicationmbr
- the Member
public Vote createVote(Publication pub, Member mbr, Map context, int rating)
pub
- the Publicationmbr
- the Membercontext
- the context Maprating
- of the vote (pts)
public boolean hasVoted(Publication pub, Member mbr)
pub
- the Publicationmbr
- the Member
public int[] getVoteCountFromVoteTable(Publication pub)
pub
- the Publication
public int getVoteCount(Publication pub)
pub
- the publication
public int getVoteScore(Publication pub)
pub
- the Publication
public boolean hasVote(Publication pub)
pub
- the publication
public void invalidateVoteCountMap(String pubId)
pubId
- the id of the publicationpublic void updateVoteMap(String pubId)
pubId
- the id of the publicationpublic void updateVoteMapValue(String pubId, VoteManager.CacheEntry cacheEntry)
pubId
- the Publication idcacheEntry
- the VoteManager.CacheEntry
to updatepublic void recomputePublicationVote(Publication pub)
pub
- the Publicationpublic String getDefaultVoteTemplateJsp()
public String getDefaultVoteListTemplateJsp()
public void notifyAuthor(Vote vote)
vote
- the Vote
public String getVoteIcon(int iconType)
iconType
- the type of the icon
public String getDefaultPositiveVoteIcon()
public String getDefaultPositiveVoteHighlightIcon()
public String getDefaultNegativeVoteIcon()
public String getDefaultNegativeVoteHighlightIcon()
public String getJcmsId(String sentence)
sentence
- the String returned in context by the ttCard mechanism
public void onPostInsert(DBData data, org.hibernate.event.PostInsertEvent event, boolean firstTime)
onPostInsert
in interface DBListener
onPostInsert
in class BasicDBListener
DBListener.onPostInsert(DBData, PostInsertEvent, boolean)
public void onPostUpdate(DBData data, org.hibernate.event.PostUpdateEvent event, boolean firstTime)
onPostUpdate
in interface DBListener
onPostUpdate
in class BasicDBListener
DBListener.onPostUpdate(DBData, PostUpdateEvent, boolean)
public void onPostDelete(DBData data, org.hibernate.event.PostDeleteEvent event, boolean firstTime)
onPostDelete
in interface DBListener
onPostDelete
in class BasicDBListener
DBListener.onPostDelete(DBData, PostDeleteEvent, boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |