Skip to content

Commit

Permalink
Refactor export method in BaseExporter.java
Browse files Browse the repository at this point in the history
  • Loading branch information
hisener committed Aug 22, 2017
1 parent f572133 commit 4db706f
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ protected void exportFile(String fileName, T bean) {

@Override
public void export() {
List<T> currentBeanList = null;
List<T> currentBeanList;
try {
currentBeanList = retrieveEntities();
} catch (Exception e) {
logger.error("Error at Listing " + exportDirectory.getName(), e);
return;
}

for (T bean : currentBeanList) {
exportFile(getExportDirectory().getAbsolutePath() + "/" + getBeanFileName(bean) + ".json", bean);
}
if (currentBeanList != null)
for (T bean : currentBeanList) {
exportFile(getExportDirectory().getAbsolutePath() + "/" + getBeanFileName(bean) + ".json", bean);
}
}

protected abstract String getBeanFileName(T bean);
Expand Down

0 comments on commit 4db706f

Please sign in to comment.