Package org.focusns.model.blog

Examples of org.focusns.model.blog.BlogCategory


    }

    @RequestMapping("category-view")
    public String doView(@WidgetPref Long categoryId, @WidgetPref Integer limit, Model model) {
        //
        BlogCategory articleCategory = blogCategoryService.getBlogCategory(categoryId);
        //
        Page<BlogPost> page = new Page<BlogPost>(limit);
        page = blogPostService.fetchPageByCategoryId(page, -1, categoryId);
        //
        model.addAttribute("articleCategory", articleCategory);
View Full Code Here


        //
        Long projectId = project.getId();
        List<BlogCategory> blogCategories = blogCategoryService.getBlogCategories(projectId);
        model.addAttribute("blogCategories", blogCategories);
        //
        BlogCategory blogCategory = new BlogCategory();
        if (categoryId == null) {
            blogCategory.setProjectId(projectId);
            blogCategory.setCreatedById(projectUser.getId());
        } else {
            blogCategory = blogCategoryService.getBlogCategory(categoryId);
        }
        model.addAttribute("blogCategory", blogCategory);
        //
View Full Code Here

    @RequestMapping("/article-list")
    public String doList(@RequestParam(required = false) Long categoryId, Model model) {
        //
        List<BlogCategory> articleCategories = blogCategoryService.getBlogCategories();
        if (!articleCategories.isEmpty()) {
            BlogCategory articleCategory = articleCategories.get(0);
            if (categoryId != null) {
                for (BlogCategory tmp : articleCategories) {
                    if (categoryId.longValue() == tmp.getId()) {
                        articleCategory = tmp;
                    }
                }
            }
            //
            Page<BlogPost> page = new Page<BlogPost>(10);
            page = blogPostService.fetchPageByCategoryId(page, 0, articleCategory.getId());
            //
            model.addAttribute("articleCategories", articleCategories);
            model.addAttribute("articleCategory", articleCategory);
            model.addAttribute("page", page);
        }
View Full Code Here

        }
    }

    @RequestMapping("/category-remove")
    public void doRemove(@RequestParam Long id) {
        BlogCategory blogCategory = blogCategoryService.getBlogCategory(id);
        blogCategoryService.removeBlogCategory(blogCategory);
        Navigator.get().withAttribute("blogCategory", blogCategory).navigateTo("category-removed");
    }
View Full Code Here

    }

    @RequestMapping("/category-edit")
    public String doEdit(@RequestParam(required = false) Long categoryId, @WidgetAttribute ProjectUser user, Model model) {
        //
        BlogCategory articleCategory = new BlogCategory();
        articleCategory.setCreatedById(user.getId());
        if (categoryId != null) {
            articleCategory = blogCategoryService.getBlogCategory(categoryId);
        }
        model.addAttribute("articleCategory", articleCategory);
        //
View Full Code Here

    @Test
    public void testCreateBlogCategory() {
        Project project = projectService.getProject("admin");
        Assert.assertNotNull(project);
        //
        BlogCategory blogCategory = new BlogCategory(project.getId(), "Test");
        blogCategory.setCreatedAt(new Date());
        blogCategory.setCreatedById(1);

        blogCategoryService.createBlogCategory(blogCategory);
    }
View Full Code Here

        }
    }

    @Test
    public void testCreateBlogCategoryNoProject() {
        BlogCategory blogCategory = new BlogCategory();
        blogCategory.setCreatedById(1);
        blogCategory.setCreatedAt(new Date());
        blogCategory.setLabel("News");
        blogCategoryService.createBlogCategory(blogCategory);

    }
View Full Code Here

    @Test
    public void testCreateBlogPost() {
        Project project = projectService.getProject("focusns");
        Assert.assertNotNull(project);
        //
        BlogCategory blogTag = new BlogCategory();
        blogTag.setLabel("未分类");
        blogTag.setProjectId(project.getId());
        //
        tagService.createBlogCategory(blogTag);
        //
        ProjectUser user = projectUserService.getProjectUser("admin");
        Assert.assertNotNull(user);
        //
        Date now = new Date();
        BlogPost blogPost = new BlogPost();
        blogPost.setTitle("Blog Title");
        blogPost.setContent("Blog Content");
        blogPost.setCreatedAt(now);
        blogPost.setModifiedAt(now);
        blogPost.setCategoryId(blogTag.getId());
        blogPost.setCreatedById(user.getId());
        //
        postService.createBlogPost(blogPost);
    }
View Full Code Here

    @Autowired
    private BlogCategoryDao categoryDao;

    @Override
    public BlogCategory getBlogCategory(long categoryId) {
        BlogCategory category = categoryDao.select(categoryId);
        return fillBlogCategory(category);
    }
View Full Code Here

        this.projectUserDao = projectUserDao;
    }

    @Event(on = "CREATE_BLOG_CATEGORY", point = Event.Point.AFTER)
    public void afterCreateBlogCategory(EventContext eventContext) {
        BlogCategory blogCategory = (BlogCategory) eventContext.getArguments()[0];

    }
View Full Code Here

TOP

Related Classes of org.focusns.model.blog.BlogCategory

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.