summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhangab <zhanganbing@chinamobile.com>2018-11-29 18:38:21 +0800
committerzhangab <zhanganbing@chinamobile.com>2018-11-29 18:38:22 +0800
commitdf953e9f55e25d22b562ef653e8636a4de565b67 (patch)
tree62595a0810b11d0bb460e846298af67f0d89177b
parentdb9330941ed6cb9e3c0fe943a0eab0fc7e88c126 (diff)
Reading template files from uui location
Change-Id: Iee48bc431cc5c2c2962717944d7dd0d93ba4436b Issue-ID: USECASEUI-153 Signed-off-by: zhangab <zhanganbing@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java5
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java11
2 files changed, 15 insertions, 1 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
index 704e4112..9aba5cca 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java
@@ -31,6 +31,7 @@ import org.onap.usecaseui.server.service.lcm.domain.sdc.SDCCatalogService;
import org.onap.usecaseui.server.service.lcm.domain.sdc.bean.SDCServiceTemplate;
import org.onap.usecaseui.server.service.lcm.domain.sdc.exceptions.SDCCatalogException;
import org.onap.usecaseui.server.util.RestfulServices;
+import org.onap.usecaseui.server.util.UuiCommonUtil;
import org.openecomp.sdc.toscaparser.api.NodeTemplate;
import org.openecomp.sdc.toscaparser.api.Property;
import org.openecomp.sdc.toscaparser.api.ToscaTemplate;
@@ -94,7 +95,9 @@ public class DefaultServiceTemplateService implements ServiceTemplateService {
String toPath = String.format("/home/uui/%s.csar", uuid);
//String toPath = String.format("D:\\work/%s.csar", uuid);
try {
- downloadFile(toscaModelPath, toPath);
+ if(!UuiCommonUtil.isExistFile(toPath)){
+ downloadFile(toscaModelPath, toPath);
+ }
return extractTemplate(toPath, isVF);
} catch (IOException e) {
throw new SDCCatalogException("download csar file failed!", e);
diff --git a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
index 3a90e713..a1513fd4 100644
--- a/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
+++ b/server/src/main/java/org/onap/usecaseui/server/util/UuiCommonUtil.java
@@ -16,6 +16,7 @@
package org.onap.usecaseui.server.util;
import java.io.BufferedReader;
+import java.io.File;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
@@ -136,4 +137,14 @@ public class UuiCommonUtil {
}
return listPages;
}
+
+ public static boolean isExistFile(String path) {
+
+ if (null == path || "".equals(path.trim())) {
+ return false;
+ }
+
+ File targetFile = new File(path);
+ return targetFile.exists();
+ }
}