Package org.sete.service.project

Examples of org.sete.service.project.ScienceProjectService


            throws Exception {

        checkAuthorization(userHasPrivilege(request.getSession(),
                                            getPrivileges()));

        ScienceProjectService service = getService(ScienceProjectService.class);
        ScienceProjectVo project = service.loadScienceProjectByStudentUserId(getAuthenticatedUser(request).getUserId());
        request.setAttribute("project", project);
        return mapping.findForward(WebConstants.FORWARD_VIEW);
    }
View Full Code Here


                                    HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        checkAuthorization(userHasPrivilege(request.getSession(),
                                            getPrivileges()));
        ScienceProjectService service = getService(ScienceProjectService.class);
        //This segment valildates the UploadFormFile form manually because automatic Struts validation does not work.
        ActionErrors errors = new ActionErrors();
        String typeId = ((UploadFileForm) form).getMyFileTypeId().trim();
        if(typeId.length()< 1){
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("uploadFile.typeId"));
        }
        if(((UploadFileForm) form).getMyFile().getFileSize()< 1){
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("uploadFile.file"));
        }
        if(service.loadScienceProjectByStudentUserId(getAuthenticatedUser(request).getUserId())== null){
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("uploadFile.no.project"));
        }
        if(!errors.isEmpty()){
            saveErrors(request, errors);
            return mapping.getInputForward();
        }

        UploadFileVo ufvo = new UploadFileVo();
        BeanUtils.copyProperties(ufvo, form);
        //set the ID of the project which will be associated with this file.
        ufvo.setUserId(getAuthenticatedUser(request).getUserId());
        service.saveProjectFile(ufvo);


        return mapping.findForward(WebConstants.FORWARD_VIEW);
    }
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

        checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));

    ScienceProjectService service = getService(ScienceProjectService.class);
    List<ScienceProjectVo> projects = service.loadAllScienceProjects();
    request.setAttribute("projects", projects);

        return mapping.findForward(WebConstants.FORWARD_VIEW);
  }
View Full Code Here

      ActionForm form, HttpServletRequest request,
      HttpServletResponse response) throws Exception {

    checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));
    // TO DO - fix for Spring'07 - create VO which holds all the form beans
    ScienceProjectService service = getService(ScienceProjectService.class);

        HttpSessionManager.bind(request.getSession(),
                                "students",
                                service.loadAllUsersByRole(UserRoleType.Key.STUDENT_KEY));
    HttpSessionManager.bind(request.getSession(),
                                "sponsors",
                                service.loadAllUsersByRole(UserRoleType.Key.SPONSOR_KEY));

        return mapping.findForward(WebConstants.FORWARD_VIEW);
  }
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));

        ScienceProjectService service = getService(ScienceProjectService.class);

        CreateScienceProjectVo cspvo = new CreateScienceProjectVo();
        BeanUtils.copyProperties(cspvo, form);
        cspvo.setCreator(getAuthenticatedUser(request).getUserId().toString());

        service.createNewScienceProject(cspvo);

        return mapping.findForward(WebConstants.FORWARD_VIEW);
  }
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

        checkAuthorization(userHasPrivilege(request.getSession(), getAdminPrivileges()));

    ScienceProjectService service = getService(ScienceProjectService.class);
    service.deleteScienceProject(request.getParameter("projId"));

        return mapping.findForward("view");
  }
View Full Code Here

        checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));

        CreateProjectForm cpf = (CreateProjectForm) form;

    ScienceProjectService service = getService(ScienceProjectService.class);
    Boolean canUserEdit = service.isStudentInProject(this.getAuthenticatedUser(request).getUserId(), request.getParameter("projId"));
    this.checkAuthorization(canUserEdit || userHasPrivilege(request.getSession(), getAdminPrivileges()) );
   
    CreateScienceProjectVo spvo = service.loadScienceProject(request.getParameter("projId"));

    BeanUtils.copyProperties(cpf, spvo);
    HttpSessionManager.bind(request.getSession(),
        "students",
        service.loadAllUsersByRole(UserRoleType.Key.STUDENT_KEY));
    HttpSessionManager.bind(request.getSession(),
        "sponsors",
        service.loadAllUsersByRole(UserRoleType.Key.SPONSOR_KEY));

    return mapping.findForward("view");
    }
View Full Code Here

        } else {
          return mapping.findForward("view");
        }
      }

        ScienceProjectService service = getService(ScienceProjectService.class);

        CreateScienceProjectVo cspvo = new CreateScienceProjectVo();
        BeanUtils.copyProperties(cspvo, form);
       
        if(userHasPrivilege(request.getSession(), getAdminPrivileges())){
          service.editScienceProject(cspvo, Boolean.TRUE);
          return mapping.findForward("adminView");
        } else {
          service.editScienceProject(cspvo, Boolean.FALSE);
          return mapping.findForward("view");
        }
     
     
    }
View Full Code Here

            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        checkAuthorization(userHasPrivilege(request.getSession(), getAdditionalPrivileges()));

        ScienceProjectService service = getService(ScienceProjectService.class);
        Integer id = new Integer(request.getParameter("key"));
        Integer projid = new Integer(request.getParameter("projkey"));

        AttachmentVo data = service.loadProjectFilesData(getAuthenticatedUser(request).getUserId(),projid,id);
        String fileName = data.getName();
        if(fileName == null){
            return;
        }
        //fixing an issue I experienced when viewing files with spaces in the file name
View Full Code Here

                                               HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        //checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));

        ScienceProjectService service = getService(ScienceProjectService.class);

        CreateScienceProjectFileTypeVo cspftvo = new CreateScienceProjectFileTypeVo();
        BeanUtils.copyProperties(cspftvo, form);
        //generate the unique key for the new Type
        String key = cspftvo.getType().toLowerCase().replaceAll(" ", "_");
        cspftvo.setKey(key);
        try
        {
            service.createNewScienceProjectFileType(cspftvo);
        }
        catch(final Exception excp)
        {
            final BusinessRuleException bre = new BusinessRuleException();
            bre.addCodedMessage("projectFileType.exists", new String[]{key});
View Full Code Here

TOP

Related Classes of org.sete.service.project.ScienceProjectService

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.