public class VoteManager extends BasicDBListener implements DBConstants, VoteConstants, JPropertiesListener
Modifier and Type | Class and Description |
---|---|
class |
VoteManager.CacheEntry |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REVISION |
ALL_CATEGORIES_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, DBDATA_URID, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_HASNOREADRIGHTS, HIBERNATE_MAPPING_MAJORVERSION, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_MINORVERSION, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_READERCOUNT, HIBERNATE_MAPPING_ROLEMAPSTR, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_TRACKED, HIBERNATE_MAPPING_UDATE, HIBERNATE_MAPPING_VOTECOUNT, HIBERNATE_MAPPING_VOTESCORE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MAX_HIBERNATE_MAPPING_PUBLICATION, MDATE_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELD
ALERT_DOMAIN, ALERT_NAME_NEGATIVE_VOTE, ALERT_NAME_POSITIVE_VOTE, ANONYMIZE_DOWNVOTE_PROP, ANONYMIZE_VOTE_PROP, CACHE_SIZE_PROP, DEFAULT_VOTE_TEMPLATE_PROP, DEFAULT_VOTELIST_TEMPLATE_PROP, ICON_VOTE_NEGATIVE_HL_PROP, ICON_VOTE_NEGATIVE_PROP, ICON_VOTE_POSITIVE_HL_PROP, ICON_VOTE_POSITIVE_PROP, PUBLICATION_ID_FIELD, RATING_FIELD, SEND_VOTE_NOTIFICATION_PROP, UI_VOTE_NEGATIVE, UI_VOTE_NEGATIVE_HL, UI_VOTE_POSITIVE, UI_VOTE_POSITIVE_HL, UNVOTABLE_TYPES_PROP, VOTE_DEFAULT_VALUE_PROP, VOTE_ENABLED_PROP, VOTE_TAG_USAGE_ACTION, VOTE_TAG_USAGE_VOTELIST
Modifier and Type | Method and Description |
---|---|
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,
java.util.Map context,
int rating)
Creates a vote and returns it
|
java.lang.String |
getDefaultNegativeVoteHighlightIcon() |
java.lang.String |
getDefaultNegativeVoteIcon() |
java.lang.String |
getDefaultPositiveVoteHighlightIcon() |
java.lang.String |
getDefaultPositiveVoteIcon() |
java.lang.String |
getDefaultVoteListTemplateJsp() |
java.lang.String |
getDefaultVoteTemplateJsp() |
static VoteManager |
getInstance() |
java.lang.String |
getJcmsId(java.lang.String sentence)
Returns the jcmsId from a given sentence for the ttCard "ttLike"
|
java.util.List<Vote> |
getNegativeVoteList(Publication pub)
Return the positive vote List for given Publication
|
java.util.List<Vote> |
getPositiveVoteList(Publication pub)
Return the positive vote List for given Publication
|
java.util.Set<Member> |
getPublicationVoteAllMemberSet(Publication pub)
Returns the Set of all Members who have voted on given Publication
|
java.util.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) |
java.lang.String |
getVoteIcon(int iconType) |
java.util.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(java.lang.String pubId)
Invalidate the count of comment on the given publication.
|
boolean |
isDownVoteAnonymized() |
boolean |
isPointMode() |
boolean |
isSendVoteNotification() |
boolean |
isUnvotableType(java.lang.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) |
java.lang.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(java.lang.String pubId)
Recompute the count of comment on the given publication.
|
void |
updateVoteMapValue(java.lang.String pubId,
VoteManager.CacheEntry cacheEntry)
Update values for a given Publication id in the cache vote map
|
getAdateFromState, getAuthorIdFromState, getCdateFromState, getDateFromState, getEdateFromState, getMdateFromState, getPdateFromState, getPrePstatus, getPrePstatus, getPstatusFromState, hasNoChange, hasNoChange, init, onPreUpdate
public static final java.lang.String REVISION
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 java.util.List<Vote> getPositiveVoteList(Publication pub)
pub
- the Publicationpublic java.util.List<Vote> getNegativeVoteList(Publication pub)
pub
- the Publicationpublic java.util.List<Vote> getVoteList(Publication pub)
pub
- the Publicationpublic java.util.Set<Member> getPublicationVoteAllMemberSet(Publication pub)
pub
- the Publicationpublic java.util.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 votepublic boolean isVotable(Publication pub)
pub
- the Publicationpublic boolean isUnvotableType(java.lang.Class clazz)
clazz
- the class to checkpublic boolean isVoteEnabled()
public boolean isPointMode()
public boolean isVoteAnonymized()
public boolean isDownVoteAnonymized()
public boolean isSendVoteNotification()
public boolean canVote(Publication pub, Member mbr)
pub
- the Publicationmbr
- the Memberpublic java.lang.Object[] performVote(Publication pub, Member mbr, boolean positiveVote)
pub
- the voted Publication
mbr
- the voter Member
positiveVote
- set true if positive votepublic Publication cancelVote(Publication pub, Member mbr)
pub
- the publicationmbr
- the Memberpublic Vote getVote(Publication pub, Member mbr)
pub
- the Publicationmbr
- the Memberpublic Vote createVote(Publication pub, Member mbr, java.util.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 Memberpublic int[] getVoteCountFromVoteTable(Publication pub)
pub
- the Publicationpublic int getVoteCount(Publication pub)
pub
- the publicationpublic int getVoteScore(Publication pub)
pub
- the Publicationpublic boolean hasVote(Publication pub)
pub
- the publicationpublic void invalidateVoteCountMap(java.lang.String pubId)
pubId
- the id of the publicationpublic void updateVoteMap(java.lang.String pubId)
pubId
- the id of the publicationpublic void updateVoteMapValue(java.lang.String pubId, VoteManager.CacheEntry cacheEntry)
pubId
- the Publication idcacheEntry
- the VoteManager.CacheEntry
to updatepublic void recomputePublicationVote(Publication pub)
pub
- the Publicationpublic java.lang.String getDefaultVoteTemplateJsp()
public java.lang.String getDefaultVoteListTemplateJsp()
public void notifyAuthor(Vote vote)
vote
- the Vote
public java.lang.String getVoteIcon(int iconType)
iconType
- the type of the iconpublic java.lang.String getDefaultPositiveVoteIcon()
public java.lang.String getDefaultPositiveVoteHighlightIcon()
public java.lang.String getDefaultNegativeVoteIcon()
public java.lang.String getDefaultNegativeVoteHighlightIcon()
public java.lang.String getJcmsId(java.lang.String sentence)
sentence
- the String returned in context by the ttCard mechanismpublic 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)
Copyright © 2001-2010 Jalios SA. All Rights Reserved.