Package org.sete.vo.project

Examples of org.sete.vo.project.AttachmentVo


        p.setForms(f);
        List<ScienceProject> l = new ArrayList<ScienceProject>();
        l.add(p);
        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo att = scienceProjectService.loadProjectFilesData(studentId,toTestID,formID);
        assertEquals(name,att.getName());
    }
View Full Code Here


    public AttachmentVo loadProjectFileData(int formID)
    {
        final ReferenceScienceProject rsp = refProjDao.getReferenceScienceProject();
       
        final AttachmentVo file = new AttachmentVo();
        final Set<Attachment> forms = rsp.getForms();
        for(Attachment a: forms)
        {
            if(a.getId().equals(formID))
            {
                file.setName(a.getName());
                file.setContents(a.getContents());
               
                break;
            }
        }
View Full Code Here

    {
        final List<AttachmentVo> files = new ArrayList<AttachmentVo>();
       
        for(Attachment a: rsp.getForms())
        {
            final AttachmentVo avo = new AttachmentVo();
            avo.setId(a.getId());
            avo.setName(a.getName());
            avo.setType(a.getType());
            files.add(avo);
        }
       
        return files;
    }   
View Full Code Here

        p.setId(badID);
        List<ScienceProject> l = new ArrayList<ScienceProject>();
        l.add(p);
        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo att = scienceProjectService.loadProjectFilesData(toTestID,0);
        assertEquals(true,att != null);
        assertEquals(true,att.getId() == null);
    }
View Full Code Here

        p.setForms(f);
        List<ScienceProject> l = new ArrayList<ScienceProject>();
        l.add(p);
        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo att = scienceProjectService.loadProjectFilesData(toTestID,badID);
        assertEquals(true,att != null);
        assertEquals(true,att.getId() == null);
    }
View Full Code Here

        p.setForms(f);
        List<ScienceProject> l = new ArrayList<ScienceProject>();
        l.add(p);
        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo att = scienceProjectService.loadProjectFilesData(toTestID,formID);
        assertEquals(name,att.getName());
    }
View Full Code Here

        p.setForms(f);
        List<ScienceProject> l = new ArrayList<ScienceProject>();
        l.add(p);
        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo att = scienceProjectService.loadProjectFilesData(toTestID,formID);
        assertEquals(name,att.getName());
    }
View Full Code Here

        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
        fileName = fileName.replace(' ', '_');
        //fixing cache issue in IE
        response.setHeader("Pragma", "public");
        response.setHeader("Cache-Control", "max-age=0");
        //normal response requirements for prompting user
        response.setContentType("application/download");
        response.setHeader("Content-Disposition","attachment; filename="+fileName);
        //
        response.getOutputStream().write(data.getContents());
        response.getOutputStream().flush();
        response.getOutputStream().close();

    }
View Full Code Here

        final TemplateProjectService service = getService(TemplateProjectService.class);
       
        final Integer id = new Integer(request.getParameter("key"));
       
        final AttachmentVo data = service.loadProjectFileData(id);
        String fileName = data.getName();
        if(fileName == null)
        {
            return;
        }
        //fixing an issue I experienced when viewing files with spaces in the file name
        fileName = fileName.replace(' ', '_');
       
        //fixing cache issue in IE
        response.setHeader("Pragma", "public");
        response.setHeader("Cache-Control", "max-age=0");
       
        //normal response requirements for prompting user
        response.setContentType("application/download");
        response.setHeader("Content-Disposition","attachment; filename="+fileName);

        //write file content to the output
        response.getOutputStream().write( data.getContents() );
        response.getOutputStream().flush();
        response.getOutputStream().close();
    }   
View Full Code Here

        ScienceProjectService service = getService(ScienceProjectService.class);
        Integer id = new Integer(request.getParameter("key"));
        Integer projid = new Integer(request.getParameter("projkey"));
       
        AttachmentVo data = service.loadProjectFilesData(projid,id);
        String fileName = data.getName();
        //fixing an issue I experienced when viewing files with spaces in the file name
        fileName = fileName.replace(' ', '_');
        //fixing cache issue in IE
        response.setHeader("Pragma", "public");
        response.setHeader("Cache-Control", "max-age=0");
        //normal response requirements for prompting user
        response.setContentType("application/download");
        response.setHeader("Content-Disposition","attachment; filename="+fileName);
        //
        response.getOutputStream().write(data.getContents());
        response.getOutputStream().flush();
        response.getOutputStream().close();

    }
View Full Code Here

TOP

Related Classes of org.sete.vo.project.AttachmentVo

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.