From db90a90c89a55b78a244205ef2928e371ff9df1e Mon Sep 17 00:00:00 2001 From: zhangab Date: Thu, 17 May 2018 21:42:04 +0800 Subject: Fix service create request body bug for so Change-Id: Id6e9244ad73bef791550aab9cb7813db75c2b393 Issue-ID: USECASEUI-115 Signed-off-by: zhangab --- .../onap/usecaseui/server/constant/Constant.java | 7 ++- .../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 netWorkMap = new HashMap(); } 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 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) { -- cgit 1.2.3-korg