Skip to content

Commit

Permalink
Simplified logic for loads
Browse files Browse the repository at this point in the history
  • Loading branch information
oblodgett committed Nov 7, 2024
1 parent 2df4b82 commit 55217db
Showing 1 changed file with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean
bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES);
}
bulkLoadFileDAO.persist(bulkLoadFile);
history.setBulkLoad(bulkLoad);
history.setBulkLoadFile(bulkLoadFile);
bulkLoadFileHistoryDAO.persist(history);

Log.info("Firing Pending Bulk File History Event: " + history.getId());
pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId()));
} else if (load.getBulkloadStatus().isForced()) {
bulkLoadFile = bulkLoadFiles.getResults().get(0);
if (history.getBulkloadStatus().isNotRunning()) {
Expand All @@ -142,27 +148,26 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean
Log.info("Cleaning up downloaded file: " + localFilePath);
new File(localFilePath).delete();
}
if (cleanUp) {
bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES);
}
bulkLoadFileDAO.merge(bulkLoadFile);
history.setBulkLoad(bulkLoad);
history.setBulkLoadFile(bulkLoadFile);
bulkLoadFileHistoryDAO.persist(history);

Log.info("Firing Pending Bulk File History Event: " + history.getId());
pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId()));
} else {
Log.info("Bulk File already exists not creating it");
bulkLoadFile = bulkLoadFiles.getResults().get(0);
Log.info("Cleaning up downloaded file: " + localFilePath);
new File(localFilePath).delete();
bulkLoadFile.setLocalFilePath(null);
bulkLoadFileDAO.merge(bulkLoadFile);
Log.info("File already exists not running load");
return;
}

history.setBulkLoad(bulkLoad);
history.setBulkLoadFile(bulkLoadFile);
bulkLoadFileHistoryDAO.persist(history);

if (cleanUp) {
bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES);
}
bulkLoadFileDAO.merge(bulkLoadFile);
bulkLoadDAO.merge(load);
Log.info("Firing Pending Bulk File History Event: " + history.getId());
pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId()));
}

protected void startLoad(BulkLoad load) {
Expand Down

0 comments on commit 55217db

Please sign in to comment.