Package org.encuestame.persistence.domain

Examples of org.encuestame.persistence.domain.Comment


         bean.setComment(filterValue(mycomment));
         bean.setCreatedAt(Calendar.getInstance().getTime());
         bean.setParentId(relatedCommentId);
         bean.setId(tweetPollId);
         bean.setType(typeResult);
         final Comment comment = getCommentService().createComment(bean);
         return ConvertDomainBean.convertCommentDomainToBean(comment);
    }
View Full Code Here


    /*
     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.ICommentService#getCommentbyId(java.lang.Long)
     */
    public Comment getCommentbyId(final Long commentId) throws EnMeNoResultsFoundException, HibernateException{
        Comment comment = getCommentsOperations().getCommentByIdandUser(
                commentId,  getUserAccount(getUserPrincipalUsername()));
        if (comment == null){
            throw new EnMeCommentNotFoundException("comment not found");
        }
        return comment;
View Full Code Here

    /*
     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.ICommentService#createComment(org.encuestame.utils.web.CommentBean)
     */
    public Comment createComment(final CommentBean commentBean) throws EnMeNoResultsFoundException, EnmeNotAllowedException{
        final Comment comment = new Comment();
        comment.setComment(commentBean.getComment());
        comment.setCreatedAt(commentBean.getCreatedAt());
        comment.setParentId(commentBean.getParentId());
        comment.setDislikeVote(0L);
        comment.setLikeVote(0L);
        comment.setUser(getUserAccount(getUserPrincipalUsername()));
        if (TypeSearchResult.TWEETPOLL.equals(commentBean.getType())) {
            final TweetPoll tweetPoll = getTweetPollById(commentBean.getId());
            comment.setTweetPoll(tweetPoll);
            comment.setCommentOptions(tweetPoll.getShowComments() == null ? CommentOptions.PUBLISHED : tweetPoll.getShowComments());
        } else if (TypeSearchResult.POLL.equals(commentBean.getType())) {
            final Poll poll = getPollById(commentBean.getId());
            comment.setPoll(poll);
            comment.setCommentOptions(poll.getShowComments()  == null ? CommentOptions.PUBLISHED : poll.getShowComments());
        } else if (TypeSearchResult.SURVEY.equals(commentBean.getType())) {
            //TODO: survey get imp
          //comment.setPoll(poll);
            //comment.setCommentOptions(poll.getShowComments());
        } else {
View Full Code Here

     * (non-Javadoc)
     * @see org.encuestame.core.service.imp.ICommentService#voteCommentSocialOption(java.lang.Long, org.encuestame.persistence.domain.CommentsSocialOptions)
     */
    public void voteCommentSocialOption(final Long commentId, final CommentsSocialOptions vote) throws EnMeNoResultsFoundException,
                                        HibernateException, EnmeFailOperation{
        final Comment comment = this.getCommentbyId(commentId);
        if (vote.equals(CommentsSocialOptions.LIKE_VOTE)) {
            this.CommentLikeVote(comment);
        } else if (vote.equals(CommentsSocialOptions.DISLIKE_VOTE)) {
            this.CommentDislikeVote(comment);
        } else {
View Full Code Here

                }
                log.debug("New tweetpoll "+tweetPollDomain.getTweetPollId());

                for (CommentBean commentBean2 : comments) {
                    log.debug("New COMMENT tweetpoll ");
                    final Comment comment = new Comment();
                    comment.setTweetPoll(tweetPollDomain);
                    comment.setCreatedAt(createRandomDate());
                    comment.setComment(commentBean2.getComment());
                    comment.setDislikeVote(Long.valueOf(getRandomNumberRange(EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.min.comments.unlikes"), EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.max.comments.unlikes"))));
                    comment.setLikeVote(Long.valueOf(getRandomNumberRange(EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.min.comments.likes"), EnMePlaceHolderConfigurer
                            .getIntegerProperty("demo.max.comments.likes"))));
                    comment.setUser(userAccount.get(Double.valueOf(getRandomNumberRange(0, totalUsers) - 1).intValue()));
                    getTweetPollDao().saveOrUpdate(comment);
                    log.debug("Saved COMMENT tweetpoll ");
                }

                log.debug("Add hashtag to tweetpoll ");
View Full Code Here

            final Survey survey,
            final Poll poll,
            final UserAccount user,
            final Long dislikeVote,
            final Date createdAt){
           final Comment comment = new Comment();
           comment.setComment(comm);
           comment.setCreatedAt(createdAt);
           comment.setLikeVote(likeVote);
           comment.setDislikeVote(dislikeVote);
           comment.setPoll(poll);
           comment.setParentId(null);
           comment.setSurvey(survey);
           comment.setTweetPoll(tpoll);
           comment.setUser(user);
           getCommentsOperations().saveOrUpdate(comment);
           return comment;
        }
View Full Code Here

            final String comment,
            final TweetPoll tpoll,
            final UserAccount userAcc,
            final CommentOptions commentOptions,
            final Date creationDate){
        final Comment tweetPollComment = this.createComment(comment, 0L, tpoll, null, null, userAcc, 0L , creationDate);
        tweetPollComment.setCommentOptions(commentOptions);
        getCommentsOperations().saveOrUpdate(tweetPollComment);
        return tweetPollComment;
    }
View Full Code Here

     * @return
     */
    public Comment createDefaultPollCommentWithStatus(final String comment,
            final Poll poll, final UserAccount userAcc,
            final CommentOptions commentOptions, final Date creationDate) {
        final Comment pollComment = this.createComment(comment, 0L, null, null,
                poll, userAcc, 0L, creationDate);
        pollComment.setCommentOptions(commentOptions);
        getCommentsOperations().saveOrUpdate(pollComment);
        return pollComment;
    }
View Full Code Here

     */
    public Comment createDefaultSurveyCommentWithStatus(final String comment,
            final Survey survey, final UserAccount userAcc,
            final CommentOptions commentOptions, final Date creationdate) {

        final Comment surveyComment = this.createComment(comment, 0L, null,
                survey, null, userAcc, 0L, creationdate);
        surveyComment.setCommentOptions(commentOptions);
        getCommentsOperations().saveOrUpdate(surveyComment);
        return surveyComment;
    }
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */
    @Test
    public void testGetCommentbyId() throws EnMeNoResultsFoundException, HibernateException{
        assertNotNull(this.comment);
        final Comment comment = getCommentsOperationsService().getCommentbyId(this.comment.getCommentId());
        assertEquals("Should be equals", this.comment.getCommentId(), comment.getCommentId());
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.Comment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.