Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dad
archive-format-converter
Commits
d9610d57
Commit
d9610d57
authored
Sep 17, 2021
by
marceteau
Browse files
refactor : la conversion retourne une liste au lieu d'un File
parent
d442640f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/cines/pac/converter/ArchiveConverterMain.java
View file @
d9610d57
...
...
@@ -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
>
convertedArchive
List
=
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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment