Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.Post


        JCUser user = new JCUser("user1", "mymail@email.mydomain", "qwerty");
        JCUser user2 = new JCUser("user2", "mymail2@email.mydomain", "qwerty");
        Topic topic = new Topic(user, "my topic");

        Post post = new Post(user, "Texty text!");
        post.setId(1);
        Post post2 = new Post(user2, "Reply to texty text");
        post2.setId(3);
        topic.addPost(post);
        topic.addPost(post2);

        model.put("posts", Arrays.asList(post, post2));

        MockHttpServletResponse response = new MockHttpServletResponse();

        List<Item> result = postListRssViewer.buildFeedItems(model, getMockRequest(), response);

        assertEquals(result.get(0).getPubDate(), post.getCreationDate().toDate());
        assertEquals(result.get(1).getPubDate(), post2.getCreationDate().toDate());
    }
View Full Code Here


    /**
     * {@inheritDoc}
     */
    @Override
    public void refreshLastPostInBranch(Branch branch) {
        Post lastPostOfBranch = postDao.getLastPostFor(branch);
        branch.setLastPost(lastPostOfBranch);
        branchDao.saveOrUpdate(branch);
    }
View Full Code Here

                    .addObject(POST_DTO, postDto)
                    .addObject("subscribed", topic.getSubscribers().contains(currentUser))
                    .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getForumBreadcrumb(topic));
        }

        Post newbie = replyToTopicWithLockHandling(postDto, topicId);
        lastReadPostService.markTopicAsRead(newbie.getTopic());
        return new ModelAndView(this.redirectToPageWithPost(newbie.getId()));
    }
View Full Code Here

     * @return redirect view to the certain topic page
     * @throws NotFoundException is the is no post for the identifier given
     */
    @RequestMapping(method = RequestMethod.GET, value = "/posts/{postId}")
    public String redirectToPageWithPost(@PathVariable Long postId) throws NotFoundException {
        Post post = postService.get(postId);
        int page = postService.calculatePageForPost(post);
        return new StringBuilder("redirect:/topics/")
                .append(post.getTopic().getId())
                .append("?page=")
                .append(page)
                .append("#")
                .append(postId)
                .toString();
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.Post

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.