Skip to content

Commit

Permalink
Extract file moving logic to separate method
Browse files Browse the repository at this point in the history
  • Loading branch information
scezen committed Oct 18, 2024
1 parent 41325c2 commit 56f72dd
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ui/src/main/java/org/open4goods/ui/services/OpenDataService.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,27 @@ private void prepareDirectories() throws IOException {
uiConfig.tmpGtinZipFile().getParentFile().mkdirs();
}

private void processDataFiles() throws IOException {
LOGGER.info("Starting process for ISBN_13");
processAndCreateZip(ISBN_DATASET_FILENAME, BarcodeType.ISBN_13, uiConfig.tmpIsbnZipFile());

LOGGER.info("Starting process for GTIN/EAN");
processAndCreateZip(GTIN_DATASET_FILENAME, BarcodeType.ISBN_13, uiConfig.tmpGtinZipFile(), true);
}

private void moveTmpFilesToFinalDestination() throws IOException {
moveFile(uiConfig.tmpIsbnZipFile(), uiConfig.isbnZipFile());
moveFile(uiConfig.tmpGtinZipFile(), uiConfig.gtinZipFile());
}

private void moveFile(File src, File dest) throws IOException {
if (dest.exists()) {
FileUtils.deleteQuietly(dest);
}
FileUtils.moveFile(src, dest);
}


/**
* Processes and creates the ZIP files for the opendata.
*/
Expand Down

0 comments on commit 56f72dd

Please sign in to comment.