diff options
author | zhangab <zhanganbing@chinamobile.com> | 2018-05-17 21:42:04 +0800 |
---|---|---|
committer | zhangab <zhanganbing@chinamobile.com> | 2018-05-17 21:42:12 +0800 |
commit | db90a90c89a55b78a244205ef2928e371ff9df1e (patch) | |
tree | f7d730d7466e0458aaa90b73dedc4d5871d38675 | |
parent | 73ea0edeb5dfc2dc21ed64a787dce5e4693d4572 (diff) |
Fix service create request body bug for so
Change-Id: Id6e9244ad73bef791550aab9cb7813db75c2b393
Issue-ID: USECASEUI-115
Signed-off-by: zhangab <zhanganbing@chinamobile.com>
-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) { |