Skip to content

Commit

Permalink
Copy Avram schema to output directory #250
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Apr 3, 2023
1 parent 37dc185 commit b0e8d73
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/de/gwdg/metadataqa/marc/cli/ValidatorCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.marc4j.marc.Record;

Expand Down Expand Up @@ -296,9 +297,25 @@ public void afterIteration(int numberOfprocessedRecords) {
}
printCollector();
}
copySchemaFileToOutputDir();

logger.info("all printing is DONE");
}

private void copySchemaFileToOutputDir() {
if (parameters.isPica()) {
String schemaFile = StringUtils.isNotEmpty(parameters.getPicaSchemaFile())
? parameters.getPicaSchemaFile()
: Paths.get("src/main/resources/pica/avram-k10plus-title.json").toAbsolutePath().toString();
File source = new File(schemaFile);
try {
FileUtils.copyFileToDirectory(source, new File(parameters.getOutputDir()));
} catch (IOException e) {
logger.warning(e.getLocalizedMessage());
}
}
}

private void printCounter() {
File countFile = prepareReportFile(parameters.getOutputDir(), "count.csv");
if (parameters.getRecordIgnorator().isEmpty()) {
Expand Down

0 comments on commit b0e8d73

Please sign in to comment.