Package org.sete.vo.project

Examples of org.sete.vo.project.AttachmentVo


        List<AttachmentVo> files = new ArrayList<AttachmentVo>();
       
        for(ScienceProject p : projects){
            if(p.getId().equals(projectID)){
                for(Attachment a: p.getForms()){
                    AttachmentVo avo = new AttachmentVo();
                    avo.setId(a.getId());
                    avo.setName(a.getName());
                    avo.setType(a.getType());
                    files.add(avo);
                }
             break;
            }
        }
View Full Code Here


        return files;
    }
   
    public AttachmentVo loadProjectFilesData(int projectID,int formID){
        List<ScienceProject> projects = projectDao.getAllScienceProjects();
        AttachmentVo file = new AttachmentVo();
        for(ScienceProject p : projects){
            if(p.getId().equals(projectID)){
             Set<Attachment> forms = p.getForms();
             for(Attachment a: forms){
                 if(a.getId().equals(formID)){
                     file.setName(a.getName());
                     file.setContents(a.getContents());
                     return file;
                 }
             }
            }
        }
View Full Code Here

      vo.setDescription(p.getDescription());
      vo.setCategory(p.getScienceProjectCategoryType().getLabel());
      vo.setSponsor(p.getSponsor().getFirstName()+" "+p.getSponsor().getLastName());
           
      for(Attachment a: p.getForms()){
                AttachmentVo avo = new AttachmentVo();
                avo.setId(a.getId());
                avo.setType(a.getType());
                files.add(avo);
            }
      vo.setFiles(files);
     
            for(SeteUser a: p.getStudents()){
View Full Code Here

        List<AttachmentVo> files = new ArrayList<AttachmentVo>();
       
        for(ScienceProject p : projects){
            if(p.getId().equals(projectID)){
                for(Attachment a: p.getForms()){
                    AttachmentVo avo = new AttachmentVo();
                    avo.setId(a.getId());
                    avo.setName(a.getName());
                    avo.setType(a.getType());
                    files.add(avo);
                }
             break;
            }
        }
View Full Code Here

        return files;
    }
   
    public AttachmentVo loadProjectFilesData(Integer userId, int projectID,int formID){
        List<ScienceProject> projects = projectDao.getAllScienceProjects();
        AttachmentVo file = new AttachmentVo();
        for(ScienceProject p : projects){
            if(p.getId().equals(projectID)){
                Set<SeteUser> studs = p.getStudents();
                Iterator iter = studs.iterator();
                if(! p.getSponsor().getId().equals(userId)){
                    if(! ((SeteUser)iter.next()).getId().equals(userId)){
                        if(iter.hasNext()){
                            if(! ((SeteUser)iter.next()).getId().equals(userId)){
                                return file;
                            }
                        }
                        else return file;
                    }
                }
                   
                 Set<Attachment> forms = p.getForms();
                 for(Attachment a: forms){
                     if(a.getId().equals(formID)){
                         file.setName(a.getName());
                         file.setContents(a.getContents());
                         return file;
                     }
                 }
            }
        }
View Full Code Here

      vo.setCategory(p.getScienceProjectCategoryType().getLabel());
      vo.setSponsor(p.getSponsor().getFirstName()+" "+p.getSponsor().getLastName());
           
      if(p.getForms() != null) {
        for(Attachment a: p.getForms()){
                  AttachmentVo avo = new AttachmentVo();
                  avo.setId(a.getId());
                  avo.setType(a.getType());
                  files.add(avo);
              }
      }
      vo.setFiles(files);
     
View Full Code Here

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

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

       
        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
        EasyMock.expectLastCall().times(3);
        EasyMock.replay(mockScienceProjectDao);
       
        AttachmentVo StudentAtt = scienceProjectService.loadProjectFilesData(studentId,proejctID,formID);
        assertEquals(name,StudentAtt.getName());
       
//        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
//        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo SponsorAtt = scienceProjectService.loadProjectFilesData(sponsorId,proejctID,formID);
        assertEquals(name,SponsorAtt.getName());
       
//        EasyMock.expect(mockScienceProjectDao.getAllScienceProjects()).andReturn(l);
//        EasyMock.replay(mockScienceProjectDao);
        AttachmentVo ImpostorAtt = scienceProjectService.loadProjectFilesData(99,proejctID,formID);
        assertEquals(null,ImpostorAtt.getName());
    }
View Full Code Here

        primeProjectWithStudentandSponsor(p);
        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

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.