Package org.focusns.model.core

Examples of org.focusns.model.core.Project


    public Project getProject(long id) {
        return projectDao.select(id);
    }

    public Project getProject(String code) {
        Project project = projectDao.selectByCode(code);
        //
        return fillProject(project);
    }
View Full Code Here


    @Autowired
    private BlogCategoryService blogCategoryService;

    @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

        blogCategoryService.createBlogCategory(blogCategory);
    }

    @Test
    public void testRemoveBlogCategory() {
        Project project = projectService.getProject("admin");
        Assert.assertNotNull(project);
        //
        List<BlogCategory> blogCategories = blogCategoryService.getBlogCategories(project.getId());
        for (BlogCategory blogCategory : blogCategories) {
            blogCategoryService.removeBlogCategory(blogCategory);
        }
    }
View Full Code Here

    @Autowired
    private BlogPostService postService;

    @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);
View Full Code Here

        postService.createBlogPost(blogPost);
    }

    @Test
    public void testRemoveBlogPost() {
        Project project = projectService.getProject("focusns");
        Assert.assertNotNull(project);
        //
        Page<BlogPost> page = new Page<BlogPost>(10);
        page = postService.fetchPageByProjectId(page, project.getId());
        for (BlogPost post : page.getResults()) {
            postService.removeBlogPost(post);
        }
    }
View Full Code Here

        ProjectCategory category = categoryDao.selectByCode("People");
        Assert.assertNotNull(category);
        //
        Date now = new Date();
        //
        Project project = new Project();
        project.setCode("gavin");
        project.setTitle("Gavin Hu");
        project.setDescription("This is the gavin's project!");
        project.setCreatedAt(now);
        project.setModifiedAt(now);
        project.setCategory(category);
        //
        int count = projectDao.insert(project);
        Assert.assertEquals(1, count);
    }
View Full Code Here

        user.setPassword("123456");
        user.setEmail("haozhonghu@hotmail.com");
        projectUserDao.insert(user);
        //
        Date now = new Date();
        Project project = new Project();
        project.setCode("gavin");
        project.setTitle("Gavin Hu");
        project.setDescription("This is gavin's profile!");
        //
        project.setCreatedAt(now);
        project.setModifiedAt(now);
        project.setCreatedById(user.getId());
        project.setModifiedById(user.getId());
        project.setCategoryId(category.getId());
        //
        projectService.createProject(project);
    }
View Full Code Here

        Assert.assertEquals(1, count);
    }

    @Test
    public void testSelectByCode() {
        Project project = projectDao.selectByCode("gavin");
        Assert.assertEquals("Gavin Hu", project.getTitle());
    }
View Full Code Here

        Assert.assertEquals("Gavin Hu", project.getTitle());
    }

    @Test
    public void testUpdate() {
        Project project = projectDao.selectByCode("gavin");
        project.setTitle("Aimy Wang");
        int count = projectDao.update(project);
        Assert.assertEquals(1, count);
        //
        project = projectDao.selectByCode("gavin");
        Assert.assertEquals("Aimy Wang", project.getTitle());
    }
View Full Code Here

    private ProjectLink fillProjectLink(ProjectLink projectLink) {
        if (projectLink == null) {
            return projectLink;
        }
        if (projectLink.getFromProject() == null && projectLink.getFromProjectId() > 0) {
            Project fromProject = projectDao.select(projectLink.getFromProjectId());
            projectLink.setFromProject(fromProject);
        }
        if (projectLink.getToProject() == null && projectLink.getToProjectId() > 0) {
            Project toProject = projectDao.select(projectLink.getToProjectId());
            projectLink.setToProject(toProject);
        }
        return projectLink;
    }
View Full Code Here

TOP

Related Classes of org.focusns.model.core.Project

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.