summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main')
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java78
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java117
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java2
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java4
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/NicDataHealer.java48
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java46
6 files changed, 274 insertions, 21 deletions
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java
new file mode 100644
index 0000000000..c759d21f01
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ComponentQuestionnaireHealer.java
@@ -0,0 +1,78 @@
+package org.openecomp.sdc.healing.healers;
+
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+import java.util.Map;
+
+
+public class ComponentQuestionnaireHealer implements Healer {
+ /*private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+ VendorSoftwareProductDaoFactory.getInstance().createInterface();*/
+
+ private static final ComponentDao componentDao =
+ ComponentDaoFactory.getInstance().createInterface();
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ public ComponentQuestionnaireHealer(){
+
+ }
+ @Override
+ public Object heal(Map<String, Object> healingParams) throws Exception {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+ String vspId = (String) healingParams.get(SdcCommon.VSP_ID);
+ Version version = (Version) healingParams.get(SdcCommon.VERSION);
+ String user = (String) healingParams.get(SdcCommon.USER);
+ Collection<ComponentEntity> componentEntities =
+ componentDao.list(new ComponentEntity(vspId, version, null));
+ componentEntities.forEach(componentEntity -> {
+ /*String questionnaire=vendorSoftwareProductDao.getComponent(vspId, version, componentEntity
+ .getId()).getQuestionnaireData();*/
+ String questionnaire = componentDao.getQuestionnaireData(vspId, version, componentEntity
+ .getId()).getQuestionnaireData();
+ if (questionnaire != null) {
+ JsonParser jsonParser = new JsonParser();
+ JsonObject json = (JsonObject) jsonParser.parse(questionnaire);
+ if (json.getAsJsonObject("compute") != null && json.getAsJsonObject("compute")
+ .getAsJsonObject("vmSizing") != null) {
+ json.getAsJsonObject("compute").remove("vmSizing");
+ }
+
+ if (json.getAsJsonObject("compute") != null && json.getAsJsonObject("compute")
+ .getAsJsonObject("numOfVMs") != null ) {
+ if (json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").
+ get("CpuOverSubscriptionRatio") != null ) {
+ json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").remove
+ ("CpuOverSubscriptionRatio");
+ }
+ if (json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").
+ get("MemoryRAM") != null ) {
+ json.getAsJsonObject("compute").getAsJsonObject("numOfVMs").remove("MemoryRAM");
+ }
+ }
+
+ if (json.getAsJsonObject("general") != null && json.getAsJsonObject("general")
+ .getAsJsonObject("image") != null && json.getAsJsonObject("general").getAsJsonObject
+ ("image").get("format") != null) {
+ json.getAsJsonObject("general").getAsJsonObject("image").remove("format");
+ }
+ String questionnaireData = json.toString();
+ /*vendorSoftwareProductDao.updateComponentQuestionnaire(vspId, version, componentEntity
+ .getId(),questionnaireData);*/
+ componentDao.updateQuestionnaireData(vspId, version, componentEntity.getId(),
+ questionnaireData);
+ }
+ });
+ return componentEntities;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
index 656f7af26f..6fdf14451f 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,6 +35,12 @@ import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComputeDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.DeploymentFlavorDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ImageDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NetworkDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
@@ -42,6 +48,9 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
@@ -49,6 +58,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorF
import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Component;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.ComponentData;
import org.openecomp.sdc.vendorsoftwareproduct.types.composition.CompositionData;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -70,6 +80,10 @@ public class CompositionDataHealer implements Healer {
private static ComponentDao componentDao = ComponentDaoFactory.getInstance().createInterface();
private static NicDao nicDao = NicDaoFactory.getInstance().createInterface();
private static NetworkDao networkDao = NetworkDaoFactory.getInstance().createInterface();
+ private static ComputeDao computeDao = ComputeDaoFactory.getInstance().createInterface();
+ private static DeploymentFlavorDao deloymentFlavorDao = DeploymentFlavorDaoFactory.getInstance()
+ .createInterface();
+ private static ImageDao imageDao = ImageDaoFactory.getInstance().createInterface();
private static final ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDao =
ServiceModelDaoFactory.getInstance().createInterface();
@@ -97,24 +111,93 @@ public class CompositionDataHealer implements Healer {
networkDao.list(new NetworkEntity(vspId, version, null));
Optional<ToscaServiceModel> serviceModelForHealing = getServiceModelForHealing(vspId, version);
-
- if (!doesVspNeedCompositionDataHealing(componentEntities, networkEntities,
+ CompositionData compositionData = null;
+ if (!doesVspNeedCompositionDataHealing(vspId, version, componentEntities, networkEntities,
nicEntities)) {
updateComponentsDisplayNames(componentEntities);
- mdcDataDebugMessage.debugExitMessage(null);
- return Optional.empty();
+ mdcDataDebugMessage.debugExitMessage(null, null);
+ //return Optional.empty();
+ } else {
+ if (!serviceModelForHealing.isPresent()) {
+ mdcDataDebugMessage.debugExitMessage(null, null);
+ return Optional.empty();
+ }
+ compositionData = healCompositionData(vspId, version, serviceModelForHealing);
}
+ compositionData =
+ getCompositionDataForHealing(vspId, version, serviceModelForHealing.get());
+ HealNfodData(vspId, version, compositionData);
+ mdcDataDebugMessage.debugExitMessage(null, null);
+ return Optional.of(compositionData);
+ }
+ private boolean doesVspNeedCompositionDataHealing(String vspId, Version version,
+ Collection<ComponentEntity> componentEntities,
+ Collection<NetworkEntity> networkEntities,
+ Collection<NicEntity> nicEntities) {
- if (!serviceModelForHealing.isPresent()) {
- mdcDataDebugMessage.debugExitMessage(null);
- return Optional.empty();
- }
+ return (CollectionUtils.isEmpty(componentEntities) && CollectionUtils.isEmpty(nicEntities) &&
+ CollectionUtils.isEmpty(networkEntities) );
+
+// mdcDataDebugMessage.debugEntryMessage(null, null);
+//
+//// ToscaServiceModel toscaServiceModel;
+//
+// ByteBuffer contentData = uploadData.getContentData();
+// FileContentHandler fileContentHandler = CommonUtil.validateAndUploadFileContent(uploadData
+// .getContentData().array());
+//
+//
+//
+// TranslatorOutput translatorOutput =
+// HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
+// ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
+//
+//// toscaServiceModel = enrichedServiceModelDao.getServiceModel(vspId, version);
+//
+// mdcDataDebugMessage.debugExitMessage(null, null);
+// return toscaServiceModel;
- CompositionData compositionData = healCompositionData(vspId, version, serviceModelForHealing);
+ }
- mdcDataDebugMessage.debugExitMessage(null);
- return Optional.of(compositionData);
+ private void HealNfodData(String vspId, Version version, CompositionData compositionData) {
+ Collection<ComponentEntity> componentEntities;
+ /*componentEntities =
+ vendorSoftwareProductDao.listComponents(vspId, version);*/
+ componentEntities = componentDao.list(new ComponentEntity(vspId, version, null));
+
+ /*Collection<ComputeEntity> computeEntities=vendorSoftwareProductDao.listComputesByVsp(vspId,
+ version);
+ Collection<ImageEntity> imageEntities =vendorSoftwareProductDao.listImagesByVsp(vspId, version);
+ Collection<DeploymentFlavorEntity> deploymentFlavorEntities =vendorSoftwareProductDao
+ .listDeploymentFlavors(vspId, version);*/
+
+ Collection<ComputeEntity> computeEntities = computeDao.listByVsp(vspId, version);
+ Collection<ImageEntity> imageEntities = imageDao.listByVsp(vspId, version);
+ Collection<DeploymentFlavorEntity> deploymentFlavorEntities = deloymentFlavorDao.list(new
+ DeploymentFlavorEntity(vspId, version, null));
+
+ if (CollectionUtils.isEmpty(computeEntities) && CollectionUtils.isEmpty(imageEntities)) {
+ for (Component component : compositionData.getComponents()) {
+ String componentId = null;
+ for (ComponentEntity componentEntity:componentEntities) {
+ if (componentEntity.getComponentCompositionData().getName().equals(component.getData()
+ .getName())) {
+ componentId = componentEntity.getId();
+ break;
+ }
+ }
+ compositionEntityDataManager.saveComputesFlavorByComponent(vspId,version,component,
+ componentId);
+ compositionEntityDataManager.saveImagesByComponent(vspId,version,component,
+ componentId);
+ }
+
+ }
+
+ if (CollectionUtils.isEmpty(deploymentFlavorEntities)) {
+ compositionEntityDataManager.saveDeploymentFlavors(vspId,version,compositionData);
+ }
}
private CompositionData healCompositionData(String vspId, Version version,
@@ -204,7 +287,7 @@ public class CompositionDataHealer implements Healer {
try {
serviceModelDao.storeServiceModel(vspId, version,
translatorOutput.getToscaServiceModel());
- }catch (Exception e){
+ } catch (Exception e) {
return Optional.empty();
}
@@ -212,14 +295,14 @@ public class CompositionDataHealer implements Healer {
return Optional.of(translatorOutput.getToscaServiceModel());
}
- private TranslatorOutput getTranslatorOutputForHealing(UploadDataEntity uploadData){
+ private TranslatorOutput getTranslatorOutputForHealing(UploadDataEntity uploadData) {
FileContentHandler fileContentHandler;
try {
fileContentHandler =
- CommonUtil.loadUploadFileContent(uploadData.getContentData().array());
+ CommonUtil.validateAndUploadFileContent(uploadData.getContentData().array());
return HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
- }catch (Exception e){
+ } catch (Exception e) {
return null;
}
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
index 14fe885d53..e0b7adb6d3 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
@@ -94,7 +94,7 @@ public class FileDataStructureHealer implements Healer {
byte[] byteContentData = uploadData.getContentData().array();
FileContentHandler fileContentHandler;
try{
- fileContentHandler = CommonUtil.loadUploadFileContent(byteContentData);
+ fileContentHandler = CommonUtil.validateAndUploadFileContent(byteContentData);
Map<String, List<ErrorMessage>> errors = new HashMap<>();
OrchestrationTemplateCandidateData candidateDataEntity =
new CandidateEntityBuilder(candidateService)
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
index fb9dfe7e4f..d5ccd36c95 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
@@ -16,8 +16,6 @@ import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
import org.openecomp.sdc.versioning.dao.types.Version;
@@ -55,7 +53,7 @@ public class HeatToToscaTranslationHealer implements Healer {
FileContentHandler fileContentHandler;
TranslatorOutput translatorOutput;
try {
- fileContentHandler = CommonUtil.loadUploadFileContent(uploadData
+ fileContentHandler = CommonUtil.validateAndUploadFileContent(uploadData
.getContentData().array());
translatorOutput =
HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/NicDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/NicDataHealer.java
new file mode 100644
index 0000000000..123a943785
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/NicDataHealer.java
@@ -0,0 +1,48 @@
+package org.openecomp.sdc.healing.healers;
+
+
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.NetworkType;
+import org.openecomp.sdc.vendorsoftwareproduct.types.composition.Nic;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Collection;
+import java.util.Map;
+
+public class NicDataHealer implements Healer {
+ /*private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+ VendorSoftwareProductDaoFactory.getInstance().createInterface();*/
+
+ private static final NicDao nicDao = NicDaoFactory.getInstance().createInterface();
+
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ public NicDataHealer(){
+
+ }
+ @Override
+ public Object heal(Map<String, Object> healingParams) throws Exception {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+ String vspId = (String) healingParams.get(SdcCommon.VSP_ID);
+ Version version = (Version) healingParams.get(SdcCommon.VERSION);
+ String user = (String) healingParams.get(SdcCommon.USER);
+ Collection<NicEntity> nics = nicDao.listByVsp(vspId, version);
+ for (NicEntity nicEntity : nics) {
+ Nic nic = nicEntity.getNicCompositionData();
+ if (nic != null && nic.getNetworkType()==null) {
+ nic.setNetworkType(NetworkType.Internal);
+ nicEntity.setNicCompositionData(nic);
+ //vendorSoftwareProductDao.updateNic(nicEntity);
+ nicDao.update(nicEntity);
+ }
+ }
+ return nics;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java
new file mode 100644
index 0000000000..5d6050a7f0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java
@@ -0,0 +1,46 @@
+package org.openecomp.sdc.healing.healers;
+
+
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.healing.interfaces.Healer;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.Map;
+import java.util.Objects;
+
+public class VspOnboardingMethodHealer implements Healer {
+ /*private static final VendorSoftwareProductDao vendorSoftwareProductDao =
+ VendorSoftwareProductDaoFactory.getInstance().createInterface();*/
+ private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao =
+ VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ public VspOnboardingMethodHealer(){
+
+ }
+ @Override
+ public Object heal(Map<String, Object> healingParams) throws Exception {
+ mdcDataDebugMessage.debugEntryMessage(null, null);
+
+ String onboardingMethod=null;
+ String vspId = (String) healingParams.get(SdcCommon.VSP_ID);
+ Version version = (Version) healingParams.get(SdcCommon.VERSION);
+ VspDetails vendorSoftwareProductInfo =
+ vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version));
+ vendorSoftwareProductInfo.getOnboardingMethod();
+
+ if(Objects.isNull(vendorSoftwareProductInfo.getOnboardingMethod())) {
+ onboardingMethod="HEAT";
+ vendorSoftwareProductInfo.setOnboardingMethod(onboardingMethod);
+ vendorSoftwareProductInfoDao.update(vendorSoftwareProductInfo);
+ //vendorSoftwareProductDao.updateVendorSoftwareProductInfo(vendorSoftwareProductInfo);
+ }
+ return onboardingMethod;
+ }
+}