@Override public Project getProject(String id) throws BizPolicyException { Project proj = projectService.get(id); if (proj == null) { return null; } return proj; }
@Override public Set<Project> findByAdmin(Person admin) { if (admin == null) { return null; } if (admin.getRoles().contains(Role.ROLE_ADMIN)) { return new HashSet<Project>(projectService.getAll()); } else { return relationshipService.getProjectsForAdministrator(admin); } }
@Override public String updateProject(Project project, Person user) throws BizPolicyException, BizInternalException { // check for null arguments if (project == null) { throw new IllegalArgumentException("Project must be set and NOT null, before calling update project"); } // If project is a new one, create a new project in the system // If a project with matching business id is already in the system, update that project with the given // information. if (project.getId() != null & projectService.isExisting(project.getId())) { return updateExistingProject(project, user); } else { return addProject(project, user); } }
Project createdProject = projectService.create(project);
projectService.update(project);
@Override public String updateProject(Project project, Person user) throws BizPolicyException, BizInternalException { // check for null arguments if (project == null) { throw new IllegalArgumentException("Project must be set and NOT null, before calling update project"); } // If project is a new one, create a new project in the system // If a project with matching business id is already in the system, update that project with the given // information. if (project.getId() != null & projectService.isExisting(project.getId())) { return updateExistingProject(project, user); } else { return addProject(project, user); } }
Project createdProject = projectService.create(project);
projectService.update(project);
@Override public Project getProject(String id) throws BizPolicyException { Project proj = projectService.get(id); if (proj == null) { return null; } return proj; }
@Override public Set<Project> findByAdmin(Person admin) { if (admin == null) { return null; } if (admin.getRoles().contains(Role.ROLE_ADMIN)) { return new HashSet<Project>(projectService.getAll()); } else { return relationshipService.getProjectsForAdministrator(admin); } }
Project project = projectService.get(id);
Project project = projectService.get(id);
@Override public Project getProject(String id, Person user) throws BizPolicyException { Project proj = projectService.get(id); if (proj == null) { return null; } // Verify that the user is who they say they are user = UserVerificationUtil.VerifyUser(userService, user); if (!authorizationService.canReadProject(user, proj)) { if (user == null) { throw new BizPolicyException("Please login to view the given project", Type.AUTHENTICATION_ERROR); } else { throw new BizPolicyException("This user is not authorized to view the given project", Type.AUTHORIZATION_ERROR); } } return proj; }
@Override public Project getProject(String id, Person user) throws BizPolicyException { Project proj = projectService.get(id); if (proj == null) { return null; } // Verify that the user is who they say they are user = UserVerificationUtil.VerifyUser(userService, user); if (!authorizationService.canReadProject(user, proj)) { if (user == null) { throw new BizPolicyException("Please login to view the given project", Type.AUTHENTICATION_ERROR); } else { throw new BizPolicyException("This user is not authorized to view the given project", Type.AUTHORIZATION_ERROR); } } return proj; }