Package org.cipres.treebase.domain.study

Examples of org.cipres.treebase.domain.study.Submission


         
         

          citation.setAuthors(null);   
                 
          Submission submission = mSubmissionService.createSubmission(user, study);
 
          long unixTime = System.currentTimeMillis() / 1000L;
         
          List<File> files = DryadUtil.getDataFiles(dataPath);
          HashMap<String, Integer> filenamesHash = new HashMap<String, Integer>();
              for(int i=0; i<files.size(); i++ ) {
               
                int filecount = 1;
               
                File originalFile = new File(files.get(i).getAbsolutePath());
               
                /* This keeps a hashmap of the files so that going through it knows the count of each file
                 * Each file then has a prefix of the count and unix timestamp of the upload
                 */
               
                if (filenamesHash.containsKey(originalFile.getName())) {
                  filecount = filenamesHash.get(originalFile.getName()) + 1;
                  filenamesHash.put(originalFile.getName(), filecount);
                }
                else {
                  filenamesHash.put(originalFile.getName(), filecount);
                }

                String copyDir = request.getSession().getServletContext()
                .getRealPath(TreebaseUtil.FILESEP + "NexusFileUpload")
            + TreebaseUtil.FILESEP + request.getRemoteUser();

               
                File copyFile = new File(copyDir +
                            TreebaseUtil.FILESEP +
                            filenamesHash.get(originalFile.getName()) +
                            "_" +
                            unixTime +
                            "_" +
                            files.get(i).getName());
               
                FileUtils.copyFile(originalFile, copyFile);
             
                files.remove(i);
                files.add(i,copyFile);

                submission.getStudy().addNexusFile(files.get(i).getName(), TreebaseUtil.readFileToString(files.get(i)));
              }
          MyProgressionListener listener = new MyProgressionListener();
          getSubmissionService().addNexusFilesJDBC(submission, files, listener);
         
          // save Study object to session         
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.study.Submission

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.