/** * Method getLikeCommentByUserComment. * * @param userId int * @param commentId int * @return LikeComment * @see es.udc.fi.dc.photoalbum.spring.LikeService#getLikeCommentByUserComment(int, int) */ @Override public LikeComment getLikeCommentByUserComment(int userId, int commentId) { for (LikeComment aux : likeCommentDao.getLikeCommentByComment(commentId)) { if (aux.getLike().getUser().getId() == userId) { return aux; } } return null; }
/** * Method getLikesComment. * * @param commentId int * @param megusta int * @return List<LikeComment> * @see es.udc.fi.dc.photoalbum.spring.LikeService#getLikesComment(int, int) */ @Override public List<LikeComment> getLikesComment(int commentId, int megusta) { List<LikeComment> likecomments = likeCommentDao.getLikeCommentByComment(commentId); List<LikeComment> likes = new ArrayList<LikeComment>(); for (LikeComment lc : likecomments) { if (lc.getLike().getMegusta() == megusta) { likes.add(lc); } } return likes; }
/** * Method delete. * * @param like LikeComment * @see es.udc.fi.dc.photoalbum.spring.LikeService#delete(LikeComment) */ @Override public void delete(LikeComment like) { Likefield l = like.getLike(); likeCommentDao.delete(like); likeDao.delete(l); }
/** * Method getLikeCommentByCommentId. * * @param commentId int * @return List<LikeComment> * @see es.udc.fi.dc.photoalbum.spring.LikeService#getLikeCommentByCommentId(int) */ @Override public List<LikeComment> getLikeCommentByCommentId(int commentId) { return likeCommentDao.getLikeCommentByComment(commentId); }
/** * Method create. * * @param likeComment LikeComment * @see es.udc.fi.dc.photoalbum.spring.LikeService#create(LikeComment) */ @Override public void create(LikeComment likeComment) { likeDao.create(likeComment.getLike()); likeCommentDao.create(likeComment); }