*/
@Override
public Serializable execute(final TaskHandlerActionContext<PrincipalActionContext> inActionContext)
throws ExecutionException
{
SetActivityLikeRequest request = (SetActivityLikeRequest) inActionContext.getActionContext().getParams();
final Long userId = inActionContext.getActionContext().getPrincipal().getId();
LikedActivity likeActivityData = new LikedActivity(userId, request.getActivityId());
if (request.getLikeActionType() == LikeActionType.ADD_LIKE)
{
insertLikedActivity.execute(likeActivityData);
inActionContext.getUserActionRequests().add(
new UserActionRequest("loadLikedActivityIdsByUserId", null, userId));
CreateNotificationsRequest notificationRequest = new ActivityNotificationsRequest(RequestType.LIKE,
userId, 0L, request.getActivityId());
inActionContext.getUserActionRequests().add(
new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, notificationRequest));
}
else
{
deleteLikedActivity.execute(likeActivityData);
}
indexEntity.execute(activityEntityMapper.execute(new FindByIdRequest("Activity", request.getActivityId())));
return Boolean.TRUE;
}