Examples of CommentBean


Examples of com.lichtfragmente.beans.CommentBean

                                                           "WHERE c.imageid=? ORDER BY c.date DESC");
                stmt.setInt(1,imageid);
                ResultSet result=stmt.executeQuery();

                while (result.next()) {
                    CommentBean temp=new CommentBean();

                    temp.setContent(GlobalHelpers.nl2br(result.getString(1)));
                    temp.setDate(result.getTimestamp(2));
                    temp.getUserBean().setName(result.getString(3));
                    temp.setUserid(result.getInt(4));

                    list.add(temp);
                }

                result.close();
View Full Code Here

Examples of com.liusoft.dlog4j.beans.CommentBean

    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM DiaryReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        DiaryReplyBean rpl = (DiaryReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
        author.setEmail(rpl.getAuthorEmail());
        author.setName(rpl.getAuthor());
        author.setUrl(rpl.getAuthorURL());
        if(rpl.getUser()!=null){
          author.setId(rpl.getUser().getId());
        }
        cb.setAuthor(author);
        cb.setContent(rpl.getContent());
        cb.setCreateTime(rpl.getReplyTime());
        cb.setEid(rpl.getDiary().getId());
        cb.setEtype(DiaryReplyBean.TYPE_DIARY);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(StringUtils.abbreviate(rpl.getContent(), 20));
        ssn.save(cb);
        System.out.println("DiaryReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
      throw e;
View Full Code Here

Examples of com.liusoft.dlog4j.beans.CommentBean

    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM PhotoReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        PhotoReplyBean rpl = (PhotoReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
        author.setEmail(rpl.getAuthorEmail());
        author.setUrl(rpl.getAuthorURL());
        author.setName(rpl.getAuthor());
        if(rpl.getUser()!=null){
          author.setId(rpl.getUser().getId());
        }
        cb.setAuthor(author);
        cb.setContent(rpl.getContent());
        cb.setCreateTime(rpl.getReplyTime());
        cb.setEid(rpl.getPhoto().getId());
        cb.setEtype(DiaryReplyBean.TYPE_PHOTO);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(StringUtils.abbreviate(rpl.getContent(), 20));
        ssn.save(cb);
        System.out.println("PhotoReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
      throw e;
View Full Code Here

Examples of com.liusoft.dlog4j.beans.CommentBean

    try{
      HibernateUtils.beginTransaction();
      List rpls = ssn.createQuery("FROM TopicReplyBean AS r ORDER BY r.id").list();
      for(int i=0;i<rpls.size();i++){
        TopicReplyBean rpl = (TopicReplyBean)rpls.get(i);
        CommentBean cb = new CommentBean();
        cb.setClient(rpl.getClient());
        AuthorInfo author = new AuthorInfo();
        author.setEmail(rpl.getAuthorEmail());
        author.setName(rpl.getAuthor());
        author.setUrl(rpl.getAuthorURL());
        if(rpl.getUser()!=null){
          author.setName(rpl.getUser().getNickname());
          author.setId(rpl.getUser().getId());
        }
        else
          author.setName("����");
        cb.setAuthor(author);
        cb.setContent(rpl.getContent());
        cb.setCreateTime(rpl.getReplyTime());
        cb.setEid(rpl.getTopic().getId());
        cb.setEtype(DiaryReplyBean.TYPE_BBS);
        cb.setSite(rpl.getSite());
        cb.setStatus(rpl.getStatus());
        cb.setTitle(rpl.getTitle());
        ssn.save(cb);
        System.out.println("TopicReplyBean: " + rpl.getId() + " -> " + cb.getId());
      }
      HibernateUtils.commit();
    }catch(Exception e){
      HibernateUtils.rollback();
      throw e;
View Full Code Here

Examples of org.encuestame.utils.web.CommentBean

    private CommentBean createComment(
            final String mycomment,
            final Long tweetPollId,
            final String type,
            final Long relatedCommentId , boolean published) throws EnMeNoResultsFoundException, EnmeNotAllowedException {
        final CommentBean bean = new CommentBean();
         final TypeSearchResult typeResult = TypeSearchResult.getTypeSearchResult(filterValue(type));
         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

Examples of org.encuestame.utils.web.CommentBean

    /**
     * Test {@link CommentBean}.
     */
    @Test
    public void testCommentBean(){
        final CommentBean myCommentBean = new CommentBean();
        myCommentBean.setCommentId(1L);
        myCommentBean.setComment("My comment");
        myCommentBean.setCommentedBy("Jhonny");
        myCommentBean.setCommentedByUsername("jhonny");
        myCommentBean.setCreatedAt(new Date());
        myCommentBean.setDislikeVote(10L);
        myCommentBean.setLikeVote(50L);
        myCommentBean.setParentId(0L);
        myCommentBean.setType(TypeSearchResult.TWEETPOLL);
        myCommentBean.setUserAccountId(1L);
        assertNotNull(myCommentBean);
        assertNotNull(myCommentBean.getCommentId());
        assertNotNull(myCommentBean.getComment());
        assertNotNull(myCommentBean.getCommentedBy());
        assertNotNull(myCommentBean.getCommentedByUsername());
        assertNotNull(myCommentBean.getCreatedAt());
        assertNotNull(myCommentBean.getDislikeVote());
        assertNotNull(myCommentBean.getLikeVote());
        assertNotNull(myCommentBean.getParentId());
        assertNotNull(myCommentBean.getType());
        assertNotNull(myCommentBean.getUserAccountId());
    }
View Full Code Here

Examples of org.encuestame.utils.web.CommentBean

    private List<CommentBean> getComments() throws IOException {
        CSVReader csv = readCSVFile("comments.csv");
        String[] nextLine;
        final List<CommentBean> list = new ArrayList<CommentBean>();
        while ((nextLine = csv.readNext()) != null) {
            final CommentBean bean = new CommentBean();
            bean.setComment(nextLine[0]);
            list.add(bean);
        }
        return list;
    }
View Full Code Here

Examples of org.encuestame.utils.web.CommentBean

     * @throws EnMeNoResultsFoundException
     * @throws EnmeNotAllowedException
     */
    @Test
    public void testCreateComment() throws EnMeNoResultsFoundException, EnmeNotAllowedException{
        final CommentBean commentBean = createCommentBean("totally Agree", new Date(),
                getSpringSecurityLoggedUserAccount().getUid(), this.tweetPoll.getTweetPollId(), null);
        final Comment comment = getCommentsOperationsService().createComment(commentBean);
        assertNotNull(comment);
    }
View Full Code Here

Examples of org.encuestame.utils.web.CommentBean

     * @param commentDomain
     * @return
     */
    public static final CommentBean convertCommentDomainToBean(
            final Comment commentDomain) {
        final CommentBean commentBean = new CommentBean();
        Assert.assertNotNull(commentDomain);
        commentBean.setCommentId(commentDomain.getCommentId());
        commentBean.setComment(commentDomain.getComment());
        commentBean.setCreatedAt(commentDomain.getCreatedAt());
        commentBean
                .setDislikeVote(commentDomain.getDislikeVote() == null ? EnMeUtils.VOTE_MIN
                        : commentDomain.getDislikeVote());
        commentBean
                .setLikeVote(commentDomain.getLikeVote() == null ? EnMeUtils.VOTE_MIN
                        : commentDomain.getLikeVote());
        long id = 0;
        boolean set = false;
        String slug = "";
        /*
         * is possible refactor this part? ..
         */
        TypeSearchResult type = null;
        if (commentDomain.getPoll() != null && !set) {
            type = TypeSearchResult.POLL;
            id = commentDomain.getPoll().getPollId();
            commentBean.setType(TypeSearchResult.POLL);
            set = true;
            slug = commentDomain.getPoll().getQuestion().getSlugQuestion();
        }
        if (commentDomain.getTweetPoll() != null && !set) {
            type = TypeSearchResult.TWEETPOLL;
            id = commentDomain.getTweetPoll().getTweetPollId();
            commentBean.setType(TypeSearchResult.TWEETPOLL);
            set = true;
            slug = commentDomain.getTweetPoll().getQuestion().getSlugQuestion();
        }
        if (commentDomain.getSurvey() != null && !set) {
            type = TypeSearchResult.SURVEY;
            id = commentDomain.getSurvey().getSid();
            commentBean.setType(TypeSearchResult.SURVEY);
            set = true;
            // slug =
            // commentDomain.getTweetPoll().getQuestion().getSlugQuestion();
        }
        commentBean.setId(id);
        commentBean.setParentId(commentDomain.getParentId() == null ? null
                : commentDomain.getParentId());
        commentBean.setUserAccountId(commentDomain.getUser() == null ? null
                : commentDomain.getUser().getUid());
        commentBean.setCommentedBy(commentDomain.getUser().getCompleteName());
        commentBean.setCommentedByUsername(commentDomain.getUser()
                .getUsername());
        commentBean.setStatus(commentDomain.getCommentOptions());
        // url
        // tweetpoll/4/do-you-like-summer-season%3F
        if (type != null) {
            final StringBuffer url = new StringBuffer("/");
            url.append(TypeSearchResult.getUrlPrefix(type));
            url.append("/");
            url.append(id);
            url.append("/");
            url.append(slug);
            url.append("/#comment");
            url.append(commentDomain.getCommentId());
            commentBean.setCommentUrl(url.toString());
        }
        return commentBean;
    }
View Full Code Here

Examples of org.encuestame.utils.web.CommentBean

      * @param pollId
      * @return
      */
     public CommentBean createCommentBean(final String comment,
             final Date createdAt, final Long userId, final Long tweetPollId, final Long pollId){
         final CommentBean commentBean = new CommentBean();
         commentBean.setComment(comment);
         commentBean.setCreatedAt(createdAt);
         commentBean.setUserAccountId(userId);
         commentBean.setId(tweetPollId);
         commentBean.setType(TypeSearchResult.TWEETPOLL);
         return commentBean;
     }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.