private void exportSourceDocuments(Project aProject,File aCopyDir) throws IOException, ProjectExportException {
  File sourceDocumentDir=new File(aCopyDir + SOURCE_FOLDER);
  FileUtils.forceMkdir(sourceDocumentDir);
  List<de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument> documents=repository.listSourceDocuments(aProject);
  documents.addAll(automationService.listTabSepDocuments(aProject));
  int i=1;
  for (  de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument sourceDocument : documents) {
    try {
      FileUtils.copyFileToDirectory(repository.getSourceDocumentFile(sourceDocument),sourceDocumentDir);
      progress=(int)Math.ceil(((double)i) / documents.size() * 10.0);
      i++;
    }
 catch (    FileNotFoundException e) {
      StringBuffer errorMessage=new StringBuffer();
      errorMessage.append("Source file '");
      errorMessage.append(sourceDocument.getName());
      errorMessage.append("' related to project couldn't be located in repository");
      LOG.error(errorMessage.toString());
      LOG.error(ExceptionUtils.getRootCause(e));
      messages.add(errorMessage.toString());
      throw new ProjectExportException("Couldn't find some source file(s) related to project");
    }
  }
}

private void exportSourceDocuments ( Project aProject , File aCopyDir ) throws IOException , ProjectExportException { File sourceDocumentDir = new File ( aCopyDir + SOURCE_FOLDER ) ; FileUtils . forceMkdir ( sourceDocumentDir ) ; List < de . tudarmstadt . ukp . clarin . webanno . model . SourceDocument > documents = repository . listSourceDocuments ( aProject ) ; documents . addAll ( automationService . listTabSepDocuments ( aProject ) ) ; int i = 1 ; for ( de . tudarmstadt . ukp . clarin . webanno . model . SourceDocument sourceDocument : documents ) { try { FileUtils . copyFileToDirectory ( repository . getSourceDocumentFile ( sourceDocument ) , sourceDocumentDir ) ; progress = ( int ) Math . ceil ( ( ( double ) i ) / documents . size ( ) * 10.0 ) ; i ++ ; } catch ( FileNotFoundException e ) { StringBuffer errorMessage = new StringBuffer ( ) ; errorMessage . append ( "Source file '" ) ; errorMessage . append ( sourceDocument . getName ( ) ) ; errorMessage . append ( "' related to project couldn't be located in repository" ) ; LOG . error ( errorMessage . toString ( ) ) ; LOG . error ( ExceptionUtils . getRootCause ( e ) ) ; messages . add ( errorMessage . toString ( ) ) ; throw new ProjectExportException ( "Couldn't find some source file(s) related to project" ) ; } } }
copy source documents from the file system of this project to the export folder
