Commit d9610d57 authored by marceteau's avatar marceteau
Browse files

refactor : la conversion retourne une liste au lieu d'un File

parent d442640f
......@@ -28,6 +28,8 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
......@@ -95,7 +97,7 @@ public class ArchiveConverterMain {
if (converter.onlyManifest) {
converter.manifestConversion();
} else {
File convertedArchive = converter.archiveConversion();
List<File> convertedArchiveList = converter.archiveConversion();
}
} catch(MissingArgumentException e) {
System.err.println(e.getMessage());
......@@ -322,7 +324,7 @@ public class ArchiveConverterMain {
}
public File archiveConversion() throws IngestRejectException, IOException, NotSupportedException, DuplicateLanguageException, ParseException, IllegalArgumentException {
public List<File> archiveConversion() throws IngestRejectException, IOException, NotSupportedException, DuplicateLanguageException, ParseException, IllegalArgumentException {
ArchiveConverter archiveConverter = null;
if(formalism.equals("sip") || formalism.equals("aip")) {
......@@ -337,6 +339,7 @@ public class ArchiveConverterMain {
archiveConverter.setOutputDir(this.outputDir.toString());
archiveConverter.setErrorLanguageDir(this.errorLanguageFolder.toString());
List<File> convertedArchiveList = new ArrayList<File>();
if (this.inputFolder != null) {
// Workaround pour appeler archiveConverter dans une inner class
......@@ -356,7 +359,8 @@ public class ArchiveConverterMain {
.forEach(file -> {
currentArchivePath = Paths.get(file.getAbsolutePath());
try {
ac.convert(file.toPath(), agency, propertiesFolder);
File convertedArchive = ac.convert(file.toPath(), agency, propertiesFolder);
convertedArchiveList.add(convertedArchive);
} catch (DuplicateLanguageException e) {
manageLanguageRejectException(e);
} catch (IngestRejectException e) {
......@@ -376,8 +380,10 @@ public class ArchiveConverterMain {
if(!formalism.equals("aip")) {
depositFormControl(aipPath);
}
return archiveConverter.convert(this.manifestPath, agency, propertiesFolder);
File convertedArchive = archiveConverter.convert(this.manifestPath, agency, propertiesFolder);
convertedArchiveList.add(convertedArchive);
}
return convertedArchiveList;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment