Package org.jtalks.jcommune.model.entity

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


     *
     * @param post {@link org.jtalks.jcommune.model.entity.Post} the breadcrumbed post.
     * @return {@link Breadcrumb} the filled breadcrumb for the Post location.
     */
    private Breadcrumb preparePostBreadcrumb(Post post) {
        Topic topic = post.getTopic();
        return new Breadcrumb(
                topic.getId(),
                BreadcrumbLocation.TOPIC,
                topic.getTitle());
    }
View Full Code Here


        initMocks(this);

        Branch branch = new Branch("branch", "branch");
        branch.setId(BRANCH_ID);

        Topic topic = new Topic(user, "title");
        topic.setBranch(branch);
        topic.setId(TOPIC_ID);

        post = new Post(user, POST_CONTENT);
        post.setId(POST_ID);
        post.setTopic(topic);
        topic.getPosts().addAll(asList(post));

        when(postService.get(POST_ID)).thenReturn(post);
        when(topicFetchService.get(TOPIC_ID)).thenReturn(topic);
        when(breadcrumbBuilder.getForumBreadcrumb(topic)).thenReturn(new ArrayList<Breadcrumb>());
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public List<Section> getAllAvailableSections(long currentTopicId) {
        List<Section> result = new ArrayList<>();
        Topic topic = topicDao.get(currentTopicId);
        List<Section> sections = this.getDao().getAll();
        JCUser user = userService.getCurrentUser();
        for (Section section : sections) {
            List<Branch> branches = new ArrayList<>(section.getBranches());
            for (Branch branch : branches) {
                if (branch.equals(topic.getBranch())) {
                    branches.remove(branch);
                    break;
                }
            }
            if (getDao().getCountAvailableBranches(user, branches) > 0) {
View Full Code Here

    @BeforeMethod
    protected void setUp() {
        initMocks(this);
        locationService = new LocationService(userService, sessionRegistry);
        user = new JCUser("", "", "");
        topic = new Topic(user, "");
        topic.setUuid("uuid");
        list = new ArrayList<Object>();
        map = new ConcurrentHashMap<JCUser, String>();
    }
View Full Code Here

     * @throws NotFoundException if no object is found for id given
     */
    @RequestMapping("topics/{id}/subscribe")
    @ResponseBody
    public ModelAndView subscribeToTopic(@PathVariable Long id, @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header) throws NotFoundException {
        Topic topic = topicFetchService.get(id);
        subscriptionService.toggleTopicSubscription(topic);
        if (header.equals("NotAjax")) {
            //redirect to new page
            return new ModelAndView("redirect:/topics/" + id);
        } else {
View Full Code Here

     */
    @RequestMapping("topics/{id}/unsubscribe")
    @ResponseBody
    public ModelAndView unsubscribeFromTopic(@PathVariable Long id, @RequestHeader(value = "X-Requested-With", defaultValue = "NotAjax") String header
    ) throws NotFoundException {
        Topic topic = topicFetchService.get(id);
        subscriptionService.toggleTopicSubscription(topic);
        if (header.equals("NotAjax")) {
            //redirect to new page
            return new ModelAndView("redirect:/topics/" + id);
        } else {
View Full Code Here

        branch = new Branch("Branch Name", "Branch description");
        branch.setId(ID);
        section.addOrUpdateBranch(branch);
        branch.setSection(section);

        topic = new Topic(user, "Topic Name");
        topic.setId(ID);
        branch.addTopic(topic);

        post = new Post(user, "");
        topic.addPost(post);
View Full Code Here

     * @throws NotFoundException when branch was not found
     */
    @RequestMapping(value = "/reviews/new", method = RequestMethod.GET)
    public ModelAndView showNewCodeReviewPage(@RequestParam(BRANCH_ID) Long branchId) throws NotFoundException {
        Branch branch = branchService.get(branchId);
        Topic topic = new Topic();
        topic.setBranch(branch);
        TopicDto dto = new TopicDto(topic);
        return new ModelAndView(CODE_REVIEW_VIEW)
                .addObject(TOPIC_DTO, dto)
                .addObject(BRANCH_ID, branchId)
                .addObject(SUBMIT_URL, "/reviews/new?branchId=" + branchId)
View Full Code Here

                    .addObject(TOPIC_DTO, topicDto)
                    .addObject(BRANCH_ID, branchId)
                    .addObject(SUBMIT_URL, "/reviews/new?branchId=" + branchId)
                    .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getForumBreadcrumb(branch));
        }
        Topic topic = topicDto.getTopic();
        topic.setBranch(branch);
        Topic createdTopic = topicModificationService.createCodeReview(topic, topicDto.getBodyText());

        return new ModelAndView(REDIRECT_URL + createdTopic.getId());
    }
View Full Code Here

        mentionedUsers.markUsersAsAlreadyNotified(postDao);
    }

    private Post getPost(long id, String content) {
        Post post = new Post(null, content);
        post.setTopic(new Topic());
        post.setId(id);
        return post;
    }
View Full Code Here

TOP

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

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.