* limitations under the License.\r
* ============LICENSE_END============================================\r
* ===================================================================\r
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * \r
*/\r
\r
package org.onap.clamp.clds.client.req.sdc;\r
import org.apache.commons.io.IOUtils;\r
import org.apache.commons.lang3.StringUtils;\r
import org.apache.http.HttpHeaders;\r
-import org.onap.clamp.clds.exception.SdcCommunicationException;\r
+import org.onap.clamp.clds.config.ClampProperties;\r
+import org.onap.clamp.clds.exception.sdc.SdcCommunicationException;\r
import org.onap.clamp.clds.model.CldsAlarmCondition;\r
-import org.onap.clamp.clds.model.CldsSdcArtifact;\r
-import org.onap.clamp.clds.model.CldsSdcResource;\r
-import org.onap.clamp.clds.model.CldsSdcResourceBasicInfo;\r
-import org.onap.clamp.clds.model.CldsSdcServiceDetail;\r
-import org.onap.clamp.clds.model.CldsSdcServiceInfo;\r
import org.onap.clamp.clds.model.CldsServiceData;\r
import org.onap.clamp.clds.model.CldsVfData;\r
import org.onap.clamp.clds.model.CldsVfKPIData;\r
import org.onap.clamp.clds.model.CldsVfcData;\r
-import org.onap.clamp.clds.model.prop.Global;\r
-import org.onap.clamp.clds.model.prop.ModelProperties;\r
-import org.onap.clamp.clds.model.refprop.RefProp;\r
+import org.onap.clamp.clds.model.properties.Global;\r
+import org.onap.clamp.clds.model.properties.ModelProperties;\r
+import org.onap.clamp.clds.model.sdc.SdcArtifact;\r
+import org.onap.clamp.clds.model.sdc.SdcResource;\r
+import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo;\r
+import org.onap.clamp.clds.model.sdc.SdcServiceDetail;\r
+import org.onap.clamp.clds.model.sdc.SdcServiceInfo;\r
+import org.onap.clamp.clds.service.CldsService;\r
import org.onap.clamp.clds.util.CryptoUtils;\r
+import org.onap.clamp.clds.util.JacksonUtils;\r
import org.onap.clamp.clds.util.LoggingUtils;\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.stereotype.Component;\r
private static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";\r
private static final String RESOURCE_URL_PREFIX = "resources";\r
@Autowired\r
- private RefProp refProp;\r
+ private ClampProperties refProp;\r
\r
/**\r
* Return SDC id and pw as a HTTP Basic Auth string (for example: Basic\r
* A list of CldsSdcServiceInfo\r
* @return A list of CldsSdcServiceInfo without duplicate service UUID\r
*/\r
- public List<CldsSdcServiceInfo> removeDuplicateServices(List<CldsSdcServiceInfo> rawCldsSdcServiceList) {\r
- List<CldsSdcServiceInfo> cldsSdcServiceInfoList = null;\r
+ public List<SdcServiceInfo> removeDuplicateServices(List<SdcServiceInfo> rawCldsSdcServiceList) {\r
+ List<SdcServiceInfo> cldsSdcServiceInfoList = null;\r
if (rawCldsSdcServiceList != null && !rawCldsSdcServiceList.isEmpty()) {\r
// sort list\r
Collections.sort(rawCldsSdcServiceList);\r
for (int i = 1; i < rawCldsSdcServiceList.size(); i++) {\r
// compare name with previous - if not equal, then keep the\r
// previous (it's the last with that name)\r
- CldsSdcServiceInfo prev = rawCldsSdcServiceList.get(i - 1);\r
+ SdcServiceInfo prev = rawCldsSdcServiceList.get(i - 1);\r
if (!rawCldsSdcServiceList.get(i).getName().equals(prev.getName())) {\r
cldsSdcServiceInfoList.add(prev);\r
}\r
* @param rawCldsSdcResourceList\r
* @return List of CldsSdcResource\r
*/\r
- public List<CldsSdcResource> removeDuplicateSdcResourceInstances(List<CldsSdcResource> rawCldsSdcResourceList) {\r
- List<CldsSdcResource> cldsSdcResourceList = null;\r
+ public List<SdcResource> removeDuplicateSdcResourceInstances(List<SdcResource> rawCldsSdcResourceList) {\r
+ List<SdcResource> cldsSdcResourceList = null;\r
if (rawCldsSdcResourceList != null && !rawCldsSdcResourceList.isEmpty()) {\r
// sort list\r
Collections.sort(rawCldsSdcResourceList);\r
for (int i = 1; i < rawCldsSdcResourceList.size(); i++) {\r
// compare name with previous - if not equal, then keep the\r
// previous (it's the last with that name)\r
- CldsSdcResource prev = rawCldsSdcResourceList.get(i - 1);\r
+ SdcResource prev = rawCldsSdcResourceList.get(i - 1);\r
if (!rawCldsSdcResourceList.get(i).getResourceInstanceName().equals(prev.getResourceInstanceName())) {\r
cldsSdcResourceList.add(prev);\r
}\r
* @param rawCldsSdcResourceListBasicList\r
* @return List of CldsSdcResourceBasicInfo\r
*/\r
- public List<CldsSdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(\r
- List<CldsSdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {\r
- List<CldsSdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;\r
+ public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(\r
+ List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {\r
+ List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;\r
if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {\r
// sort list\r
Collections.sort(rawCldsSdcResourceListBasicList);\r
for (int i = 1; i < rawCldsSdcResourceListBasicList.size(); i++) {\r
// compare name with previous - if not equal, then keep the\r
// previous (it's the last with that name)\r
- CldsSdcResourceBasicInfo prev = rawCldsSdcResourceListBasicList.get(i - 1);\r
+ SdcResourceBasicInfo prev = rawCldsSdcResourceListBasicList.get(i - 1);\r
if (!rawCldsSdcResourceListBasicList.get(i).getName().equals(prev.getName())) {\r
cldsSdcResourceBasicInfoList.add(prev);\r
}\r
throws GeneralSecurityException, DecoderException {\r
String serviceUuid = "";\r
String responseStr = getSdcServicesInformation(null);\r
- List<CldsSdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);\r
- List<CldsSdcServiceInfo> cldsSdcServicesList = removeDuplicateServices(rawCldsSdcServicesList);\r
+ List<SdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);\r
+ List<SdcServiceInfo> cldsSdcServicesList = removeDuplicateServices(rawCldsSdcServicesList);\r
if (cldsSdcServicesList != null && !cldsSdcServicesList.isEmpty()) {\r
- for (CldsSdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {\r
+ for (SdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {\r
if (currCldsSdcServiceInfo != null && currCldsSdcServiceInfo.getInvariantUUID() != null\r
&& currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {\r
serviceUuid = currCldsSdcServiceInfo.getUuid();\r
* @return The list of CldsSdcServiceInfo, if there is a failure it return\r
* an empty list\r
*/\r
- private List<CldsSdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {\r
- ObjectMapper objectMapper = new ObjectMapper();\r
+ private List<SdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {\r
if (StringUtils.isBlank(jsonStr)) {\r
return new ArrayList<>();\r
}\r
try {\r
- return objectMapper.readValue(jsonStr,\r
- objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcServiceInfo.class));\r
+ return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()\r
+ .getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));\r
} catch (IOException e) {\r
logger.error("Error when attempting to decode the JSON containing CldsSdcServiceInfo", e);\r
return new ArrayList<>();\r
* @return The list of CldsSdcResourceBasicInfo, an empty list in case of\r
* issues\r
*/\r
- private List<CldsSdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {\r
- ObjectMapper objectMapper = new ObjectMapper();\r
+ private List<SdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {\r
if (StringUtils.isBlank(jsonStr)) {\r
return new ArrayList<>();\r
}\r
try {\r
- return objectMapper.readValue(jsonStr,\r
- objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcResourceBasicInfo.class));\r
+ return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, JacksonUtils.getObjectMapperInstance()\r
+ .getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));\r
} catch (IOException e) {\r
logger.error("Exception occurred when attempting to decode the list of CldsSdcResourceBasicInfo JSON", e);\r
return new ArrayList<>();\r
* @param jsonStr\r
* @return\r
*/\r
- public CldsSdcServiceDetail getCldsSdcServiceDetailFromJson(String jsonStr) {\r
- ObjectMapper objectMapper = new ObjectMapper();\r
+ public SdcServiceDetail decodeCldsSdcServiceDetailFromJson(String jsonStr) {\r
try {\r
- return objectMapper.readValue(jsonStr, CldsSdcServiceDetail.class);\r
+ return JacksonUtils.getObjectMapperInstance().readValue(jsonStr, SdcServiceDetail.class);\r
} catch (IOException e) {\r
logger.error("Exception when attempting to decode the CldsSdcServiceDetail JSON", e);\r
return null;\r
String serviceUuid = getServiceUuidFromServiceInvariantId(invariantServiceUuid);\r
String serviceDetailUrl = url + "/" + serviceUuid + SDC_METADATA_URL_PREFIX;\r
String responseStr = getCldsServicesOrResourcesBasedOnURL(serviceDetailUrl);\r
- ObjectMapper objectMapper = new ObjectMapper();\r
CldsServiceData cldsServiceData = new CldsServiceData();\r
if (responseStr != null) {\r
- CldsSdcServiceDetail cldsSdcServiceDetail;\r
+ SdcServiceDetail cldsSdcServiceDetail;\r
try {\r
- cldsSdcServiceDetail = objectMapper.readValue(responseStr, CldsSdcServiceDetail.class);\r
+ cldsSdcServiceDetail = JacksonUtils.getObjectMapperInstance().readValue(responseStr,\r
+ SdcServiceDetail.class);\r
} catch (IOException e) {\r
logger.error("Exception when decoding the CldsServiceData JSON from SDC", e);\r
throw new SdcCommunicationException("Exception when decoding the CldsServiceData JSON from SDC", e);\r
if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null) {\r
cldsServiceData.setServiceUUID(cldsSdcServiceDetail.getUuid());\r
cldsServiceData.setServiceInvariantUUID(cldsSdcServiceDetail.getInvariantUUID());\r
- List<CldsSdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(\r
+ List<SdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(\r
cldsSdcServiceDetail.getResources());\r
if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {\r
List<CldsVfData> cldsVfDataList = new ArrayList<>();\r
- for (CldsSdcResource currCldsSdcResource : cldsSdcResourceList) {\r
+ for (SdcResource currCldsSdcResource : cldsSdcResourceList) {\r
if (currCldsSdcResource != null && currCldsSdcResource.getResoucreType() != null\r
&& "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {\r
CldsVfData currCldsVfData = new CldsVfData();\r
throws GeneralSecurityException {\r
// todo : refact this..\r
if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {\r
- List<CldsSdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(\r
- RESOURCE_VF_TYPE);\r
- List<CldsSdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(\r
+ List<SdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_VF_TYPE);\r
+ List<SdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(\r
RESOURCE_VFC_TYPE);\r
allVfcResources.addAll(getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_CVFC_TYPE));\r
for (CldsVfData currCldsVfData : cldsVfDataList) {\r
}\r
}\r
\r
- private List<CldsVfcData> getVfcDataListFromVfResponse(String vfResponse) throws GeneralSecurityException {\r
- ObjectMapper mapper = new ObjectMapper();\r
+ private List<CldsVfcData> getVfcDataListFromVfResponse(String vfResponse) {\r
ObjectNode vfResponseNode;\r
try {\r
- vfResponseNode = (ObjectNode) mapper.readTree(vfResponse);\r
+ vfResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfResponse);\r
} catch (IOException e) {\r
logger.error("Exception when decoding the JSON list of CldsVfcData", e);\r
return new ArrayList<>();\r
String vfcResourceUUIDUrl = catalogUrl + RESOURCE_URL_PREFIX + "/" + resourceUUID + SDC_METADATA_URL_PREFIX;\r
try {\r
String vfcResponse = getCldsServicesOrResourcesBasedOnURL(vfcResourceUUIDUrl);\r
- ObjectMapper mapper = new ObjectMapper();\r
- ObjectNode vfResponseNode = (ObjectNode) mapper.readTree(vfcResponse);\r
+ ObjectNode vfResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfcResponse);\r
ArrayNode vfcArrayNode = (ArrayNode) vfResponseNode.get("resources");\r
if (vfcArrayNode != null) {\r
for (JsonNode vfcjsonNode : vfcArrayNode) {\r
\r
private List<CldsAlarmCondition> getAlarmCondtionsFromVfc(String vfcResponse) throws GeneralSecurityException {\r
List<CldsAlarmCondition> cldsAlarmConditionList = new ArrayList<>();\r
- ObjectMapper mapper = new ObjectMapper();\r
ObjectNode vfcResponseNode;\r
try {\r
- vfcResponseNode = (ObjectNode) mapper.readTree(vfcResponse);\r
+ vfcResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfcResponse);\r
} catch (IOException e) {\r
logger.error("Exception when decoding the JSON list of CldsAlarmCondition", e);\r
return cldsAlarmConditionList;\r
// Method to get the artifact for any particular VF\r
private List<CldsVfKPIData> getFieldPathFromVF(String vfResponse) throws GeneralSecurityException {\r
List<CldsVfKPIData> cldsVfKPIDataList = new ArrayList<>();\r
- ObjectMapper mapper = new ObjectMapper();\r
ObjectNode vfResponseNode;\r
try {\r
- vfResponseNode = (ObjectNode) mapper.readTree(vfResponse);\r
+ vfResponseNode = (ObjectNode) JacksonUtils.getObjectMapperInstance().readTree(vfResponse);\r
} catch (IOException e) {\r
logger.error("Exception when decoding the JSON list of CldsVfKPIData", e);\r
return cldsVfKPIDataList;\r
* @param globalProps\r
* @param cldsServiceData\r
* @return\r
+ * @throws IOException\r
+ * In case of issues during the parsing of the Global Properties\r
*/\r
- public String createPropertiesObjectByUUID(String globalProps, CldsServiceData cldsServiceData) {\r
+ public String createPropertiesObjectByUUID(CldsServiceData cldsServiceData) throws IOException {\r
String totalPropsStr;\r
- ObjectMapper mapper = new ObjectMapper();\r
- ObjectNode globalPropsJson;\r
+ ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
+ ObjectNode globalPropsJson = (ObjectNode) refProp.getJsonTemplate(CldsService.GLOBAL_PROPERTIES_KEY);\r
if (cldsServiceData != null && cldsServiceData.getServiceUUID() != null) {\r
// Objectnode to save all byservice, byvf , byvfc and byalarm nodes\r
ObjectNode byIdObjectNode = mapper.createObjectNode();\r
// To create vf ResourceUUID node with serviceInvariantUUID\r
- ObjectNode invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(mapper,\r
- cldsServiceData);\r
+ ObjectNode invariantUuidObjectNodeWithVf = createVfObjectNodeByServiceInvariantUuid(cldsServiceData);\r
byIdObjectNode.putPOJO("byService", invariantUuidObjectNodeWithVf);\r
// To create byVf and vfcResourceNode with vfResourceUUID\r
- ObjectNode vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(mapper, cldsServiceData.getCldsVfs());\r
+ ObjectNode vfcObjectNodeByVfUuid = createVfcObjectNodeByVfUuid(cldsServiceData.getCldsVfs());\r
byIdObjectNode.putPOJO("byVf", vfcObjectNodeByVfUuid);\r
// To create byKpi\r
ObjectNode kpiObjectNode = mapper.createObjectNode();\r
if (cldsServiceData.getCldsVfs() != null && !cldsServiceData.getCldsVfs().isEmpty()) {\r
for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {\r
if (currCldsVfData != null) {\r
- createKpiObjectNodeByVfUuid(mapper, kpiObjectNode, currCldsVfData.getCldsKPIList());\r
+ createKpiObjectNodeByVfUuid(kpiObjectNode, currCldsVfData.getCldsKPIList());\r
}\r
}\r
}\r
if (cldsServiceData.getCldsVfs() != null && !cldsServiceData.getCldsVfs().isEmpty()) {\r
for (CldsVfData currCldsVfData : cldsServiceData.getCldsVfs()) {\r
if (currCldsVfData != null) {\r
- createAlarmCondObjectNodeByVfcUuid(mapper, vfcResourceUuidObjectNode,\r
- currCldsVfData.getCldsVfcs());\r
+ createAlarmCondObjectNodeByVfcUuid(vfcResourceUuidObjectNode, currCldsVfData.getCldsVfcs());\r
}\r
}\r
}\r
// To create byAlarmCondition with alarmConditionKey\r
List<CldsAlarmCondition> allAlarmConditions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,\r
"alarmCondition");\r
- ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(mapper, allAlarmConditions);\r
+ ObjectNode alarmCondObjectNodeByAlarmKey = createAlarmCondObjectNodeByAlarmKey(allAlarmConditions);\r
byIdObjectNode.putPOJO("byAlarmCondition", alarmCondObjectNodeByAlarmKey);\r
// To create byAlertDescription with AlertDescription\r
List<CldsAlarmCondition> allAlertDescriptions = getAllAlarmConditionsFromCldsServiceData(cldsServiceData,\r
"alertDescription");\r
- ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(mapper, allAlertDescriptions);\r
+ ObjectNode alertDescObjectNodeByAlert = createAlarmCondObjectNodeByAlarmKey(allAlertDescriptions);\r
byIdObjectNode.putPOJO("byAlertDescription", alertDescObjectNodeByAlert);\r
- globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
globalPropsJson.putPOJO("shared", byIdObjectNode);\r
logger.info("Global properties JSON created with SDC info:" + globalPropsJson);\r
- } else {\r
- /**\r
- * to create json with total properties when no serviceUUID passed\r
- */\r
- globalPropsJson = decodeGlobalProp(globalProps, mapper);\r
}\r
totalPropsStr = globalPropsJson.toString();\r
return totalPropsStr;\r
}\r
\r
- private ObjectNode decodeGlobalProp(String globalProps, ObjectMapper mapper) {\r
- try {\r
- return (ObjectNode) mapper.readValue(globalProps, JsonNode.class);\r
- } catch (IOException e) {\r
- logger.error("Exception occurred during decoding of the global props, returning an empty objectNode", e);\r
- return mapper.createObjectNode();\r
- }\r
- }\r
-\r
/**\r
* Method to get alarm conditions/alert description from Service Data.\r
* \r
return alarmCondList;\r
}\r
\r
- private ObjectNode createAlarmCondObjectNodeByAlarmKey(ObjectMapper mapper,\r
- List<CldsAlarmCondition> cldsAlarmCondList) {\r
+ private ObjectNode createAlarmCondObjectNodeByAlarmKey(List<CldsAlarmCondition> cldsAlarmCondList) {\r
+ ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
ObjectNode alarmCondKeyNode = mapper.createObjectNode();\r
if (cldsAlarmCondList != null && !cldsAlarmCondList.isEmpty()) {\r
for (CldsAlarmCondition currCldsAlarmCondition : cldsAlarmCondList) {\r
return alarmCondKeyNode;\r
}\r
\r
- private ObjectNode createVfObjectNodeByServiceInvariantUuid(ObjectMapper mapper, CldsServiceData cldsServiceData) {\r
+ private ObjectNode createVfObjectNodeByServiceInvariantUuid(CldsServiceData cldsServiceData) {\r
+ ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
ObjectNode invariantUuidObjectNode = mapper.createObjectNode();\r
ObjectNode vfObjectNode = mapper.createObjectNode();\r
ObjectNode vfUuidNode = mapper.createObjectNode();\r
return invariantUuidObjectNode;\r
}\r
\r
- private void createKpiObjectNodeByVfUuid(ObjectMapper mapper, ObjectNode vfResourceUuidObjectNode,\r
+ private void createKpiObjectNodeByVfUuid(ObjectNode vfResourceUuidObjectNode,\r
List<CldsVfKPIData> cldsVfKpiDataList) {\r
+ ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
if (cldsVfKpiDataList != null && !cldsVfKpiDataList.isEmpty()) {\r
for (CldsVfKPIData currCldsVfKpiData : cldsVfKpiDataList) {\r
if (currCldsVfKpiData != null) {\r
}\r
}\r
\r
- private void createAlarmCondObjectNodeByVfcUuid(ObjectMapper mapper, ObjectNode vfcResourceUuidObjectNode,\r
+ private void createAlarmCondObjectNodeByVfcUuid(ObjectNode vfcResourceUuidObjectNode,\r
List<CldsVfcData> cldsVfcDataList) {\r
+ ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
ObjectNode vfcObjectNode = mapper.createObjectNode();\r
ObjectNode alarmCondNode = mapper.createObjectNode();\r
ObjectNode alertDescNode = mapper.createObjectNode();\r
* @param cldsVfDataList\r
* @return\r
*/\r
- private ObjectNode createVfcObjectNodeByVfUuid(ObjectMapper mapper, List<CldsVfData> cldsVfDataList) {\r
+ private ObjectNode createVfcObjectNodeByVfUuid(List<CldsVfData> cldsVfDataList) {\r
+ ObjectMapper mapper = JacksonUtils.getObjectMapperInstance();\r
ObjectNode vfUuidObjectNode = mapper.createObjectNode();\r
if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {\r
for (CldsVfData currCldsVfData : cldsVfDataList) {\r
* The artifact name that will be searched\r
* @return The artifact UUID found\r
*/\r
- public String getArtifactIdIfArtifactAlreadyExists(CldsSdcServiceDetail cldsSdcServiceDetail, String artifactName) {\r
+ public String getArtifactIdIfArtifactAlreadyExists(SdcServiceDetail cldsSdcServiceDetail, String artifactName) {\r
String artifactUuid = null;\r
boolean artifactExists = false;\r
if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null\r
&& !cldsSdcServiceDetail.getResources().isEmpty()) {\r
- for (CldsSdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {\r
+ for (SdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {\r
if (artifactExists) {\r
break;\r
}\r
if (currCldsSdcResource != null && currCldsSdcResource.getArtifacts() != null\r
&& !currCldsSdcResource.getArtifacts().isEmpty()) {\r
- for (CldsSdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {\r
+ for (SdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {\r
if (currCldsSdcArtifact != null && currCldsSdcArtifact.getArtifactName() != null\r
&& currCldsSdcArtifact.getArtifactName().equalsIgnoreCase(artifactName)) {\r
artifactUuid = currCldsSdcArtifact.getArtifactUUID();\r
}\r
\r
// To get all sdc VF/VFC Resources basic info.\r
- private List<CldsSdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {\r
+ private List<SdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {\r
String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);\r
String resourceUrl = catalogUrl + "resources?resourceType=" + resourceType;\r
String allSdcVfcResources = getCldsServicesOrResourcesBasedOnURL(resourceUrl);\r
}\r
\r
private String getResourceUuidFromResourceInvariantUuid(String resourceInvariantUuid,\r
- List<CldsSdcResourceBasicInfo> resourceInfoList) {\r
+ List<SdcResourceBasicInfo> resourceInfoList) {\r
String resourceUuid = null;\r
if (resourceInfoList != null && !resourceInfoList.isEmpty()) {\r
- for (CldsSdcResourceBasicInfo currResource : resourceInfoList) {\r
+ for (SdcResourceBasicInfo currResource : resourceInfoList) {\r
if (currResource != null && currResource.getInvariantUUID() != null && currResource.getUuid() != null\r
&& currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {\r
resourceUuid = currResource.getUuid();\r
String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);\r
logger.info("ServiceUUID used before upload in url:" + originalServiceUuid);\r
String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);\r
- CldsSdcServiceDetail cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
+ SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,\r
artifactName);\r
// Upload artifacts to sdc\r
}\r
logger.info("ServiceUUID used after upload in ulr:" + updatedServiceUuid);\r
sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);\r
- cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
+ cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);\r
uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,\r
locationArtifactName);\r
// To send location information also to sdc\r