public class LikeServiceImpl extends DefaultComponent implements LikeService
LikeService
.Modifier and Type | Field and Description |
---|---|
static int |
DISLIKE_RATING |
static int |
LIKE_RATING |
Constructor and Description |
---|
LikeServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
cancel(String username,
DocumentModel doc)
Convenient method to cancel a like or dislike on a
DocumentModel . |
void |
cancel(String username,
String activityObject)
Cancel a like or dislike for the given
username . |
void |
dislike(String username,
DocumentModel doc)
Convenient method to dislike a
DocumentModel . |
void |
dislike(String username,
String activityObject)
Dislike the given
activityObject by the username . |
long |
getDislikesCount(DocumentModel doc)
Convenient method to returns the dislikes count for a
DocumentModel . |
long |
getDislikesCount(String activityObject)
Returns the dislikes count for the given
activityObject . |
long |
getLikesCount(DocumentModel doc)
Convenient method to returns the likes count for a
DocumentModel . |
long |
getLikesCount(String activityObject)
Returns the likes count for the given
activityObject . |
LikeStatus |
getLikeStatus(DocumentModel doc)
Convenient method to return the
LikeStatus for a DocumentModel . |
LikeStatus |
getLikeStatus(String activityObject)
Returns the
LikeStatus for the activityObject . |
LikeStatus |
getLikeStatus(String username,
DocumentModel doc)
|
LikeStatus |
getLikeStatus(String username,
String activityObject)
|
ActivitiesList |
getMostLikedActivities(CoreSession session,
int limit,
DocumentModel source)
An actitivitesList containing a documentActivity or a minimessageActivity as target, the likes count as object,
current user as actor and actor's likes in context.
|
ActivitiesList |
getMostLikedActivities(CoreSession session,
int limit,
DocumentModel source,
Date fromDt,
Date toDt)
An actitivitesList containing a documentActivity or a minimessageActivity as target, the likes count as object,
current user as actor and actor's likes in context the result will be between two dates
|
boolean |
hasUserDisliked(String username,
DocumentModel doc)
Returns
true if the given username already disliked the doc , false otherwise. |
boolean |
hasUserDisliked(String username,
String activityObject)
Returns
true if the given username already disliked the activityObject , false
otherwise. |
boolean |
hasUserLiked(String username,
DocumentModel doc)
Returns
true if the given username already liked the doc , false otherwise. |
boolean |
hasUserLiked(String username,
String activityObject)
Returns
true if the given username already liked the activityObject , false
otherwise. |
void |
like(String username,
DocumentModel doc)
Convenient method to like a
DocumentModel . |
void |
like(String username,
String activityObject)
Like the given
activityObject by the username . |
activate, applicationStarted, deactivate, getAdapter, getApplicationStartedOrder, getLastModified, registerContribution, registerExtension, setLastModified, unregisterContribution, unregisterExtension
public static final int LIKE_RATING
public static final int DISLIKE_RATING
public void like(String username, String activityObject)
LikeService
activityObject
by the username
.like
in interface LikeService
public void like(String username, DocumentModel doc)
LikeService
DocumentModel
.like
in interface LikeService
LikeService.like(String, String)
public boolean hasUserLiked(String username, String activityObject)
LikeService
true
if the given username
already liked the activityObject
, false
otherwise.hasUserLiked
in interface LikeService
public boolean hasUserLiked(String username, DocumentModel doc)
LikeService
true
if the given username
already liked the doc
, false
otherwise.hasUserLiked
in interface LikeService
public long getLikesCount(String activityObject)
LikeService
activityObject
.getLikesCount
in interface LikeService
public long getLikesCount(DocumentModel doc)
LikeService
DocumentModel
.getLikesCount
in interface LikeService
LikeService.getLikesCount(String)
public void dislike(String username, String activityObject)
LikeService
activityObject
by the username
.dislike
in interface LikeService
public void dislike(String username, DocumentModel doc)
LikeService
DocumentModel
.dislike
in interface LikeService
LikeService.dislike(String, String)
public boolean hasUserDisliked(String username, String activityObject)
LikeService
true
if the given username
already disliked the activityObject
, false
otherwise.hasUserDisliked
in interface LikeService
public boolean hasUserDisliked(String username, DocumentModel doc)
LikeService
true
if the given username
already disliked the doc
, false
otherwise.hasUserDisliked
in interface LikeService
public long getDislikesCount(String activityObject)
LikeService
activityObject
.getDislikesCount
in interface LikeService
public long getDislikesCount(DocumentModel doc)
LikeService
DocumentModel
.getDislikesCount
in interface LikeService
LikeService.getDislikesCount(String)
public void cancel(String username, String activityObject)
LikeService
username
.cancel
in interface LikeService
username
- the usernameactivityObject
- the activity object on which to cancel the like or dislike.public void cancel(String username, DocumentModel doc)
LikeService
DocumentModel
.cancel
in interface LikeService
LikeService.cancel(String, String)
public LikeStatus getLikeStatus(String activityObject)
LikeService
LikeStatus
for the activityObject
.getLikeStatus
in interface LikeService
public LikeStatus getLikeStatus(DocumentModel doc)
LikeService
LikeStatus
for a DocumentModel
.getLikeStatus
in interface LikeService
LikeService.getLikeStatus(String)
public LikeStatus getLikeStatus(String username, String activityObject)
LikeService
LikeStatus
for the username
and activityObject
.
The returned LikeStatus
will have the information about the like / dislike status of the username
.
getLikeStatus
in interface LikeService
public LikeStatus getLikeStatus(String username, DocumentModel doc)
LikeService
getLikeStatus
in interface LikeService
LikeService.getLikeStatus(String, String)
public ActivitiesList getMostLikedActivities(CoreSession session, int limit, DocumentModel source, Date fromDt, Date toDt)
LikeService
getMostLikedActivities
in interface LikeService
limit
- maximum documents returnedsource
- the parent document when child will be reachedpublic ActivitiesList getMostLikedActivities(CoreSession session, int limit, DocumentModel source)
LikeService
getMostLikedActivities
in interface LikeService
limit
- maximum documents returnedsource
- the parent document when child will be reachedCopyright © 2015 Nuxeo SA. All rights reserved.