Package org.sete.service.project

Examples of org.sete.service.project.ScienceProjectService


      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("view");
  }
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);
   
        String key = cspftvo.getType().toLowerCase().replaceAll(" ", "");
        cspftvo.setKey(key);      
        service.createNewScienceProjectFileType(cspftvo);
        TypeLoader.initializeSystemTypes(super.getServletContext());

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

   
        CreateScienceProjectFileTypeVo cspftvo = new CreateScienceProjectFileTypeVo();
        CreateProjectFileTypeForm fileTypeForm = (CreateProjectFileTypeForm) form; 
        BeanUtils.copyProperties(cspftvo, fileTypeForm);
        cspftvo.setKey(request.getParameter("key"));
        ScienceProjectService service = getService(ScienceProjectService.class);
        service.updateScienceProjectFileType(cspftvo);
        TypeLoader.initializeSystemTypes(super.getServletContext());
       
        return mapping.findForward("view");
  }
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    //checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));
    AttachmentType type = TypeUtil.forKey(AttachmentType.class, request.getParameter("key"));      
        ScienceProjectService service = getService(ScienceProjectService.class);
        service.deleteScienceProjectFileType(type);
        TypeLoader.initializeSystemTypes(super.getServletContext());
       
        return mapping.findForward("view");
  }
View Full Code Here

        vo.setActionType(TypeUtil.forKey(PrivilegeActionType.class,
                                         PrivilegeActionType.Key.READ_KEY.getKey()));

        checkAuthorization(userHasPrivilege(request.getSession(), vo));
       
        ScienceProjectService service = getService(ScienceProjectService.class);
        AuthenticatedUserVo userVo = getAuthenticatedUser(request);
        List<ScienceProjectVo> projects = service.loadAllScienceProjectsSponsoredBy(userVo.getUserId());
        request.setAttribute("sponsoredProjects", projects);
        return mapping.findForward("view");
    }
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

   
        CreateScienceProjectFileTypeVo cspftvo = new CreateScienceProjectFileTypeVo();
        CreateProjectFileTypeForm fileTypeForm = (CreateProjectFileTypeForm) form; 
        BeanUtils.copyProperties(cspftvo, fileTypeForm);
        cspftvo.setKey(request.getParameter("key"));
        ScienceProjectService service = getService(ScienceProjectService.class);
        service.updateScienceProjectFileType(cspftvo);
        TypeLoader.initializeSystemTypes(super.getServletContext());
       
        return mapping.findForward("view");
  }
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception {

    //checkAuthorization(userHasPrivilege(request.getSession(), getPrivileges()));
    AttachmentType type = TypeUtil.forKey(AttachmentType.class, request.getParameter("key"));      
        ScienceProjectService service = getService(ScienceProjectService.class);
        service.deleteScienceProjectFileType(type);
        TypeLoader.initializeSystemTypes(super.getServletContext());
       
        return mapping.findForward("view");
  }
View Full Code Here

    vo.setActionType(TypeUtil.forKey(PrivilegeActionType.class,
        PrivilegeActionType.READ));

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

    ScienceProjectService service = getService(ScienceProjectService.class);
    List<ScienceProjectVo> projects = service.loadAllScienceProjects();
    request.setAttribute("projects", projects);
    return mapping.findForward("view");
  }
View Full Code Here

    vo.setActionType(TypeUtil.forKey(PrivilegeActionType.class,
        PrivilegeActionType.READ_WRITE));

    checkAuthorization(userHasPrivilege(request.getSession(), vo));
    //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.STUDENT_KEY));
    HttpSessionManager.bind(request.getSession(), "sponsors", service.loadAllUsersByRole(UserRoleType.SPONSOR_KEY));
    return mapping.findForward("view");
  }
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.