Example #1
0
 private void updateFileStatus(CaArrayFileSet fileSet, FileStatus status) {
   final CaArrayFileSet mageTabFileSet = new CaArrayFileSet(fileSet);
   for (final CaArrayFile file : fileSet.getFiles()) {
     if (!isMageTabFile(file)) {
       mageTabFileSet.getFiles().remove(file);
     }
   }
   mageTabFileSet.updateStatus(status);
 }
Example #2
0
  private MageTabFileSet getInputFileSet(Project project, CaArrayFileSet fileSet) {
    final CaArrayFileSet fullSet = new CaArrayFileSet(fileSet);
    fullSet.addAll(
        Collections2.filter(
            project.getImportedFiles(),
            new Predicate<CaArrayFile>() {
              @Override
              public boolean apply(CaArrayFile f) {
                return f.getFileType().isArrayData();
              }
            }));

    final MageTabFileSet inputFileSet = new MageTabFileSet();
    for (final CaArrayFile caArrayFile : fullSet.getFiles()) {
      addInputFile(inputFileSet, caArrayFile);
    }

    return inputFileSet;
  }
Example #3
0
 private void handleSelectRefFilesResult(CaArrayFileSet fileSet, ValidationResult result) {
   for (final String fileName : result.getFileNames()) {
     final CaArrayFile caArrayFile = fileSet.getFile(fileName);
     final FileValidationResult fileResult = result.getFileValidationResult(fileName);
     if (!fileResult.isValid()) {
       // check whether any of the validation errors are other than data file checks
       saveErrorMessages(fileResult, caArrayFile);
     }
   }
 }
Example #4
0
 private void handleResult(CaArrayFileSet fileSet, ValidationResult result) {
   for (final String fileName : result.getFileNames()) {
     final CaArrayFile caArrayFile = fileSet.getFile(fileName);
     final FileValidationResult fileResult = result.getFileValidationResult(fileName);
     if (!fileResult.isValid()) {
       caArrayFile.setFileStatus(FileStatus.VALIDATION_ERRORS);
     } else {
       caArrayFile.setFileStatus(FileStatus.VALIDATED);
     }
     caArrayFile.setValidationResult(fileResult);
     this.projectDao.save(caArrayFile);
   }
 }
Example #5
0
 public MageTabDocumentSet validateFiles(Project targetProject, CaArrayFileSet fileSet) {
   LOG.info("Validating MAGE-TAB document set");
   updateFileStatus(fileSet, FileStatus.VALIDATING);
   MageTabDocumentSet documentSet = null;
   final MageTabFileSet inputSet = getInputFileSet(targetProject, fileSet);
   try {
     updateFileStatus(fileSet, FileStatus.VALIDATED);
     documentSet = MageTabParser.INSTANCE.parse(inputSet);
     handleResult(fileSet, this.translator.validate(documentSet, fileSet));
   } catch (final MageTabParsingException e) {
     updateFileStatus(fileSet, FileStatus.VALIDATION_ERRORS);
   } catch (final InvalidDataException e) {
     handleResult(fileSet, e.getValidationResult());
   }
   this.searchDao.save(fileSet.getFiles());
   return documentSet;
 }
Example #6
0
 /** {@inheritDoc} */
 @Override
 public MageTabDocumentSet importFiles(Project targetProject, CaArrayFileSet fileSet)
     throws MageTabParsingException {
   LOG.info("Importing MAGE-TAB document set");
   updateFileStatus(fileSet, FileStatus.IMPORTING);
   final MageTabFileSet inputSet = getInputFileSet(targetProject, fileSet);
   MageTabDocumentSet documentSet = null;
   try {
     documentSet = MageTabParser.INSTANCE.parse(inputSet);
     final CaArrayTranslationResult translationResult =
         this.translator.translate(documentSet, fileSet);
     save(targetProject, translationResult);
     updateFileStatus(fileSet, FileStatus.IMPORTED);
   } catch (final InvalidDataException e) {
     handleResult(fileSet, e.getValidationResult());
   }
   this.searchDao.save(fileSet.getFiles());
   return documentSet;
 }