Package org.nxplanner.domain

Examples of org.nxplanner.domain.Project


        domainContext = new DomainContext();
        domainContext.populate(object);
        String projectIdParam = request.getParameter("projectId");
        if (domainContext.getProjectId() == 0 && StringUtils.isNotEmpty(projectIdParam) && !projectIdParam.equals("0")) {
            ObjectRepository objectRepository = getRepository(Project.class);
            Project project = (Project)objectRepository.load(Integer.parseInt((request.getParameter("projectId"))));
            domainContext.populate(project);
        }
        domainContext.save(request);
        return domainContext;
    }
View Full Code Here


        super.tearDown();
    }

    // TODO: remove test object factory duplication (AbstractDatabaseTestScript)
    public Project newProject() {
        Project project = new Project();
        project.setId(nextId++);
        project.setName(PROJECT_PREFIX + project.getId());
        return project;
    }
View Full Code Here

        assertTagResult(Tag.SKIP_BODY, result);
    }

    public void testUserAuthorizedForObject() throws Exception {
        Project project = setUpTagWithObjectAuthorization(Boolean.TRUE);

        int result = tag.doStartTag();

        assertTagResultForObject(Tag.EVAL_BODY_INCLUDE, result, project);
    }
View Full Code Here

        assertTagResultForObject(Tag.EVAL_BODY_INCLUDE, result, project);
    }

    public void testUserNotAuthorizedForObject() throws Exception {
        Project project = setUpTagWithObjectAuthorization(Boolean.FALSE);

        int result = tag.doStartTag();

        assertTagResultForObject(Tag.SKIP_BODY, result, project);
    }
View Full Code Here

        assertEquals("wrong param to authorizer", mockObject, mockAuthorizer.hasPermission2DomainObject);
    }

    public void testUserAuthorizedWhenProjectIdFromObject() throws Exception {
        mockAuthorizer.hasPermission2Return = Boolean.TRUE;
        Project mockProject = new Project();
        mockProject.setId(11);
        tag.setObject(mockProject);
        tag.setPermission("set");

        int result = tag.doStartTag();
View Full Code Here

        assertEquals(Tag.EVAL_BODY_INCLUDE, result);
        assertEquals("wrong param to authorizer", 33, mockAuthorizer.hasPermission2ProjectId);
    }

    private Project setUpTagWithObjectAuthorization(Boolean authorization) {
        Project project = new Project();
        project.setId(11);
        tag.setPrincipalId(1);
        tag.setObject(project);
        tag.setPermission("get");
        mockAuthorizer.hasPermission2Return = authorization;
        return project;
View Full Code Here

        story.setName("story");
        Iteration iteration = new Iteration();
        iteration.setName("iteration");
        IterationModel model = new IterationModel(iteration){
            protected Project getProject() {
                Project project = new Project();
                project.setName("project");
                return project;
            }
        };
        this.model = new StoryModel(model,story );
        assertEquals("project :: iteration :: story",this.model.getName());
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
    }

    public void testPopulateTask() throws Exception {
        Project project = newProject();
        Iteration iteration = newIteration(project);
        UserStory story = newUserStory(iteration);
        Task task = newTask(story);
        commitCloseAndOpenSession();
        DomainContext context = new DomainContext();
        context.populate(task);
        assertEquals(project.getId(), context.getProjectId());
        assertEquals(project.getName(), context.getProjectName());
        assertEquals(iteration.getId(), context.getIterationId());
        assertEquals(iteration.getName(), context.getIterationName());
        assertEquals(story.getId(), context.getStoryId());
        assertEquals(story.getName(), context.getStoryName());
        assertSame(task, context.getTargetObject());
View Full Code Here

        assertEquals(story.getName(), context.getStoryName());
        assertSame(task, context.getTargetObject());
    }

    public void testPopulateStory() throws Exception {
        Project project = newProject();
        Iteration iteration = newIteration(project);
        UserStory story = newUserStory(iteration);
        commitCloseAndOpenSession();
        DomainContext context = new DomainContext();
        context.populate(story);
        assertEquals(project.getId(), context.getProjectId());
        assertEquals(project.getName(), context.getProjectName());
        assertEquals(iteration.getId(), context.getIterationId());
        assertEquals(iteration.getName(), context.getIterationName());
        assertEquals(story.getId(), context.getStoryId());
        assertEquals(story.getName(), context.getStoryName());
        assertSame(story, context.getTargetObject());
View Full Code Here

    protected void beforeObjectCommit(Object object, Session session, ActionMapping actionMapping, ActionForm actionForm,
            HttpServletRequest request, HttpServletResponse reply) throws Exception {

        RoleEditorForm roleForm = (RoleEditorForm)actionForm;

        Project project = (Project)object;

        int projectId = project.getId();

        for (int index = 0; index < roleForm.getPersonCount(); index++) {
            int personId = roleForm.getPersonIdAsInt(index);

            if (isAuthorizedRoleAdministratorForProject(request, projectId)) {
View Full Code Here

TOP

Related Classes of org.nxplanner.domain.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.