Skip to content

Commit 0946dc6

Browse files
author
rathnapandi
committed
- Fix issue #545
1 parent f3a2712 commit 0946dc6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

modules/apis/src/main/java/com/axway/apim/api/export/impl/ExportHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ public ExportHelper(APIExportParams params) {
4646
this.params = params;
4747
}
4848

49-
public void saveAPILocally(ObjectMapper mapper, ExportAPI exportAPI, String configFile) throws AppException {
49+
public void saveAPILocally(ObjectMapper mapper, ExportAPI exportAPI, String configFile, int size) throws AppException {
5050

5151
String apiPath = getAPIExportFolder(exportAPI.getPath());
5252
File localFolder = new File(params.getTarget() + File.separator + getVHost(exportAPI) + apiPath);
53+
if (size > 1 && localFolder.exists()) {
54+
localFolder = new File(params.getTarget() + File.separator + getVHost(exportAPI) + apiPath + "-" + System.currentTimeMillis());
55+
}
5356
if (!EnvironmentProperties.PRINT_CONFIG_CONSOLE) {
5457
LOG.debug("Going to export API: {} into folder: {} ", exportAPI.getName(), localFolder);
5558
validateFolder(localFolder);

modules/apis/src/main/java/com/axway/apim/api/export/impl/JsonAPIExporter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ public JsonAPIExporter(APIExportParams params) {
2828
@Override
2929
public void execute(List<API> apis) throws AppException {
3030
LOG.info("Exporting API and configuration as JSON format");
31+
int size = apis.size();
3132
for (API api : apis) {
3233
ExportAPI exportAPI = new ExportAPI(api);
33-
exportHelper.saveAPILocally(new ObjectMapper(), exportAPI, "/api-config.json");
34+
exportHelper.saveAPILocally(new ObjectMapper(), exportAPI, "/api-config.json", size);
3435
}
3536
}
3637

modules/apis/src/main/java/com/axway/apim/api/export/impl/YamlAPIExporter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ public YamlAPIExporter(APIExportParams params) {
2222
@Override
2323
public void execute(List<API> apis) throws AppException {
2424
LOG.info("Export API and configuration as Yaml format");
25+
int size = apis.size();
2526
for (API api : apis) {
2627
ExportAPI exportAPI = new ExportAPI(api);
27-
exportHelper.saveAPILocally(new ObjectMapper(CustomYamlFactory.createYamlFactory()), exportAPI, "/api-config.yaml");
28+
exportHelper.saveAPILocally(new ObjectMapper(CustomYamlFactory.createYamlFactory()), exportAPI, "/api-config.yaml", size);
2829
}
2930
}
3031
}

0 commit comments

Comments
 (0)