diff options
-rwxr-xr-x | server/src/main/java/org/onap/usecaseui/server/constant/Constant.java | 7 | ||||
-rw-r--r-- | server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceTemplateService.java | 58 |
2 files changed, 38 insertions, 27 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java index 472f5406..ef654768 100755 --- a/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java +++ b/server/src/main/java/org/onap/usecaseui/server/constant/Constant.java @@ -15,6 +15,10 @@ */
package org.onap.usecaseui.server.constant;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput;
public final class Constant
{
@@ -22,5 +26,6 @@ public final class Constant public static final String DATE_FORMAT= "yyyy-MM-dd HH:mm:ss";
public static final String RegEX_DATE_FORMAT = "[^0-9-:]";
-
+
+ public static Map<String,ServiceTemplateInput> netWorkMap = new HashMap<String,ServiceTemplateInput>();
}
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 faf511d5..abad7fb1 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 @@ -19,6 +19,7 @@ import com.google.common.io.Files; import okhttp3.ResponseBody; import org.onap.usecaseui.server.bean.lcm.ServiceTemplateInput; import org.onap.usecaseui.server.bean.lcm.TemplateInput; +import org.onap.usecaseui.server.constant.Constant; import org.onap.usecaseui.server.service.lcm.ServiceTemplateService; import org.onap.usecaseui.server.service.lcm.domain.aai.AAIService; import org.onap.usecaseui.server.service.lcm.domain.aai.bean.SDNCController; @@ -216,6 +217,7 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { for (Map.Entry<String, Property> entry : properties.entrySet()) { String key = entry.getKey(); if (key.endsWith("providing_service_uuid")) { + Constant.netWorkMap.put(String.valueOf(entry.getValue().getValue()), newServiceTemplateInput(nodeTemplate)); return String.valueOf(entry.getValue().getValue()); } } @@ -279,32 +281,36 @@ public class DefaultServiceTemplateService implements ServiceTemplateService { } private static ServiceTemplateInput newServiceTemplateInput(ToscaTemplate tosca) { - String invariantUUID = tosca.getMetaData().getValue("invariantUUID"); - String uuid = tosca.getMetaData().getValue("UUID"); - String name = tosca.getMetaData().getValue("name"); - String type = tosca.getMetaData().getValue("type"); - String version = tosca.getMetaData().getValue("version"); - if (version == null) { - version = ""; - } - String description = tosca.getMetaData().getValue("description"); - String category = tosca.getMetaData().getValue("category"); - String subcategory = tosca.getMetaData().getValue("subcategory"); - String customizationUuid = tosca.getMetaData().getValue("customizationUUID"); - if(subcategory == null) { - subcategory = ""; - } - return new ServiceTemplateInput( - invariantUUID, - uuid, - name, - type, - version, - description, - category, - subcategory, - customizationUuid, - new ArrayList<>()); + if(Constant.netWorkMap.containsKey(tosca.getMetaData().getValue("UUID"))){ + return Constant.netWorkMap.get(tosca.getMetaData().getValue("UUID")); + }else{ + String invariantUUID = tosca.getMetaData().getValue("invariantUUID"); + String uuid = tosca.getMetaData().getValue("UUID"); + String name = tosca.getMetaData().getValue("name"); + String type = tosca.getMetaData().getValue("type"); + String version = tosca.getMetaData().getValue("version"); + if (version == null) { + version = ""; + } + String description = tosca.getMetaData().getValue("description"); + String category = tosca.getMetaData().getValue("category"); + String subcategory = tosca.getMetaData().getValue("subcategory"); + String customizationUuid = tosca.getMetaData().getValue("customizationUUID"); + if(subcategory == null) { + subcategory = ""; + } + return new ServiceTemplateInput( + invariantUUID, + uuid, + name, + type, + version, + description, + category, + subcategory, + customizationUuid, + new ArrayList<>()); + } } private static ServiceTemplateInput newServiceTemplateInput(NodeTemplate nodeTemplate) { |